Skip to content

Commit 2addda2

Browse files
author
Ron
authored
Merge branch 'OpenAPI.next' into objects-begone
2 parents 2b61473 + b2b1ef6 commit 2addda2

File tree

6 files changed

+1119
-180
lines changed

6 files changed

+1119
-180
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2016 The Linux Foundation
1+
Copyright 2017 The Linux Foundation
22

33
Licensed under the Apache License, Version 2.0 (the "License");
44
you may not use this file except in compliance with the License.

examples/v3.0/api-with-examples.yaml

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
openapi: "3.0.0"
2+
info:
3+
title: Simple API overview
4+
version: v2
5+
paths:
6+
/:
7+
get:
8+
operationId: listVersionsv2
9+
summary: List API versions
10+
responses:
11+
200:
12+
description: |-
13+
200 response
14+
content:
15+
application/json:
16+
examples:
17+
- {
18+
"versions": [
19+
{
20+
"status": "CURRENT",
21+
"updated": "2011-01-21T11:33:21Z",
22+
"id": "v2.0",
23+
"links": [
24+
{
25+
"href": "http://127.0.0.1:8774/v2/",
26+
"rel": "self"
27+
}
28+
]
29+
},
30+
{
31+
"status": "EXPERIMENTAL",
32+
"updated": "2013-07-23T11:33:21Z",
33+
"id": "v3.0",
34+
"links": [
35+
{
36+
"href": "http://127.0.0.1:8774/v3/",
37+
"rel": "self"
38+
}
39+
]
40+
}
41+
]
42+
}
43+
300:
44+
description: |-
45+
300 response
46+
content:
47+
application/json:
48+
examples:
49+
- |
50+
{
51+
"versions": [
52+
{
53+
"status": "CURRENT",
54+
"updated": "2011-01-21T11:33:21Z",
55+
"id": "v2.0",
56+
"links": [
57+
{
58+
"href": "http://127.0.0.1:8774/v2/",
59+
"rel": "self"
60+
}
61+
]
62+
},
63+
{
64+
"status": "EXPERIMENTAL",
65+
"updated": "2013-07-23T11:33:21Z",
66+
"id": "v3.0",
67+
"links": [
68+
{
69+
"href": "http://127.0.0.1:8774/v3/",
70+
"rel": "self"
71+
}
72+
]
73+
}
74+
]
75+
}
76+
/v2:
77+
get:
78+
operationId: getVersionDetailsv2
79+
summary: Show API version details
80+
responses:
81+
200:
82+
description: |-
83+
200 response
84+
content:
85+
application/json:
86+
examples:
87+
- {
88+
"version": {
89+
"status": "CURRENT",
90+
"updated": "2011-01-21T11:33:21Z",
91+
"media-types": [
92+
{
93+
"base": "application/xml",
94+
"type": "application/vnd.openstack.compute+xml;version=2"
95+
},
96+
{
97+
"base": "application/json",
98+
"type": "application/vnd.openstack.compute+json;version=2"
99+
}
100+
],
101+
"id": "v2.0",
102+
"links": [
103+
{
104+
"href": "http://127.0.0.1:8774/v2/",
105+
"rel": "self"
106+
},
107+
{
108+
"href": "http://docs.openstack.org/api/openstack-compute/2/os-compute-devguide-2.pdf",
109+
"type": "application/pdf",
110+
"rel": "describedby"
111+
},
112+
{
113+
"href": "http://docs.openstack.org/api/openstack-compute/2/wadl/os-compute-2.wadl",
114+
"type": "application/vnd.sun.wadl+xml",
115+
"rel": "describedby"
116+
},
117+
{
118+
"href": "http://docs.openstack.org/api/openstack-compute/2/wadl/os-compute-2.wadl",
119+
"type": "application/vnd.sun.wadl+xml",
120+
"rel": "describedby"
121+
}
122+
]
123+
}
124+
}
125+
203:
126+
description: |-
127+
203 response
128+
content:
129+
application/json:
130+
examples:
131+
- {
132+
"version": {
133+
"status": "CURRENT",
134+
"updated": "2011-01-21T11:33:21Z",
135+
"media-types": [
136+
{
137+
"base": "application/xml",
138+
"type": "application/vnd.openstack.compute+xml;version=2"
139+
},
140+
{
141+
"base": "application/json",
142+
"type": "application/vnd.openstack.compute+json;version=2"
143+
}
144+
],
145+
"id": "v2.0",
146+
"links": [
147+
{
148+
"href": "http://23.253.228.211:8774/v2/",
149+
"rel": "self"
150+
},
151+
{
152+
"href": "http://docs.openstack.org/api/openstack-compute/2/os-compute-devguide-2.pdf",
153+
"type": "application/pdf",
154+
"rel": "describedby"
155+
},
156+
{
157+
"href": "http://docs.openstack.org/api/openstack-compute/2/wadl/os-compute-2.wadl",
158+
"type": "application/vnd.sun.wadl+xml",
159+
"rel": "describedby"
160+
}
161+
]
162+
}
163+
}

