-
Notifications
You must be signed in to change notification settings - Fork 0
/
swagger.yaml
116 lines (116 loc) · 4.47 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
swagger: "2.0"
info:
description: "This is a sample Petstore rest API to demonstrate integration between Swagger (a.k.a. OpenAPI) and AWS API Gateway."
version: "1.0.0"
title: "Pet Store Service"
host: "petstore.com"
basePath: "/v1"
schemes:
- "https"
paths:
/pet:
post:
tags:
- "pet"
summary: "Add a new pet to the store"
description: ""
operationId: "addPet"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "body"
description: "Pet object that needs to be added to the store"
required: true
schema:
$ref: "#/definitions/Pet"
responses:
200:
description: "Success"
400:
description: "Bad Request"
401:
description: "Unauthorized"
500:
description: "Internal Server Error"
# For AWS Integration
x-amazon-apigateway-request-validators:
basic:
validateRequestParameters: true
x-amazon-apigateway-integration:
type: "aws"
httpMethod: "POST"
# Replace AWS_REGION and ACCOUNT_ID in uri
uri: "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:AWS_REGION:ACCOUNT_ID:function:PostPetFunction/invocations"
responses:
default:
statusCode: 200
requestTemplates:
application/json: "{\r\n \"method\": \"$context.httpMethod\",\r\n \"body\" : \"$input.body\",\r\n \"headers\": {\r\n #foreach($param in $input.params().header.keySet())\r\n \"$param\": \"$util.escapeJavaScript($input.params().header.get($param))\" #if($foreach.hasNext),#end\r\n\r\n #end\r\n },\r\n \"queryParams\": {\r\n #foreach($param in $input.params().querystring.keySet())\r\n \"$param\": \"$util.escapeJavaScript($input.params().querystring.get($param))\" #if($foreach.hasNext),#end\r\n\r\n #end\r\n },\r\n \"pathParams\": {\r\n #foreach($param in $input.params().path.keySet())\r\n \"$param\": \"$util.escapeJavaScript($input.params().path.get($param))\" #if($foreach.hasNext),#end\r\n\r\n #end\r\n } \r\n}"
/pet/{petId}:
get:
tags:
- "pet"
summary: "Find pet by ID"
description: "Returns a single pet"
operationId: "getPetById"
produces:
- "application/json"
parameters:
- name: "petId"
in: "path"
description: "ID of pet to return"
required: true
type: "integer"
format: "int64"
responses:
200:
description: "Success"
schema:
$ref: "#/definitions/Pet"
400:
description: "Bad Request"
401:
description: "Unauthorized"
404:
description: "Not Found"
500:
description: "Internal Server Error"
# For AWS Integration
x-amazon-apigateway-request-validators:
basic:
validateRequestParameters: true
x-amazon-apigateway-integration:
type: "aws"
httpMethod: "POST"
# Replace AWS_REGION and ACCOUNT_ID in uri
uri: "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:AWS_REGION:ACCOUNT_ID:function:GetPetFunction/invocations"
responses:
default:
statusCode: 200
requestTemplates:
application/json: "{\r\n \"method\": \"$context.httpMethod\",\r\n \"body\" : \"$input.body\",\r\n \"headers\": {\r\n #foreach($param in $input.params().header.keySet())\r\n \"$param\": \"$util.escapeJavaScript($input.params().header.get($param))\" #if($foreach.hasNext),#end\r\n\r\n #end\r\n },\r\n \"queryParams\": {\r\n #foreach($param in $input.params().querystring.keySet())\r\n \"$param\": \"$util.escapeJavaScript($input.params().querystring.get($param))\" #if($foreach.hasNext),#end\r\n\r\n #end\r\n },\r\n \"pathParams\": {\r\n #foreach($param in $input.params().path.keySet())\r\n \"$param\": \"$util.escapeJavaScript($input.params().path.get($param))\" #if($foreach.hasNext),#end\r\n\r\n #end\r\n } \r\n}"
definitions:
Pet:
type: "object"
properties:
id:
type: "integer"
format: "int64"
name:
type: "string"
type:
type: "string"
sub-type:
type: "string"
photoUrl:
type: "string"
status:
type: "string"
description: "Pet status in the store"
enum:
- "available"
- "pending"
- "sold"