forked from marcobuss/sam-swagger-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
swagger.yaml
172 lines (172 loc) · 4.94 KB
/
swagger.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
swagger: '2.0'
info:
version: '1.0'
title: "aws-swagger-example"
description: Polls is a simple API allowing consumers to view polls and vote in them.
license:
name: MIT
url: https://github.com/apiaryio/polls-api/blob/master/LICENSE
host: polls.apiblueprint.org
basePath: /
schemes:
- http
consumes:
- application/json
produces:
- application/json
paths:
/questions:
x-summary: Questions Collection
get:
x-amazon-apigateway-integration:
uri:
Fn::Sub: "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${GetLambdaFunction.Arn}/invocations"
passthroughBehavior: "when_no_match"
httpMethod: "POST"
type: "aws_proxy"
responses: {}
summary: List All Questions
parameters:
- name: "Access-Control-Allow-Origin"
in: "header"
required: false
type: "string"
responses:
200:
description: Successful Response
schema:
type: array
items:
$ref: '#/definitions/Question'
examples:
application/json:
- question: Favourite programming language?
published_at: '2015-08-05T08:40:51.620Z'
choices:
- choice: Swift
votes: 2048
- choice: Python
votes: 1024
- choice: Objective-C
votes: 512
- choice: Ruby
votes: 256
- choice: C++
votes: 20
post:
description: >-
You may create your own question using this action. It takes a JSON
object containing a question and a collection of answers in the
form of choices.
x-amazon-apigateway-integration:
uri:
Fn::Sub: "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${PostLambdaFunction.Arn}/invocations"
passthroughBehavior: "when_no_match"
httpMethod: "POST"
type: "aws_proxy"
responses: {}
summary: Create a New Question
parameters:
- name: body
in: body
required: true
schema:
$ref: '#/definitions/QuestionRequest'
- name: "Access-Control-Allow-Origin"
in: "header"
required: false
type: "string"
responses:
201:
description: ''
schema:
$ref: '#/definitions/Question'
examples:
application/json:
question: Favourite programming language?
published_at: '2015-08-05T08:40:51.620Z'
choices:
- choice: Swift
votes: 0
- choice: Python
votes: 0
- choice: Objective-C
votes: 0
- choice: Ruby
votes: 0
options:
consumes:
- "application/json"
produces:
- "application/json"
responses:
200:
description: "200 response"
headers:
Access-Control-Allow-Origin:
type: "string"
Access-Control-Allow-Methods:
type: "string"
Access-Control-Allow-Credentials:
type: "string"
Access-Control-Allow-Headers:
type: "string"
x-amazon-apigateway-integration:
responses:
default:
statusCode: "200"
responseParameters:
method.response.header.Access-Control-Allow-Credentials: "'false'"
method.response.header.Access-Control-Allow-Methods: "'OPTIONS,GET,POST'"
method.response.header.Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,X-Amz-User-Agent'"
method.response.header.Access-Control-Allow-Origin: "'*'"
passthroughBehavior: "when_no_match"
requestTemplates:
application/json: "{statusCode:200}"
type: "mock"
definitions:
Question:
title: Question
type: object
properties:
question:
type: string
published_at:
type: string
choices:
type: array
items:
$ref: '#/definitions/Choice'
required:
- question
- published_at
- choices
Choice:
title: Choice
type: object
properties:
votes:
type: integer
format: int32
choice:
type: string
required:
- votes
- choice
QuestionRequest:
title: Question Request
type: object
properties:
question:
type: string
choices:
type: array
items:
type: string
required:
- question
- choices
# Don´t use examples in definitions ==> results in deployment error.
# example:
# question: 'Favourite programming language?'
# choices: ['Swift', 'Python', 'Objective-C', 'Ruby']