How can response status code make sense for multiple media types for error status codes
If we follow the OAS3 spec for Response herewe can see that each response status code can have multiple media types and each media type inturn has a schema particular to it. For example below, we can see 200 has a binary stream response but 400 has 2 media-types:application/json, application/xml. So is client expected to request accept-type header with all the media-types mentioned below. How can we have specific media-type for 400 response code, or basically how we can convey to the REST Service to respond with media type as application/xml when its a 400 bad request if 200 is returning a binary stream. Does this OAS3 response multiple media-type make sense for Client/Server Errors. If yes then whats the accept-type set for expecting, say "application/xml" for 400 bad request '200': description: Document content from the Archive content: application/octet-stream: schema: type: string format: binary '400': description: One or more input parameters are invalid content: application/json: schema: type: "object" properties: errors: $ref: "#/components/schemas/Error_400" application/xml: schema: type: "object" properties: errors: $ref: "#/components/schemas/Error_400" '403': description: Consumer doesn't have access to the document content: application/xml: schema: type: "object" properties: errors: $ref: "#/components/schemas/Error_403"How to have a custom status code in response
responses: '777': description: My Custom content: application/json: schema: type: string If I have "777" like fieldName for the status code in OAS3.0 spec YAML, then the editor.swagger.io throws an error as "should only have three-digit status codes, `default`, and vendor extensions (`x-*`) as properties" If I have the same status code in Swagger2.0 spec YAML, as below, then it doesn't throw an error. responses: '777': description: custom schema: type: string PS: I checked the indentation, it seems correct because if I change "777" in OAS3.0 spec YAML to standard status code like "400", "200" then it doesn't throw an error.Solved6.2KViews0likes2CommentssecurityScheme error
I'm trying to configure bearer authentication in an OpenAPI object using YAML in a Spring Boot app. Here is my YAML: components: securitySchemes: bearerAuth: type: http scheme: bearer security: - bearerAuth: [] But on application start-up, I get the following: Failed to bind properties under 'openapi.config.components.securityschemes.bearerauth' to io.swagger.v3.oas.models.security.SecurityScheme: Reason: Configuration property name '$ref' is not valid Action: Update your application's configuration Any idea what my error is? Adding a name property to the above does not solve it.