I'm getting 406 Not Acceptable responses when I'm trying to use the externalValue
property in an example object on the swaggerhub mocked server.
Am I doing something wrong or this feature is not implemented on the swaggerhub mocking server?
paths:
/test:
get:
responses:
"200":
description: OK!
content:
application/json:
schema:
type: string
format: binary
examples:
example:
externalValue: "https://jsonplaceholder.typicode.com/todos/1"
application/pdf:
schema:
type: string
format: binary
examples:
sampleFile:
externalValue: "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
SwaggerHub mock server only supports JSON, XML, and YAML responses. If you request any other media types (e.g. Accept: application/pdf
or Accept: image/png
), a 406 response is returned.
SwaggerHub mock server does NOT support externalValue
for sample responses. The mock ignores those examples and generates sample responses by other means, e.g. based on the response schema
.
From the documentation (emphasis mine):
- Generates JSON, XML and YAML responses based on response schemas and examples.
- Supports
enum
,default
,example
, andexamples
(the first example is returned), except forexternalValue
examples.