Accept presets and defaultModelsExpandDepth props in swagger-ui-react component #5386
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.
Improve the swagger-ui-react component configuration flexibility,
Description
This PR adds improvements to swagger-ui-react flavor, Allowing users to pass
defaultModelsExpandDepth
andpresets
parameters via React component properties. Other change is, adding default props fordocExpansion
,defaultModelsExpandDepth
andpreset
parameters. Without the default props.Motivation and Context
When using
swagger-ui-react
package with React 16.x , We wanted to remove theauthorizeBtn
from plugins, But it seems swagger-ui-react component doesn't accept presets nor plugins parameters.Found this similar issue #5367 already raised.
And also I have added default props to newly added properties + the docExpansin property added from this #5242 PR. Without that, if the user didn't pass that prop, Swagger UI
constructorConfig
getundefined
values ( even after the deep linking defaults + opts )How Has This Been Tested?
Locally test the changes and run the
npm test
fromswagger-ui
local copy with the changes.Screenshots (if appropriate):
Checklist
My PR contains...
src/
is unmodified: changes to documentation, CI, metadata, etc.)package.json
)My changes...
Documentation
Automated tests