Skip to content

Instantly share code, notes, and snippets.

@rutsky
Created August 2, 2016 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rutsky/4f4cda9f6039ae604ae9c31ccc2337e4 to your computer and use it in GitHub Desktop.
Save rutsky/4f4cda9f6039ae604ae9c31ccc2337e4 to your computer and use it in GitHub Desktop.
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