/
openapi.yaml
100 lines (96 loc) · 2.76 KB
/
openapi.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
openapi: 3.0.0
info:
title: Newsletter API
description: |
Used to manage contacts for newsletter
version: 1.0.0
x-amazon-apigateway-request-validators:
Validate All:
validateRequestParameters: true
validateRequestBody: true
x-amazon-apigateway-gateway-responses:
BAD_REQUEST_BODY:
statusCode: 400
responseTemplates:
application/json: '{ "message": "$context.error.validationErrorString" }'
responseParameters:
gatewayresponse.header.Access-Control-Allow-Origin:
Fn::Sub: "'${CorsDomain}'"
paths:
/subscribers:
post:
summary: Add a new subscriber
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Subscriber'
responses:
201:
$ref: '#/components/responses/Created'
400:
$ref: '#/components/responses/BadRequest'
500:
$ref: '#/components/responses/UnknownError'
x-amazon-apigateway-request-validator: Validate All
x-amazon-apigateway-integration:
uri:
Fn::Sub: arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${AddSubscriberFunction.Arn}/invocations
httpMethod: POST
type: aws_proxy
components:
schemas:
Subscriber:
description: New subscriber details
type: object
required:
- email
properties:
email:
type: string
description: Email address
firstName:
type: string
lastName:
type: string
responses:
Created:
description: Successfully added into the system
content:
application/json:
schema:
type: object
required:
- message
properties:
message:
type: string
description: Message resulting from a creation
example: Contact created
BadRequest:
description: Unable to process request. Likely due to improperly formatted request.
content:
application/json:
schema:
type: object
required:
- message
properties:
message:
type: string
description: Message detailing what went wrong
example: The 'name' field is required and is missing.
UnknownError:
description: An unexpected error occurred on the server.
content:
application/json:
schema:
type: object
required:
- message
properties:
message:
type: string
description: Unknown error message
example: An unexpected error occurred.