-
Notifications
You must be signed in to change notification settings - Fork 18
Description
Describe the bug
When deploying a service with an already existing APIGateway - hence passing the already existing ApiGW ID to the provider - and setting a request validator via a JSON schema, the resulting output seems to have a Resource of AWS::ApiGateway::Model with the RestAPIId set to an empty object (which is a no-go for cloudformation as it is required and of type string). I am not quite sure if this is a documentation or a bug issue nor I could find any place where this was being set by the library so it might not be the right place but the issue is appearing only when adding the request validator.
To Reproduce
Steps to reproduce the behavior:
serverless.yml
provider:
[...]
apiGateway:
restApiId: ${ssm:/your_parameter_apigw_id}
restApiRootResourceId: ${ssm:your_parameter_apigw_root_id}
request:
schemas:
post-test:
name: post-test
description: Request schema test.
contentType: application/json
schema: ${file(schema/request.json)}
[...]
functions:
post_test:
handler: handler.handler
events:
- http:
path: /test
method: post
documentation: ${file(serverless.doc.yaml):documentation.endpoints.post_test}
[...]
request:
schemas:
application/json: post-testschema/request.json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"name": {
"title": "Name",
"type": "string"
}
},
"required": [
"name"
],
"title": "test",
"type": "object"
}
.serverless/cloudformation-template-update-stack.json
[...]
"ApiGatewayTestRequestModel": {
"Type": "AWS::ApiGateway::Model",
"Properties": {
"RestApiId": {},
"Schema": {
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"name": {
"title": "Name",
"type": "string"
}
},
"required": [
"name"
],
"title": "test",
"type": "object"
},
"ContentType": "application/json",
"Name": "post-test",
"Description": "Request schema test."
}
},
[...]Expected behavior
I would expect to have the RestApiId filled as a string with the ssm parameter I added in the serverless.yml specification, instead the CF template is created as an empty object, which goes against the CF specification.
Desktop (please complete the following information):
- Serverless version: 4.17.2
- serverless-openapi-documenter version 0.0.114
Additional context
No additional context