Skip to content

Commit

Permalink
Pass all tests and linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Giles committed Apr 22, 2020
1 parent 1ada84b commit 63c5550
Show file tree
Hide file tree
Showing 5 changed files with 291 additions and 215 deletions.
12 changes: 9 additions & 3 deletions packages/@aws-cdk/aws-apigateway/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,16 @@ book.addMethod('DELETE');
Optionally, you can import a Swagger/OpenAPI definition, and API Gateway will create resources
and methods from your specification:
```
const api = new apigateway.RestApi(this, 'books-api', {
apiDefinition: apigateway.APIDefinition.fromAsset('path-to-your-swagger-file.json')
});
const api = apigateway.RestApi.fromAPIDefinition(
this,
'books-api',
apigateway.APIDefinition.fromAsset('path-to-your-swagger-file.json')
);
```
[API Gateway Swagger/OpenAPI import limitations](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-known-issues.html) apply when creating a Rest API in this way.

You can either create a Rest API from an imported Swagger/OpenAPI definition or define your
API hierarchy with resources and methods, but _not both_.

## AWS Lambda-backed APIs

Expand Down
14 changes: 7 additions & 7 deletions packages/@aws-cdk/aws-apigateway/lib/apidefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ export class S3APIDefinition extends APIDefinition {
s3Location: {
bucket: this.bucketName,
key: this.key,
version: this.objectVersion
}
version: this.objectVersion,
},
};
}
}
Expand All @@ -136,7 +136,7 @@ export class InlineAPIDefinition extends APIDefinition {

public bind(_scope: cdk.Construct): APIDefinitionConfig {
return {
inlineDefinition: this.definition
inlineDefinition: this.definition,
};
}
}
Expand All @@ -160,7 +160,7 @@ export class AssetAPIDefinition extends APIDefinition {
if (this.asset === undefined) {
this.asset = new s3_assets.Asset(scope, 'APIDefinition', {
path: this.path,
...this.options
...this.options,
});
}

Expand All @@ -171,8 +171,8 @@ export class AssetAPIDefinition extends APIDefinition {
return {
s3Location: {
bucket: this.asset?.s3BucketName,
key: this.asset?.s3ObjectKey
}
key: this.asset?.s3ObjectKey,
},
};
}

Expand Down Expand Up @@ -258,7 +258,7 @@ export class CfnParametersAPIDefinition extends APIDefinition {
s3Location: {
bucket: this._bucketNameParam.valueAsString,
key: this._objectKeyParam.valueAsString,
}
},
};
}

Expand Down

0 comments on commit 63c5550

Please sign in to comment.