Skip to content
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

Support Json spec overwrite attribute after fetch spec from URL, URLs or local path #9615

Open
daotoan-hd opened this issue Feb 19, 2024 · 0 comments

Comments

@daotoan-hd
Copy link

Content & configuration

Swagger/OpenAPI definition:
Pet Store Example

Swagger-UI configuration options:
I'm just using dev-helper-initializer

/* eslint-disable no-undef */
window.onload = function() {
 window["SwaggerUIBundle"] = window["swagger-ui-bundle"]
 window["SwaggerUIStandalonePreset"] = window["swagger-ui-standalone-preset"]
 // Build a system
 const ui = SwaggerUIBundle({
   urls: [
     {url:"https://petstore3.swagger.io/api/v3/openapi.json",name:"Pet Store Example",specOverwrite: {servers:[{ "url": "http://test.com" },{ "url": "http://real.org" }]}}, 
   ],
   dom_id: "#swagger-ui",
   presets: [
     SwaggerUIBundle.presets.apis,
     SwaggerUIStandalonePreset
   ],
   plugins: [
     SwaggerUIBundle.plugins.DownloadUrl
   ],
   // requestSnippetsEnabled: true,
   layout: "StandaloneLayout"
 })

 window.ui = ui

 ui.initOAuth({
   clientId: "your-client-id",
   clientSecret: "your-client-secret-if-required",
   realm: "your-realms",
   appName: "your-app-name",
   scopeSeparator: " ",
   scopes: "openid profile email phone address",
   additionalQueryStringParams: {},
   useBasicAuthenticationWithAccessCodeGrant: false,
   usePkceWithAuthorizationCodeGrant: false
 })
}
?yourQueryStringConfig

Is your feature request related to a problem?

Describe the solution you'd like

  • The idea is to provide additional config to overwrite or add JSON spec attribute after fetching from URL, URLs or local path

Describe alternatives you've considered

Additional context

  • Sometimes the service returns JSON spec is underlying gateway domain. Service doesn't need to know about it's domain. And the server domain could be controlled by DevOps team. In order to do that, instead of passing the domain ENV into the service. We could overwrite the spec attribute after fetch
@daotoan-hd daotoan-hd changed the title Support Json spec overwrite atribute after fetch spec from URL, URLs or local path Support Json spec overwrite attribute after fetch spec from URL, URLs or local path Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant