Last active
January 3, 2016 12:09
-
-
Save fehguy/8461152 to your computer and use it in GitHub Desktop.
input vs. output models described with subtypes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: 1.0.0 | |
swaggerVersion: "1.2" | |
basePath: "http://localhost:8002/api" | |
resourcePath: /pet | |
produces: | |
- application/json | |
- application/xml | |
- text/plain | |
- text/html | |
apis: | |
- path: /user | |
operations: | |
- method: POST | |
summary: Add a user | |
notes: "" | |
type: OutputUser | |
nickname: addUser | |
parameters: | |
- name: body | |
description: User to add | |
required: true | |
allowMultiple: false | |
type: User | |
paramType: body | |
responseMessages: | |
- code: 400 | |
message: Invalid pet | |
models: | |
User: | |
id: User | |
description: The base user | |
required: | |
- name | |
properties: | |
username: | |
type: string | |
subTypes: | |
- OutputUser | |
OutputUser: | |
id: OutputUser | |
description: A user with internal values | |
required: | |
- id | |
properties: | |
id: | |
type: integer | |
format: int64 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"apiVersion": "1.0.0", | |
"swaggerVersion": "1.2", | |
"basePath": "http://localhost:8002/api", | |
"resourcePath": "/pet", | |
"produces": [ | |
"application/json", | |
"application/xml", | |
"text/plain", | |
"text/html" | |
], | |
"apis": [ | |
{ | |
"path": "/user", | |
"operations": [ | |
{ | |
"method": "POST", | |
"summary": "Add a user", | |
"notes": "", | |
"type": "OutputUser", | |
"nickname": "addUser", | |
"parameters": [ | |
{ | |
"name": "body", | |
"description": "User to add", | |
"required": true, | |
"allowMultiple": false, | |
"type": "User", | |
"paramType": "body" | |
} | |
], | |
"responseMessages": [ | |
{ | |
"code": 400, | |
"message": "Invalid pet" | |
} | |
] | |
} | |
] | |
} | |
], | |
"models": { | |
"User": { | |
"id": "User", | |
"description": "The base user", | |
"required": [ | |
"name" | |
], | |
"properties": { | |
"username": { | |
"type": "string" | |
} | |
}, | |
"subTypes": [ | |
"OutputUser" | |
] | |
}, | |
"OutputUser": { | |
"id": "OutputUser", | |
"description": "A user with internal values", | |
"required": [ | |
"id" | |
], | |
"properties": { | |
"id": { | |
"type": "integer", | |
"format": "int64" | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
OutputUser
contains a service-generatedid
field