Created
May 24, 2017 14:11
-
-
Save sid88in/a40927806a51c5c0509e57292690fc0f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
swagger: '2.0' | |
info: | |
title: API Gateway - Request Validation Demo - rpgreen@amazon.com | |
version: '1.0' | |
schemes: | |
- https | |
produces: | |
- application/json | |
x-amazon-apigateway-request-validators: | |
full: | |
validateRequestBody: true | |
validateRequestParameters: true | |
body-only: | |
validateRequestBody: true | |
validateRequestParameters: false | |
x-amazon-apigateway-request-validator: full | |
paths: | |
/orders: | |
post: | |
x-amazon-apigateway-request-validator: body-only | |
parameters: | |
- in: body | |
name: CreateOrders | |
required: true | |
schema: | |
$ref: '#/definitions/CreateOrders' | |
responses: | |
'200': | |
schema: | |
$ref: '#/definitions/Message' | |
description: validation succeeded | |
'400': | |
schema: | |
$ref: '#/definitions/Message' | |
description: validation failed | |
x-amazon-apigateway-integration: | |
responses: | |
default: | |
statusCode: '200' | |
responseTemplates: | |
application/json: '{"message" : "Orders successfully created"}' | |
requestTemplates: | |
application/json: '{"statusCode": 200}' | |
passthroughBehavior: never | |
type: mock | |
definitions: | |
CreateOrders: | |
title: Create Orders Schema | |
type: array | |
minItems: 1 | |
items: | |
type: object | |
$ref: '#/definitions/Order' | |
Order: | |
type: object | |
title: Schema for a single Order | |
required: | |
- account-id | |
- type | |
- symbol | |
- shares | |
- details | |
properties: | |
account-id: | |
type: string | |
pattern: '[A-Za-z]{6}[0-9]{6}' | |
type: | |
type: string | |
enum: | |
- STOCK | |
- BOND | |
- CASH | |
symbol: | |
type: string | |
minLength: 1 | |
maxLength: 4 | |
shares: | |
type: number | |
minimum: 1 | |
maximum: 1000 | |
details: | |
type: object | |
required: | |
- limit | |
properties: | |
limit: | |
type: number | |
additionalProperties: false | |
Message: | |
type: object | |
properties: | |
message: | |
type: string |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment