-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit and integration tests, refine documentation
- Loading branch information
Benjamin Giles
committed
Apr 15, 2020
1 parent
a84c366
commit 0dcd6c5
Showing
6 changed files
with
223 additions
and
136 deletions.
There are no files selected for viewing
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
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
156 changes: 156 additions & 0 deletions
156
packages/@aws-cdk/aws-apigateway/test/integ.restapi.fromdefinition.expected.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
{ | ||
"Resources": { | ||
"myapi4C7BF186": { | ||
"Type": "AWS::ApiGateway::RestApi", | ||
"Properties": { | ||
"BodyS3Location": { | ||
"Bucket": { | ||
"Ref": "AssetParametersb4e546901387aeeb588eabec043d35a7fdbe4d304185ae7ab763bb3ae4e61d58S3BucketC3882222" | ||
}, | ||
"Key": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
{ | ||
"Fn::Select": [ | ||
0, | ||
{ | ||
"Fn::Split": [ | ||
"||", | ||
{ | ||
"Ref": "AssetParametersb4e546901387aeeb588eabec043d35a7fdbe4d304185ae7ab763bb3ae4e61d58S3VersionKey1FFB68C8" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"Fn::Select": [ | ||
1, | ||
{ | ||
"Fn::Split": [ | ||
"||", | ||
{ | ||
"Ref": "AssetParametersb4e546901387aeeb588eabec043d35a7fdbe4d304185ae7ab763bb3ae4e61d58S3VersionKey1FFB68C8" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
] | ||
} | ||
}, | ||
"Name": "my-api" | ||
} | ||
}, | ||
"myapiDeployment92F2CB49": { | ||
"Type": "AWS::ApiGateway::Deployment", | ||
"Properties": { | ||
"RestApiId": { | ||
"Ref": "myapi4C7BF186" | ||
}, | ||
"Description": "Automatically created by the RestApi construct" | ||
} | ||
}, | ||
"myapiDeploymentStageprod298F01AF": { | ||
"Type": "AWS::ApiGateway::Stage", | ||
"Properties": { | ||
"RestApiId": { | ||
"Ref": "myapi4C7BF186" | ||
}, | ||
"DeploymentId": { | ||
"Ref": "myapiDeployment92F2CB49" | ||
}, | ||
"StageName": "prod" | ||
} | ||
}, | ||
"myapiCloudWatchRole095452E5": { | ||
"Type": "AWS::IAM::Role", | ||
"Properties": { | ||
"AssumeRolePolicyDocument": { | ||
"Statement": [ | ||
{ | ||
"Action": "sts:AssumeRole", | ||
"Effect": "Allow", | ||
"Principal": { | ||
"Service": "apigateway.amazonaws.com" | ||
} | ||
} | ||
], | ||
"Version": "2012-10-17" | ||
}, | ||
"ManagedPolicyArns": [ | ||
{ | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"arn:", | ||
{ | ||
"Ref": "AWS::Partition" | ||
}, | ||
":iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs" | ||
] | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
"myapiAccountEC421A0A": { | ||
"Type": "AWS::ApiGateway::Account", | ||
"Properties": { | ||
"CloudWatchRoleArn": { | ||
"Fn::GetAtt": [ | ||
"myapiCloudWatchRole095452E5", | ||
"Arn" | ||
] | ||
} | ||
}, | ||
"DependsOn": [ | ||
"myapi4C7BF186" | ||
] | ||
} | ||
}, | ||
"Outputs": { | ||
"myapiEndpoint3628AFE3": { | ||
"Value": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"https://", | ||
{ | ||
"Ref": "myapi4C7BF186" | ||
}, | ||
".execute-api.", | ||
{ | ||
"Ref": "AWS::Region" | ||
}, | ||
".", | ||
{ | ||
"Ref": "AWS::URLSuffix" | ||
}, | ||
"/", | ||
{ | ||
"Ref": "myapiDeploymentStageprod298F01AF" | ||
}, | ||
"/" | ||
] | ||
] | ||
} | ||
} | ||
}, | ||
"Parameters": { | ||
"AssetParametersb4e546901387aeeb588eabec043d35a7fdbe4d304185ae7ab763bb3ae4e61d58S3BucketC3882222": { | ||
"Type": "String", | ||
"Description": "S3 bucket for asset \"b4e546901387aeeb588eabec043d35a7fdbe4d304185ae7ab763bb3ae4e61d58\"" | ||
}, | ||
"AssetParametersb4e546901387aeeb588eabec043d35a7fdbe4d304185ae7ab763bb3ae4e61d58S3VersionKey1FFB68C8": { | ||
"Type": "String", | ||
"Description": "S3 key for asset version \"b4e546901387aeeb588eabec043d35a7fdbe4d304185ae7ab763bb3ae4e61d58\"" | ||
}, | ||
"AssetParametersb4e546901387aeeb588eabec043d35a7fdbe4d304185ae7ab763bb3ae4e61d58ArtifactHash1A35D17D": { | ||
"Type": "String", | ||
"Description": "Artifact hash for asset \"b4e546901387aeeb588eabec043d35a7fdbe4d304185ae7ab763bb3ae4e61d58\"" | ||
} | ||
} | ||
} |
119 changes: 19 additions & 100 deletions
119
packages/@aws-cdk/aws-apigateway/test/sample-definition.yaml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,111 +1,30 @@ | ||
openapi: "3.0.0" | ||
openapi: "3.0.2" | ||
info: | ||
version: 1.0.0 | ||
title: Swagger Petstore | ||
license: | ||
name: MIT | ||
servers: | ||
- url: http://petstore.swagger.io/v1 | ||
title: Test API for CDK | ||
paths: | ||
/pets: | ||
/testing: | ||
get: | ||
summary: List all pets | ||
operationId: listPets | ||
tags: | ||
- pets | ||
parameters: | ||
- name: limit | ||
in: query | ||
description: How many items to return at one time (max 100) | ||
required: false | ||
schema: | ||
type: integer | ||
format: int32 | ||
summary: Test Method | ||
operationId: testMethod | ||
responses: | ||
'200': | ||
"200": | ||
description: A paged array of pets | ||
headers: | ||
x-next: | ||
description: A link to the next page of responses | ||
schema: | ||
type: string | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "#/components/schemas/Pets" | ||
default: | ||
description: unexpected error | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "#/components/schemas/Error" | ||
post: | ||
summary: Create a pet | ||
operationId: createPets | ||
tags: | ||
- pets | ||
responses: | ||
'201': | ||
description: Null response | ||
default: | ||
description: unexpected error | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "#/components/schemas/Error" | ||
/pets/{petId}: | ||
get: | ||
summary: Info for a specific pet | ||
operationId: showPetById | ||
tags: | ||
- pets | ||
parameters: | ||
- name: petId | ||
in: path | ||
required: true | ||
description: The id of the pet to retrieve | ||
schema: | ||
type: string | ||
responses: | ||
'200': | ||
description: Expected response to a valid request | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "#/components/schemas/Pet" | ||
default: | ||
description: unexpected error | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "#/components/schemas/Error" | ||
$ref: "#/components/schemas/Empty" | ||
x-amazon-apigateway-integration: | ||
responses: | ||
default: | ||
statusCode: "200" | ||
requestTemplates: | ||
application/json: "{\"statusCode\": 200}" | ||
passthroughBehavior: when_no_match | ||
type: mock | ||
|
||
components: | ||
schemas: | ||
Pet: | ||
type: object | ||
required: | ||
- id | ||
- name | ||
properties: | ||
id: | ||
type: integer | ||
format: int64 | ||
name: | ||
type: string | ||
tag: | ||
type: string | ||
Pets: | ||
type: array | ||
items: | ||
$ref: "#/components/schemas/Pet" | ||
Error: | ||
type: object | ||
required: | ||
- code | ||
- message | ||
properties: | ||
code: | ||
type: integer | ||
format: int32 | ||
message: | ||
type: string | ||
Empty: | ||
title: Empty Schema | ||
type: object |
Oops, something went wrong.