Skip to content

Instantly share code, notes, and snippets.

@rutsky rutsky/bug1760.yaml
Created Aug 2, 2016

Embed
What would you like to do?
swagger-ui response render bug
swagger: '2.0'
info:
version: 1.0.0
title: Sample for testing display of reponse models
description: |
It seems like display of response models in swagger-ui depends on how they're defined.
Particularly, whether they're referenced or in line. It should not matter.
basePath: /sample
produces:
- application/json
paths:
/test:
get:
summary: Example operation
description: |
All the different reponses should have an associated model ...
The models are defined, but are they displayed?
responses:
200:
description: This model is defined in-line, but since it's a 200, it shows up.
schema:
type: object
properties:
key:
type: string
value:
type: string
400:
description: This model is defined with a reference to a definition object
schema:
$ref: '#/definitions/Error'
403:
$ref: '#/responses/Unauthorized'
418:
description: This model is defined in-line.
schema:
type: object
properties:
tea:
type: string
enum:
- earl grey
- sweet
- red rose
- green
temp:
type: string
enum:
- hot
- iced
500:
$ref: '#/responses/ServerError'
responses:
ServerError:
description: Server failed to process your request.
schema:
type: object
required: ["status", "message"]
properties:
status:
type: string
enum: ["error"]
message:
type: string
Unauthorized:
description: Only authorized users may make this request.
schema:
$ref: '#/definitions/Error'
headers:
WWW-Authenticate:
type: string
definitions:
Error:
required:
- code
- message
properties:
code:
type: integer
format: int32
message:
type: string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.