Commit Graph

606 Commits

Author SHA1 Message Date
Tim Lai
41f84aad05 fix: set yaml parser load option to JSON_SCHEMA (#8023) 2022-05-12 15:51:38 -07:00
Maciej Matyjas
abeb168696 fix(ui): avoid empty div when there are no externalDocs (#7997)
* fix(ui): avoid empty div when there are no externalDocs

* test(ui): existence of externalDocs div when present/absent from spec
2022-05-12 15:45:14 -07:00
Tim Lai
9250e209d4 fix(request-snippets): prevent scrolling errors from missing function (#7941)
* fix(request-snippets): prevent scrolling errors from missing function

* refactor(request-snippets): migrate to functional component

* fix(curl): remove undefined prop and function

* test(live-response): fix import of RequestSnippets
2022-03-24 11:23:42 -07:00
Tim Lai
7b06ac1b7c test(oath): for authorization bearer (#7936) 2022-03-23 14:29:02 -07:00
twjasa
77d0bb960b feat: add modelcollapse to primitive models (#7557)
* update: primitive-model test with modelcollapse

Co-authored-by: Tim Lai <timothy.lai@gmail.com>
2022-03-21 14:50:14 -07:00
Christopher Giroir
c81d7f0f30 feat(docker): add OAUTH_USE_BASIC_AUTH env (#7474)
Makes the last `initOAuth` variable configurable via environment
variables in the swagger-ui docker image.

Co-authored-by: Christopher Giroir <chrisgiroir@improbable.io>
Co-authored-by: Tim Lai <timothy.lai@gmail.com>
2022-03-21 13:53:07 -07:00
Maciej Kowalski
8f63462f9e feat(oauth2): authActions.authPopup plugin accessible wrapper (#7699)
* enables win.open to be extensible by plugins

Co-authored-by: Tim Lai <timothy.lai@gmail.com>
2022-03-10 14:44:46 -08:00
dewijones92
3d79c24949 fix(examples): allow string created by regex pattern (#7829)
Co-authored-by: Tim Lai <timothy.lai@gmail.com>
2022-03-03 16:31:00 -08:00
Anne Stellingwerf
a89c90ec77 fix(oauth2): generate default oauth2RedirectUrl based on page location and path (#7476)
Co-authored-by: Tim Lai <timothy.lai@gmail.com>
2022-02-01 16:25:52 -08:00
Tim Lai
a0e9923dd5 fix(serverVariables): refresh state on definition change (#7821)
* fix(serverVariables): refresh state on definition change

* test(serverVariables): urls with server variables assertions
2022-02-01 15:57:33 -08:00
Mahtis Michel
2b30a3478d feat(requestSnippets): handle type: string, format: binary or base64 file upload data (#7545)
* test(curlify): assert that data-binary is generated

Co-authored-by: Tim Lai <timothy.lai@gmail.com>
2022-01-31 11:34:45 -08:00
Christian Egli
c6d8d779d0 feat: do not ask for client secret when using auth code with PKCE (#7438)
Co-authored-by: Ignacio Lozano <nacholozano@gmail.com>
Co-authored-by: Vladimir Gorej <vladimir.gorej@gmail.com>

Refs #6290
2022-01-26 10:56:09 +01:00
Vladimir Gorej
8b1c4a7c1a feat(error-handling): introduce unified and configurable error handling (#7761)
Refs #7778
2022-01-24 16:12:13 +01:00
Vladimir Gorej
302c483f0a revert: add wait time for bugs/5043 to resolve spec (#7769) (#7775)
Refs affd4b9
2022-01-19 13:51:52 +01:00
Tim Lai
affd4b9e7e test(cypress): add wait time for bugs/5043 to resolve spec (#7769) 2022-01-18 15:34:12 -08:00
Vladimir Gorej
01a3e55960 fix(security): disable reading config params from URL search params (#7697)
Reading configuration parameters from URL search params 
is by default no longer enabled. To re-enable it, set queryConfigEnabled
configuration parameter to true.

Functionally, this is a breaking change, but given we're just providing
a security vulnerability patch we're considering this a PATCH version bump
only.

Refs #4872
Refs https://github.com/swagger-api/swagger-ui/security/advisories/GHSA-qrmm-w75w-3wpx
2021-12-09 17:28:17 +01:00
Vladimir Gorej
b299be764f fix: introduce Error Boundaries to handle unexpected failures (#7671)
Two new components have been updated via plugin system: ErrorBoundary and Fallback.
These components can be overridden by user plugins.

Refs #7647
2021-11-25 13:47:22 +01:00
Vladimir Gorej
fb7e98a431 fix(servers): prevent UI crash when chaning Server with variables
Closes #7525
2021-11-04 16:27:27 +01:00
Vladimir Gorej
62031f3ff0 chore(deps-dev): bump expect from 1.20.2 to 27.3.1
Closes #7607
2021-11-04 14:36:36 +01:00
Vladimir Gorej
e3640739a4 fix(root-inject): handle errors in functional components properly 2021-11-03 09:49:50 +01:00
Vladimir Gorej
8c79e2a375 refactor: prefix lifecycle methods with UNSAFE_
Refs #7341
2021-11-03 09:49:50 +01:00
Vladimir Gorej
14f9b40ef2 test(test:unit-jest): fix all failing tests for this script
We needed to align new cheerio and enzyme
APIS with tests.

Refs #7341
2021-11-03 09:49:50 +01:00
Vladimir Gorej
b504579d26 test(just-test-in-node): fix npm script
Before the script exited with error thrown. Enzyme was updated
to v3.11.0 and custom adapter for react@17 is used.

Refs #7341
2021-11-03 09:49:50 +01:00
Calvin Gonzalez
8ffb1aef97 fix(a11n): provide proper a11n for response example tabs (#7464)
- Update tabs to use <button> elements instead of <a>
- Add aria roles for tablist, tabs, and tabpanel
- Add aria attributes for additional a11y compliance and screen reader accessibility
- Replace ids with data-name attribute for tabpanels
- Add cypress test 7463 and update swos-63
- Move tabs test file to tests/a11y directory
- Rename test file to be more descriptive of what is being tested.
- Add id attributes to both tabs and tabpanels to leverage aria-controls and aria-labelledby attributes

Co-authored-by: Calvin Gonzalez <calvin.gonzalez@oddball.io>
Co-authored-by: Vladimir Gorej <vladimir.gorej@gmail.com>

Closes #7463
Refs #7350
2021-09-17 09:19:55 +03:00
Helen Kosova
f1aab53dd6 fix(sample-gen): generate the correct number of properties (#7432)
This commit fixes correct number of additionalProperties when minProperties is used.
2021-09-15 15:54:26 +03:00
Tim Lai
de3d063ca3 fix(sample-gen): parameter array missing items fallback (#7376)
* fixes #7375
2021-06-24 16:25:54 -07:00
Andreas Grub
13c110a6fe feat(oas3): Show file upload for schema binary format (#7325)
* fix(ux): display actual content type instead of hard-coded application/octet-stream

* feat(ux): show file upload when schema has "format: binary", fixes #5636

* feat(ux): show file upload when schema has "format: base64"

According to
https://github.com/swagger-api/swagger-ui/pull/7325#issuecomment-861684260
the uploaded file should be converted to base64 automatically.

* feat(ux): add cypress tests for displaying an upload button
2021-06-22 15:33:57 -07:00
Tim Lai
87ded996fa fix(sample-gen): oas3 form-data object should generate example (#7355) 2021-06-18 16:49:50 -07:00
Vladimir Gorej
96cdf00adb fix(system): allow wrapping selectors in chain (#7304)
Refs #7157
2021-05-26 11:54:58 -07:00
Damien
516e666f1c feat(wrapComponents): new chain configuration option (#7236)
This commit provides a backward compatible mechanism to chain wrap 
an individual component multiple times

`Chain` mode: allow chaining of plugins on a given component
`Legacy` mode: last plugin to wrap a given component will supercede others

* chore: Add unit test for wrapComponent wrapping

* doc: Add documentation about the new pluginsOptions configuration

* doc: Add a sidenote on plugin-api page

Co-authored-by: Tim Lai <timothy.lai@gmail.com>
2021-05-20 15:41:11 -07:00
Giles Wells
72811bd827 feat: Accessibility improvements (#7224)
* feat: adds a11y for ContentType & Responses region

* feat: adds a11y to expandable/collapsible elements

* fix: add aria label to select element for content types

* fix: add aria label prop to contentType component

* Change optag to h3 for better tag hierarchy


Co-authored-by: ediiotero <eddie.otero@oddball.io>
Co-authored-by: Mike Lumetta <mike.lumetta@adhocteam.us>
Co-authored-by: Alexander Valencia <alex.valencia@adhocteam.us>
2021-05-12 09:40:31 -07:00
Mahtis Michel
53829f18a6 fix: required properties (#7206)
* fix: required properties

schema required properties should not be treated like required: true.
this lead to objects that requires properties being treated as required itself

* test: try-it-out-schema-required-override-allowed

Co-authored-by: Tim Lai <timothy.lai@gmail.com>
2021-04-29 12:31:22 -07:00
Michael Zangl
5906dfae02 fix(authorization): include oauth endpoint description (#7195) 2021-04-20 16:39:11 -07:00
Tim Lai
92f1507408 fix(syntaxHighlighter): request and response examples for json cases (#7199)
* OAS 2 request and response examples for json cases
* OAS 3 request and response examples for json cases
* OAS2 and OAS3 tests
* jsonParse utils for syntax highlighting
2021-04-20 11:39:05 -07:00
Tim Lai
f5b84e59ce feat: markdown sanitization of form tag (#7146) 2021-03-31 11:03:57 -07:00
Mahtis Michel
032bd71e0a feat(sample-gen): infer implicit type and validation constraint types (#7117)
* this closes some dead ends of sample generation where no sample can be generated
2021-03-30 14:28:51 -07:00
Mahtis Michel
4103e0f919 fix: array constraint validation only if value was provided (#7112) 2021-03-30 12:33:56 -07:00
Tim Lai
d17a81e16a fix(cypress): tweak to ensure an element exists before test (#7074) 2021-03-15 17:43:33 -07:00
Mahtis Michel
3ead825287 feat: sample gen should incorporate schema validation constraint (#7043)
* feat(sample-gen): handle minProperties, maxProperties

* fix(sample-gen): lift required

* feat(sample-gen): handle minimum, maximum (+ exclusive)

* feat(sample-gen): handle minLength, maxLength
2021-03-10 13:19:45 -08:00
Mahtis Michel
902241cf7e fix(sample-gen): xml attr with media-type example value (#7045) 2021-03-10 12:44:54 -08:00
Mahtis Michel
f9e54a26bf fix(sample-gen): allOf, oneOf lifting should consider properties and items (#7041) 2021-03-10 11:18:54 -08:00
Mahtis Michel
8405fa0101 feat: request snippets plugin (#6910) 2021-03-10 11:02:34 -08:00
Dan Dumont
f23a9d6924 fix(auth): support pkce when using basic auth header (#7038)
* support pkce when using basic auth header

* test(auth): useBasicAuthenticationWithAccessCodeGrant + usePkceWithAuthorizationCodeGrant
2021-03-10 10:30:20 -08:00
Mahtis Michel
68bd61a682 fix: multipart enum initial value not set (#7004) 2021-03-03 12:49:56 -08:00
Mahtis Michel
7ead9baa80 * fix(sample-gen): enum without type should be handled by sample-gen (#6912) 2021-02-11 09:58:28 -08:00
Chad Killingsworth
5e69d3c4f2 fix: support OAuth2 PKCE when using the OIDC authorization_code flow (#6914)
* Previous checks only supported the OAuth2 authorizationCode flow and missed the equivalent OIDC flow.
2021-02-10 09:52:35 -08:00
Mahtis Michel
5b2ad68f50 fix(sample-gen): case yaml parsed example is number but string schema (#6872) 2021-01-28 09:04:15 -08:00
Kyle Hoskins
265bdc07b7 feat: add tryItOutEnabled configuration (#6865)
* feat: add tryItOutEnabled configuration

allow users to set tryItOutEnabled: true to display
the "Try it out" section by default

tryItOutEnabled to take === "true" for the
query string value or === true if someone
implements query string type parsing in the query
2021-01-26 09:00:38 -08:00
Mahtis Michel
470e2fed9b feat(sample-gen): yaml sample generation (#6858)
* feat(sample-gen): yaml sample generation

if content / media type matches yaml or yml it will generate stringified sample like for json
in addition to that it will generate yaml out of the json sample

Signed-off-by: mathis-m <mathis.michel@outlook.de>

* test(unit-jest): getSampleSchema should handle yaml
2021-01-25 14:43:52 -08:00
Mahtis Michel
e877580d54 feat(ux): enhance media-type switching experience in RequestBodyEditor (#6837)
* feat(ux): enhance media-type switching experience in RequestBodyEditor

1. When canceling the try-out mode the request body will be reset to its initial state.
2. When the user switches the media-type in the try-out mode, the experience is as follows:
   - If the user did edit the request body the body wont be touched and only media type is updated. This is to ensure that user content is NEVER accidentally overwritten with a default value.
   - If the user did not edit the request body it is safe to be replaced by the default value of the target media-type.

Multiple example needed some care in order to allow the retain example value to function properly

* fix(test): workaround cypress issue that can't be reproduced manually

* test: added new feature to ensure enhanced user editing flow

Signed-off-by: mathis-m <mathis.michel@outlook.de>
2021-01-25 11:16:07 -08:00