Commit Graph

469 Commits

Author SHA1 Message Date
Tim Lai
d4eea4da1b fix: models view when object key contains deprecated:true (#6371)
fixes #6369
2020-09-09 16:43:01 -07:00
ben-smartbear
5123b47ef4 fix: Allowing servers dropdown to change when oas3Actions.setSelectedServer is called (#6358)
ref: #6351
2020-09-08 15:37:48 -07:00
Tim Lai
b927db86e3 refactor(enzyme): add url to jsdom constructor for unit test setup (#6356) 2020-09-01 15:25:04 -07:00
Tim Lai
1a27c0a8bd feat: migrate unit tests to Jest (#6353)
* config(jest): updated setup
* config(jest): update testMatch to include jsx files
* config(jest): add transformIgnorePatterns
* config(jest): update ignore files that do not work in jest yet
* config: add test:unit-jest to test script

* fix(jest): lint with eslint-plugin-jest

* refactor(jest): move unit test directory
* refactor(mocha): restore mocha tests that fail in jest

* docs(jest): update helpful scripts with test:unit-jest
2020-09-01 10:41:01 -07:00
Tim Lai
a26bb9284d chore(deps): update react-syntax-highlighter from 12.2.1 to 13.5.0 (#6312)
* fix(cypress): use less restrictive 'include.text' assertion

* includes prismjs@1.21.0 security update
2020-08-18 13:51:50 -07:00
Tim Lai
02e0515b97 fix(cypress): deep-linking tests should use cy.location (#6309) 2020-08-17 14:55:17 -07:00
Tim Lai
471c24dfcb fix(cypress): tests should fail on uncaught exception (#6308)
* also remove broken file logging

ref #6305
2020-08-17 13:58:57 -07:00
Tim Lai
2eaa6c10e4 feat(build): es2015 bundle artifact (#6291)
* es2015 bundle with dependencies via npm script build:es:bundle
* es2015 bundle without dependencies via npm script build:es:bundle
* jest dependency for test:artifact
* migrate babel.config.json to babel.config.js and maintain env support for commonjs and es2015
* remove polyfill
* fix es syntax: replace module.exports with export
* fix es syntax: remove .jsx extension inside import
2020-08-13 17:21:55 -07:00
geraldglynn
d9f5691f65 fix(OAS3): relative urls (#5341)
* Added tooling for appending OAS3 relative URLs to selected Server

Info
* Terms of service URL
* Contact URL
* License URL
* External Docs URL

Tag
* Tag External Docs URL

Operation
* Operation External Docs
** Operation Tag


Co-authored-by: Tim Lai <timothy.lai@gmail.com>
2020-08-04 13:21:19 -07:00
Alec Theriault
225a915cf8 fix: escape $ in curl request bodies and headers (#6245)
This address a bug where a `$` character in a request body or header
would not be properly escaped in a string in the generated curl command.

Fixes #5390
2020-08-03 09:07:06 -07:00
geraldglynn
084b236f76 fix(Models): use specPath for isShownKey to toggle models (#6200)
Co-authored-by: Tim Lai <timothy.lai@gmail.com>
2020-07-31 18:40:47 -07:00
Irena Shaigorodsky
d7d166d0a4 fix: specify charset utf-8 in html script declaration (#6278)
ref: #5311
2020-07-31 16:51:17 -07:00
Tim Lai
22668ee8d3 fix(OAS3): servers component update on definition change (#6280)
* fix(OAS3): servers component should use nextProps

* test(OAS3): cypress tests for selecting multiple servers

* test(OAS3): multiple server test with definition change
2020-07-31 16:22:17 -07:00
Tim Lai
abcc3837e9 fix(requestInterceptor): use async/await to support return new Promise (#6279)
ref: #4778
2020-07-31 10:07:52 -07:00
Helen Kosova
fd5a59a3fd feat: Display minProperties an maxProperties for object schemas (#6272) 2020-07-29 14:06:24 -07:00
Helen Kosova
4cbae095fc fix(try-it-out): Better tooltips for min/max validations (#6266) 2020-07-28 17:10:40 -07:00
Timothy Lai
3cafd6086e config(mocha): remove deprecated --compiler flag 2020-07-24 13:53:54 -07:00
Tim Lai
a73783b73d feat: syntax highlighting of code section (#6236)
Co-authored-by: AdrieanKhisbe <adriean.khisbe@live.fr>
2020-07-17 15:29:15 -07:00
Tim Lai
2fd1e4037c feat(RequestBody): validation support for required fields (#6223)
fixes #5181

* application/json
* application/xml
* application/x-www-form-urlencoded

* Set requestBodyValue values to be an immutable Map, as "value". Previously stored as a normal String.
* This enables adding "errors" to the Map, for validation use

* note: getOAS3RequiredRequestBodyContentType requires state.spec,
* which is not available to state.oas3
2020-07-16 17:53:28 -07:00
Tim Lai
b68942c043 feat(RequestBody): set default true for 'send empty value' (#6228) 2020-07-16 17:01:18 -07:00
Tim Lai
a1589a679c style: replace var with let in /test files (#6164) 2020-06-23 10:16:23 -07:00
Tim Lai
faae3e9d2c style: fix indent spaces from 4 to 2 in test files (#6163) 2020-06-23 09:44:24 -07:00
Vladimir
41e595beda feat: Display nullable for object model itself (#5660) (#5868) 2020-06-22 18:01:33 -07:00
Tim Lai
b86e8e96dd fix: curlify agnostic to order of header values (#6152)
Refs #6082

* use curlify flag isMultipartFormDataRequest
* curlify test updated


Co-authored-by: Vladimir Gorej <vladimir.gorej@gmail.com>
2020-06-18 12:34:52 -07:00
David DE CARVALHO
ca1b19a31b feat: Display example value in Swagger ReadOnly documentation (#4422) 2020-06-15 15:23:28 -07:00
Aldrin Abastillas
973e1f7a9b feat: Copy response to clipboard #4300 (#5278)
* Move next to download button and match styling

Co-authored-by: Aldrin Abastillas <AAbastillas@rcanalytics.com>
Co-authored-by: Tim Lai <timothy.lai@gmail.com>
2020-06-15 15:08:10 -07:00
Vladimir Gorej
a616cb471d fix(Markdown): render markdown in more secure way
This commit changes markdown sanitization behaviour in following way:

class, style and data-* attributes are removed by default. These attributes
open possible vulnerability vectors to attackers.

The original behavior of sanitizer (before this commit) can be enabled by *useUnsafeMarkdown* configuration option.
Use this configuration option with caution and only in cases when you know
what you're doing.
2020-06-11 21:51:15 +02:00
Wesley Schwengle
117dcc9b16 Disable the validation badge for those who do not want it (#5994)
* disabled on string values: "127.0.0.1", "localhost", "none"
2020-06-10 15:31:35 -07:00
John
21f51494a2 fix: support variables in auth urls (#5913) 2020-06-10 14:45:02 -07:00
Matthew Morrissette
275c8f2ccf improvement: oauth "scopes" improvements (#6037)
* improvement: oauth "scopes" init parameter

* improvement: add "select all" and "select none" to oauth scopes popup
2020-06-10 11:27:54 -07:00
Tim Lai
5bbd3e71bd fix: bugs/4641 use wait on route alias (#6048) 2020-06-01 17:14:45 -07:00
Tim Lai
a371ba1ca9 fix: bugs/4641 flaky test (#6047)
* fix: flaky bugs/4641 test

* fix: apply isFunc check for security.getIn
2020-06-01 14:23:51 -07:00
mircohaug
eaca2f6fd8 Add empty data param to cURL if no POST request body was given (#6017)
* Add empty data param to cURL if no request body was given

Some middleware applications do not allow POST requests without a content-length header. By adding a empty data parameter to the curl command, the content-length header will be set by curl. Besides this it is more obvious to the user that no request body is sent.

* use double quotes like the rest of the curl command
2020-05-29 15:10:22 -07:00
Tim Lai
68185dd71a fix: remove special handling of non-FormData entries (#6036)
Ref: #6033

* 'createObjWithHashedKeys' validation consistency with isFunction
* 'createObjWithHashedKeys' additional jsdoc example
2020-05-28 09:16:21 -07:00
Tim Lai
add5753da4 test: improve reliability of /bugs/4641 (#6013)
Ref #6001
2020-05-27 15:45:23 -07:00
Tim Lai
3a65070bf5 fix: entries as property name (#6025) 2020-05-20 11:54:57 -07:00
Tim Lai
96c7b4cbf5 fix: curl array support within multipart/form-data (#3838) (#5999)
ft: utils.createObjWithHashedKeys
ft: curlify.extractKey
test: curlify with array representation
2020-05-13 16:59:37 -07:00
Tim Lai
4542806af6 bug: remove clearValidation from onTryoutClick (#5955) 2020-05-06 14:07:22 -07:00
Tim Lai
5eb23cdd48 ft: JsonSchema components are now ImmutableJS compliant (#5952)
bug: JsonSchema components should validate schema properties exists
  - schema
  - type
  - format
  - enum
bug: fix a debounce error in JsonSchema_string if value is null
ft: new simplified JsonSchemaArrayItemText component
test: use immutableJS for `json-schema-form` test
test: add dev scripts to run `cypress open`
test: new cypress `schema-form` tests
2020-05-06 13:57:58 -07:00
Adam Jones
e98e7be4ec improvement: render OAS3 parameter type formats (#5796)
* Feature: Render OAS3 parameter type formats

* Add more test cases to parameter-row

* Update test/mocha/components/parameter-row.jsx

Co-Authored-By: Helen Kosova <hkosova@users.noreply.github.com>

* Update src/core/components/parameter-row.jsx

Co-authored-by: Helen Kosova <hkosova@users.noreply.github.com>
Co-authored-by: kyle shockey <kyleshockey@gmail.com>
2020-03-08 20:22:17 -04:00
Simon Legg
c9d6ac4cfc improvement: clear auth information from memory when logging out (#5316)
* clears authentications when logout is clicked

* tests the headers sent in the network request

* adds test for multiple api keys

* refactors tests to extract common uses

* correct test message description

Co-authored-by: kyle shockey <kyleshockey@gmail.com>
2020-01-14 21:20:39 -05:00
Jamie Peabody
e8266a3c6d fix: code highlight styles are now only applied pre.microlight (#5673)
* patch(#5672): code highlight styles are now only applied to pre blocks that have the class pre.microlight

* fixed pre style appied to .request-url

* fixed response-headers and request-duration pre blocks

* made pre.microlight class as per review

* added microlight class to appropriate pre and added tests
2019-11-03 20:46:38 -05:00
kyle
75a0e5d5dc fix(validateParam): validate JSON parameter values + support Parameter.content (#5657)
* improve(getParameterSchema): ParameterSchemaDescriptor pattern

* chore: update usage of `getParameterSchema`

* consider `Parameter.content` media type when validating JSON values
2019-10-11 11:20:23 -07:00
poveilleux
139592e353 feat: add PKCE support for OAuth2 Authorization Code flows (#5361)
* Add PKCE support.

* Fix tests

* Update oauth2.md

* Rename usePkce

* Fix the BrokenComponent error

* Update oauth2.md

* Remove isCode variable. Remove uuid4 dependency.

* Remove utils functions

* Import crypto

* Fix tests

* Fix the tests

* Cleanup

* Fix code_challenge generation

* Move code challenge and verifier to utils for mocks. Update tests.

* Mock the PKCE methods in the utils file properly.

* Add missing expect

* use target-method spies

* Add comments to explain test values.

* Get rid of jsrsasign.
2019-10-07 17:24:43 -07:00
kyle
5f6ec8ce1d fix: mitigate "sequential @import chaining" vulnerability (#5616)
* `test/e2e-cypress/tests/features/xss/` -> `test/e2e-cypress/tests/security`

* add tests

* filter <style> tags out of Markdown fields

* initialize OAuth inputs without applying `value` attribute
2019-09-20 13:19:08 -07:00
kyle
00c8e964e7 fix: accept string-represented values in required array runtime validation (#5609)
* rename `listCheck` -> `arrayListCheck`

* allow non-empty strings to quality a required array value
2019-09-15 12:17:42 -07:00
kyle
85f2bf3688 fix: <Select disabled> for type: string + enum schemas (#5601)
* fix: pass `disabled` through JsonSchemaForm – JsonSchema_string – Select

* migrate 5452 regression test
2019-09-10 22:08:03 -07:00
kyle
f523ec40f0 housekeeping: reorganize and rewire Mocha tests (#5600)
* move Mocha-run tests to `test/mocha`

* fix relative paths

* fix JSX test paths

* update stagnated JSX tests

* `test/setup.js` -> `test/mocha/setup.js`

* use regex+globstar for test matching

* remove `console.log`
2019-09-10 21:26:21 -07:00
kyle
94c86d3d50 improvement: online.swagger.io -> validator.swagger.io (#5599) 2019-09-09 21:33:23 -07:00
kyle
c9c3b2338e feature: support for Parameter.content (#5571)
* add `getParameterSchema` OAS helper

* use `Parameter.content.[firstKey].schema` as schema value when present

* `newValue` -> `initialValue`

* make `paramWithMeta` a const

* add trailing comma to `swagger2SchemaKeys`

* refactor `helpers` to a folder

* deprecate `src/core/utils.js` in favor of `src/core/helpers/`

* support `Parameter.content.[mediaType].schema` in validateParam

* reject `null` as an OAS3 object value

* expose Fetch errors in the browser console

* generate ParameterRow default values based on `content` values

* add tests for `getParameterSchema`

* remove debugger statement

* remove debugger statement

* don't apply `generatedSampleValue`s to parameters with `examples`

* remove extra semi

* disable JSON check in parameter runtime validation

* stringify JsonSchema_object textarea values

* add Cypress tests

* swagger-client@3.9.4
2019-08-31 16:37:43 -07:00