examples/v3.0/petstore-expanded.yaml

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
openapi: "3.0.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://swagger.io/terms/
7+
contact:
8+
name: Swagger 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+
servers:
15+
- url: http://petstore.swagger.io/api
16+
paths:
17+
/pets:
18+
get:
19+
description: |
20+
Returns all pets from the system that the user has access to
21+
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.
22+
23+
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.
24+
operationId: findPets
25+
parameters:
26+
- name: tags
27+
in: query
28+
description: tags to filter by
29+
required: false
30+
style: simple
31+
schema:
32+
type: array
33+
items:
34+
type: string
35+
- name: limit
36+
in: query
37+
description: maximum number of results to return
38+
required: false
39+
schema:
40+
type: integer
41+
format: int32
42+
responses:
43+
200:
44+
description: pet response
45+
content:
46+
application/json:
47+
schema:
48+
type: array
49+
items:
50+
$ref: '#/components/schemas/Pet'
51+
default:
52+
description: unexpected error
53+
content:
54+
application/json:
55+
schema:
56+
$ref: '#/components/schemas/Error'
57+
post:
58+
description: Creates a new pet in the store. Duplicates are allowed
59+
operationId: addPet
60+
requestBody:
61+
description: Pet to add to the store
62+
required: true
63+
content:
64+
application/json:
65+
schema:
66+
$ref: '#/components/schemas/NewPet'
67+
responses:
68+
200:
69+
description: pet response
70+
content:
71+
application/json:
72+
schema:
73+
$ref: '#/components/schemas/Pet'
74+
default:
75+
description: unexpected error
76+
content:
77+
application/json:
78+
schema:
79+
$ref: '#/components/schemas/Error'
80+
/pets/{id}:
81+
get:
82+
description: Returns a user based on a single ID, if the user does not have access to the pet
83+
operationId: find pet by id
84+
parameters:
85+
- name: id
86+
in: path
87+
description: ID of pet to fetch
88+
required: true
89+
schema:
90+
type: integer
91+
format: int64
92+
responses:
93+
200:
94+
description: pet response
95+
content:
96+
application/json:
97+
schema:
98+
$ref: '#/components/schemas/Pet'
99+
default:
100+
description: unexpected error
101+
content:
102+
application/json:
103+
schema:
104+
$ref: '#/components/schemas/Error'
105+
delete:
106+
description: deletes a single pet based on the ID supplied
107+
operationId: deletePet
108+
parameters:
109+
- name: id
110+
in: path
111+
description: ID of pet to delete
112+
required: true
113+
schema:
114+
type: integer
115+
format: int64
116+
responses:
117+
204:
118+
description: pet deleted
119+
default:
120+
description: unexpected error
121+
content:
122+
application/json:
123+
schema:
124+
$ref: '#/components/schemas/Error'
125+
components:
126+
schemas:
127+
Pet:
128+
allOf:
129+
- $ref: '#/components/schemas/NewPet'
130+
- required:
131+
- id
132+
properties:
133+
id:
134+
type: integer
135+
format: int64
136+
137+
NewPet:
138+
required:
139+
- name
140+
properties:
141+
name:
142+
type: string
143+
tag:
144+
type: string
145+
146+
Error:
147+
required:
148+
- code
149+
- message
150+
properties:
151+
code:
152+
type: integer
153+
format: int32
154+
message:
155+
type: string

0 commit comments

Comments
 (0)