We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Example Swagger/OpenAPI definition:
openapi: "3.0.0" info: version: 1.0.0 title: Title servers: - url: http://localhost:8089 paths: /healthcheck: get: security: [] tags: - healthcheck responses: "200": description: description content: application/json: schema: type: object properties: result: type: string default: ok examples: example1: value: $ref: "./examples/ok.json"
Swagger-UI configuration options: no
docker-compose.yml:
docker-compose.yml
swagger: image: swaggerapi/swagger-ui container_name: swagger-docs volumes: - ./docs/openapi:/srv environment: - SWAGGER_JSON=/srv/api.yaml restart: always ports: - ${SWAGGER_PORT}:8080 networks: - frontend
Steps to reproduce the behavior:
api.yaml
$ref: "./examples/ok.json"
{ "$ref": "./examples/ok.json" }
without content of the file (./examples/ok.json).
./examples/ok.json
I build swagger:v3.37.1 from repo - no problem. When I use official docker image or build from sourcesswagger: v3.38.0 - has problem.
swagger:v3.37.1
swagger: v3.38.0
I expected to see the file content like this:
{ "result": "ok", "$$ref": "examples/examples/ok.json" }
but got this:
The text was updated successfully, but these errors were encountered:
@hkosova could be related to #6628
Sorry, something went wrong.
This change was a bug fix to stop resolving $refs in places where $refs are not actually supported, such as inside value.
value
@dbfun To use the content of an external file as an example value, you must use externalValue.
externalValue
examples: example1: externalValue: "./examples/ok.json"
However, support for externalValue is not available in Swagger UI yet, this is tracked in #5433.
Please also note that relative externalValue URLs are resolved against the servers[].url rather than the OpenAPI file location.
servers[].url
For now, we recommend that you keep the example values in the spec itself:
examples: example1: $ref: '#/components/examples/example1' components: examples: example1: value: result: ok # <--- Example value
No branches or pull requests
Q&A (please complete the following information)
Content & configuration
Example Swagger/OpenAPI definition:
Swagger-UI configuration options: no
docker-compose.yml
:To reproduce...
Steps to reproduce the behavior:
api.yaml
with external examples ($ref: "./examples/ok.json"
)without content of the file (
./examples/ok.json
).I build
swagger:v3.37.1
from repo - no problem. When I use official docker image or build from sourcesswagger: v3.38.0
- has problem.Expected behavior
I expected to see the file content like this:
but got this:
The text was updated successfully, but these errors were encountered: