Coder Social home page Coder Social logo

Comments (5)

glowcloud avatar glowcloud commented on June 12, 2024

It looks like this line

 const configURL = queryOptions.config ?? mergedOptions.configUrl 

was added in 8130168 as:

let configUrl = queryConfig.config || constructorConfig.configUrl

It actually included this logic that was there before, added in f22a628:

let config = parseSeach()
let configUrl = config.config

For the mentions of configUrl and config in the docs, here's the commit where they were added: 8e80ca9
And the relevant lines about config:

There are three options of passing config:
- add a query parameter `config` with URL to a server where the configs are hosted. For ex. http://petstore.swagger.io/?configs=http://localhost:3001/config.yaml
- add a config `configUrl` with URL to SwaggerUIBundle
- change default configs in `swagger-config.yaml` *Note: after changing, the project must be re-built*

These options can be used altogether, the order of inheritance is following (from the lowest priority to the highest):
`swagger-config.yaml` -> config passed to `SwaggerUIBundle` -> config fetched from `configUrl` passed to `SwaggerUIBundle` -> config fetched from URL passed as a query parameter `config`

So it looks like this difference might have been done so that the query config takes precedence as we didn't merge it into the configs before:

const constructorConfig = deepExtend({}, defaults, opts)

we just got query options separately later:
let queryConfig = parseSeach()

Currently, queryOptions and configUrl are only used in https://github.com/swagger-api/swagger-ui/blob/master/src/core/index.js. I also tried search for config but nothing looks like it's actually this parameter.

In my opinion, we can remove the queryOptions.config - we don't have this option in our documentation and the configUrl value should take precedence in mergedOptions at this point.

from swagger-ui.

char0n avatar char0n commented on June 12, 2024

These options can be used altogether, the order of inheritance is following (from the lowest priority to the highest):
swagger-config.yaml -> config passed to SwaggerUIBundle -> config fetched from configUrl passed to SwaggerUIBundle -> config fetched from URL passed as a query parameter config

So this at least does confirm my assumptions in #9818

from swagger-ui.

char0n avatar char0n commented on June 12, 2024
  • change default configs in swagger-config.yaml Note: after changing, the project must be re-built

This confirms my stipulation that it's a compile time thing

from swagger-ui.

char0n avatar char0n commented on June 12, 2024

There are three options of passing config:

Notice the config vs configs discrepancy.

Currently this works:

http://petstore.swagger.io/?config=http://localhost:3001/config.yaml
http://petstore.swagger.io/?configUrl=http://localhost:3001/config.yaml

This doesn't work at all:
http://petstore.swagger.io/?configs=http://localhost:3001/config.yaml

from swagger-ui.

glowcloud avatar glowcloud commented on June 12, 2024

Addressed in #9840

from swagger-ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.