Skip to content

Commit 1feb273

Browse files
committed
Samples for OAI#417: Separated files, yaml only for now
1 parent 966b067 commit 1feb273

File tree

4 files changed

+147
-0
lines changed

4 files changed

+147
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Error:
2+
required:
3+
- code
4+
- message
5+
properties:
6+
code:
7+
type: integer
8+
format: int32
9+
message:
10+
type: string
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Pet:
2+
required:
3+
- id
4+
- name
5+
properties:
6+
id:
7+
type: integer
8+
format: int64
9+
name:
10+
type: string
11+
tag:
12+
type: string
13+
NewPet:
14+
allOf:
15+
- $ref: '#/definitions/Pet'
16+
- required:
17+
- name
18+
properties:
19+
id:
20+
type: integer
21+
format: int64
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
tagsParam:
2+
name: tags
3+
in: query
4+
description: tags to filter by
5+
required: false
6+
type: array
7+
collectionFormat: csv
8+
items:
9+
type: string
10+
limitsParam:
11+
name: limit
12+
in: query
13+
description: maximum number of results to return
14+
required: false
15+
type: integer
16+
format: int32
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
swagger: "2.0"
2+
info:
3+
version: 1.0.0
4+
title: Swagger Petstore
5+
description: A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification
6+
termsOfService: http://helloreverb.com/terms/
7+
contact:
8+
name: Wordnik API Team
9+
10+
url: http://madskristensen.net
11+
license:
12+
name: MIT
13+
url: http://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
14+
host: petstore.swagger.wordnik.com
15+
basePath: /api
16+
schemes:
17+
- http
18+
consumes:
19+
- application/json
20+
produces:
21+
- application/json
22+
paths:
23+
/pets:
24+
get:
25+
description: |
26+
Returns all pets from the system that the user has access to
27+
Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.
28+
29+
Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.
30+
operationId: findPets
31+
parameters:
32+
- $ref: 'parameters.yaml#/tagsParam'
33+
- $ref: 'parameters.yaml#/limitsParam'
34+
responses:
35+
200:
36+
description: pet response
37+
schema:
38+
type: array
39+
items:
40+
$ref: 'definitions.yaml#/Pet'
41+
default:
42+
description: unexpected error
43+
schema:
44+
$ref: '../petstore-separate-common.yaml#/Error'
45+
post:
46+
description: Creates a new pet in the store. Duplicates are allowed
47+
operationId: addPet
48+
parameters:
49+
- name: pet
50+
in: body
51+
description: Pet to add to the store
52+
required: true
53+
schema:
54+
$ref: 'definitions.yaml#/NewPet'
55+
responses:
56+
200:
57+
description: pet response
58+
schema:
59+
$ref: 'definitions.yaml#/Pet'
60+
default:
61+
description: unexpected error
62+
schema:
63+
$ref: '../petstore-separate-common.yaml#/Error'
64+
/pets/{id}:
65+
get:
66+
description: Returns a user based on a single ID, if the user does not have access to the pet
67+
operationId: find pet by id
68+
parameters:
69+
- name: id
70+
in: path
71+
description: ID of pet to fetch
72+
required: true
73+
type: integer
74+
format: int64
75+
responses:
76+
200:
77+
description: pet response
78+
schema:
79+
$ref: 'definitions.yaml#/Pet'
80+
default:
81+
description: unexpected error
82+
schema:
83+
$ref: '../petstore-separate-common.yaml#/Error'
84+
delete:
85+
description: deletes a single pet based on the ID supplied
86+
operationId: deletePet
87+
parameters:
88+
- name: id
89+
in: path
90+
description: ID of pet to delete
91+
required: true
92+
type: integer
93+
format: int64
94+
responses:
95+
204:
96+
description: pet deleted
97+
default:
98+
description: unexpected error
99+
schema:
100+
$ref: '../petstore-separate-common.yaml#/Error'

0 commit comments

Comments
 (0)