-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Improve enum values for Enum Type in Swagger ReadOnly documentation #4191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
d58ecc9
Adding enum values for Enum Type in Swagger ReadOnly documentation
dedece35 3a6b5b1
Merge branch 'master' into master
dedece35 8ee3c6d
Merge remote-tracking branch 'upstream/master'
dedece35 da75e3c
Adding enum values for Enum Type in Swagger ReadOnly documentation (o…
cdf57e4
Merge branch 'master' into master
dedece35 fff710d
Merge branch 'master' into master
shockey 3ac1a3c
Conflict from original github repo
dedece35 c17b02c
Add new display enums, defaults, and examples when not in TIO mode (a…
dedece35 6aba5d1
Fix npm test result
dedece35 a2d863a
Merge branch 'master' into master
dedece35 34761b0
Merge branch 'master' into master
dedece35 7f6c814
Merge branch 'master' into master
dedece35 6bcda39
Merge branch 'master' into master
dedece35 d7bc198
Merge branch 'master' into master
dedece35 dc63157
Merge branch 'master' into master
dedece35 ebb765b
Merge branch 'master' into master
dedece35 7e07e1f
Merge branch 'master' into master
dedece35 fa09a29
review corrections
dedece35 3d93e5a
Merge branch 'master' into master
dedece35 2120836
Merge branch 'master' into master
dedece35 50fdc65
Merge branch 'master' into master
dedece35 3f45283
Merge branch 'master' into master
shockey bac5e7d
fix: don't render parameter description if field is empty
shockey b36b641
use cross-version schema variable to access properties
shockey 9d02ee8
pass className through Markdown component usage
shockey a43d109
add per-field classNames to Markdown for easier styling + testing
shockey 240db57
remove parameter Example field (out-of-scope for this PR)
shockey e5dc422
get default value from schema instead of top-level parameter
shockey 2de8448
tests: add e2e cases for swagger2 and oas3
shockey 1ac4be3
remove `swagger-petstore-enum.json`
shockey 8f1356e
add missing proptypes validation
shockey 16932d2
use `classnames` to more effectively union class names
shockey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
describe("parameter enum rendering", function () { | ||
describe("swagger 2.0", () => { | ||
beforeEach(function (client, done) { | ||
client | ||
.url("localhost:3230") | ||
.waitForElementVisible(".download-url-input", 10000) | ||
.pause(1000) | ||
.clearValue(".download-url-input") | ||
.setValue(".download-url-input", "http://localhost:3230/test-specs/features/parameter-enum-rendering.swagger.yaml") | ||
.click("button.download-url-button") | ||
.pause(1000) | ||
|
||
done() | ||
}) | ||
afterEach(function (client, done) { | ||
done() | ||
}) | ||
it("reveals a string parameter's enums and defaults when viewing that parameter", function (client) { | ||
client.waitForElementVisible(".opblock-tag-section", 10000) | ||
.assert.containsText(".opblock-summary-path span", "/report") | ||
.click(".opblock") | ||
.waitForElementVisible(".opblock.is-open", 5000) | ||
.pause(500) | ||
.assert.containsText("div.parameter__enum", "today, yesterday, lastweek") | ||
.assert.containsText("div.parameter__default", "today") | ||
|
||
client.end() | ||
}) | ||
}) | ||
describe("openapi 3.0", () => { | ||
beforeEach(function (client, done) { | ||
client | ||
.url("localhost:3230") | ||
.waitForElementVisible(".download-url-input", 10000) | ||
.pause(1000) | ||
.clearValue(".download-url-input") | ||
.setValue(".download-url-input", "http://localhost:3230/test-specs/features/parameter-enum-rendering.openapi.yaml") | ||
.click("button.download-url-button") | ||
.pause(1000) | ||
|
||
done() | ||
}) | ||
afterEach(function (client, done) { | ||
done() | ||
}) | ||
it("reveals a string parameter's enums and defaults when viewing that parameter", function (client) { | ||
client.waitForElementVisible(".opblock-tag-section", 10000) | ||
.assert.containsText(".opblock-summary-path span", "/report") | ||
.click(".opblock") | ||
.waitForElementVisible(".opblock.is-open", 5000) | ||
.pause(500) | ||
.assert.containsText("div.parameter__enum", "today, yesterday, lastweek") | ||
.assert.containsText("div.parameter__default", "today") | ||
|
||
client.end() | ||
}) | ||
}) | ||
}) |
21 changes: 21 additions & 0 deletions
21
test/e2e/specs/features/parameter-enum-rendering.openapi.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
openapi: 3.0.0 | ||
info: | ||
title: test | ||
version: 0.0.0 | ||
paths: | ||
/report: | ||
get: | ||
parameters: | ||
- in: query | ||
name: rel_date | ||
required: true | ||
schema: | ||
type: string | ||
default: today | ||
enum: | ||
- today | ||
- yesterday | ||
- lastweek | ||
responses: | ||
'200': | ||
description: OK |
20 changes: 20 additions & 0 deletions
20
test/e2e/specs/features/parameter-enum-rendering.swagger.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
swagger: '2.0' | ||
info: | ||
title: test | ||
version: 0.0.0 | ||
paths: | ||
/report: | ||
get: | ||
parameters: | ||
- in: query | ||
name: rel_date | ||
required: true | ||
type: string | ||
default: today | ||
enum: | ||
- today | ||
- yesterday | ||
- lastweek | ||
responses: | ||
200: | ||
description: OK |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These statements should be inverted: the
if
statement should have a positive condition (paramItems === undefined
) and the else statement should be used for the negative case.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in this condition, I have no positive case : I only want to do things in negative case. I can't translate this condition in positive way.