You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 23, 2021. It is now read-only.
service: secretframeworkVersion: ">=1.50.0 <2.0.0"plugins:
- serverless-reqvalidator-plugin
- serverless-aws-documentationcustom:
documentation:
api:
info:
title: Secretdescription: | **Secret** description with *[Common Mark](https://commonmark.org/help/)* It can be used in other descriptions too.version: 1.0.1-dev5 # change it to unique values so that documentation is upgradedtags:
- name: productsdescription: Product-related APImodels:
- name: ProductListResponsecontentType: application/jsonschema:
type: objectrequired: [products]additionalProperties: falseproperties:
products:
$ref: '{{model: ProductFromList}}'
- name: ProductFromListcontentType: application/jsonschema:
title: The Product general informationtype: objectrequired:
- id
- name
- image_name
- image_url
- disabledadditionalProperties: false# example:# id: 1234567890# name: Super Product 001 Small Black# image_name: my_image.png# image_url: presigned_url_in_png_format# disabled: falseproperties:
id:
type: integerformat: int64# example: '3333333333'name:
type: string# example: Super Product 002 Bluedisabled:
type: boolean# example: trueimage_name:
type: stringpattern: '^[\\w-]+\\.png$'# example: my_image.pngimage_url:
allOf:
- $ref: '{{model: Uri}}'# - example: https://mega-bucket.s3.amazonaws.com/1111111/13146541156462.png?AWSAccessKeyId=ASDFASDF&Signature=f3j4l5%aFsASDdff&x-amz-security-token=XcMpI6tJVsudqbT&-Expires=1594209643
- name: UricontentType: application/jsonschema:
type: stringpattern: ^([a-z][a-z0-9+.-]*):(?:\\\/\\\/((?:(?=((?:[a-z0-9-._~!$&\'()*+,;=:]|%[0-9A-F]{2})*))(\\3)@)?(?=(\\[[0-9A-F:.]{2,}\\]|(?:[a-z0-9-._~!$&\'()*+,;=]|%[0-9A-F]{2})*))\\5(?::(?=(\\d*))\\6)?)(\\\/(?=((?:[a-z0-9-._~!$&\'()*+,;=:@\\\/]|%[0-9A-F]{2})*))\\8)?|(\\\/?(?!\\\/)(?=((?:[a-z0-9-._~!$&\'()*+,;=:@\\\/]|%[0-9A-F]{2})*))\\10)?)(?:\\?(?=((?:[a-z0-9-._~!$&\'()*+,;=:@\\\/?]|%[0-9A-F]{2})*))\\11)?(?:#(?=((?:[a-z0-9-._~!$&\'()*+,;=:@\\\/?]|%[0-9A-F]{2})*))\\12)?$
- name: CommonGeneralErrorcontentType: application/jsonschema:
type: objectrequired:
- messageadditionalProperties: trueproperties:
message:
type: string# example:# message: Internal Server ErrorcommonModelSchemaFragments:
CommonGeneralError500:
statusCode: '500'responseBody: Common general 400 errorresponseModels:
application/json: CommonGeneralErrorCommonGeneralError400:
statusCode: '500'responseBody: Common general 400 errorresponseModels:
application/json: CommonGeneralErrorresources:
Resources:
all:
Type: 'AWS::ApiGateway::RequestValidator'Properties:
Name: allRestApiId:
Ref: ApiGatewayRestApiValidateRequestBody: trueValidateRequestParameters: trueprovider:
name: awsruntime: python3.8region: us-east-1apiName: secretstackName: secretdeploymentPrefix: secretendpointType: regionalapiKeys:
- secret-keyapiGateway:
apiKeySourceType: HEADERmetrics: true# tracing:# apiGateway: true# lambda: truelogs:
restApi:
accessLogging: falseexecutionLogging: falsefullExecutionData: falseroleManagedExternally: truerole: arn:aws:iam::123412341234:role/secret-1reqValidatorName: allpackage:
individually: truefunctions:
secret:
name: secretehandler: path/to-my-directory/secret.pyrole: arn:aws:iam::123412341234:role/secret-1disableLogs: falselayers:
- arn:aws:lambda:us-east-1:123412341234:layer:Layer1:1
- arn:aws:lambda:us-east-1:123412341234:layer:Layer2:1exclude:
- ./**include:
- path/to-my-directory/secret.py
- common/**events:
- http:
path: /productsmethod: getdocumentation:
tags: [products]summary: Lists all productsmethodResponses:
- statusCode: '200'responseModels:
application/json: ProductFromList
- ${self:custom.commonModelSchemaFragments.CommonGeneralError400}
- ${self:custom.commonModelSchemaFragments.CommonGeneralError500}cors: trueprivate: truereqValidatorName: allrequest:
parameters:
querystrings:
customerId: true
My investigation
I have looked for the usage of methodResponses property within the source code and tried to check if my file is OK. Method addMethodResponses (called at src/documentation.js) seems to work OK since it detects my responses from serverless.yml and adds them to some object. However, they don't seem to reach the AWS.
Additionally, I have tried versions from 0.6 (according to #17), using binary search to leap between the version upwards, but up to 1.1 none of versions even work in my environment (throwing 400 HTTP Error).
The text was updated successfully, but these errors were encountered:
I just got this working, some excerpts from my yaml:
<!-- From the custom section -->
documentation:
api:
info:
version: "1"
title: "Site"
description: "Site API"
models:
-
name: "ClientErrorResponse"
description: "Model representing http 4XX client error response"
contentType: "application/json"
schema: ${file(resources/response-model/client-error-response.schema.json)}
-
name: "CustomerSiteList"
description: "Model representing list of customer sites"
contentType: "application/json"
schema: ${file(resources/response-model/site-response.schema.json)}
<!-- From the http section of a function -->
documentation:
summary: Get all sites for a customer
description: Get all sites for a customer denoted by the request parameter customer_id
queryParams:
-
name: customer_id
description: The customer id
required: true
methodResponses:
-
statusCode: "200"
responseBody:
description: "Response body description"
responseModels:
"application/json": "CustomerSiteList"
-
statusCode: "400"
responseModels:
"application/json": "ClientErrorResponse"
Whenever I am trying to deploy my
serverless.yml
, I don't see the method responses in my AWS Console:However, all the models are created properly:
Environment
package.json
serverless.yml
My investigation
I have looked for the usage of
methodResponses
property within the source code and tried to check if my file is OK. MethodaddMethodResponses
(called atsrc/documentation.js
) seems to work OK since it detects my responses fromserverless.yml
and adds them to some object. However, they don't seem to reach the AWS.Additionally, I have tried versions from 0.6 (according to #17), using binary search to leap between the version upwards, but up to 1.1 none of versions even work in my environment (throwing 400 HTTP Error).
The text was updated successfully, but these errors were encountered: