/backend/swagger/api.yaml
https://github.com/awslabs/realworld-serverless-application · YAML · 424 lines · 419 code · 3 blank · 2 comment · 0 complexity · c8f5652ed569eef2d7594f49371e01b4 MD5 · raw file
- openapi: 3.0.0
- info:
- title:
- Fn::Sub: realworld-serverless-application-backend-${Stage}
- description: A simplified implementation of AWS Serverless Application Repository
- version: 2019-10-13
- # Enable request validator. See doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-request-validation-sample-api-swagger.html
- x-amazon-apigateway-request-validators:
- all:
- validateRequestBody: true
- validateRequestParameters: true
- x-amazon-apigateway-request-validator: all
- x-amazon-apigateway-gateway-responses:
- # Provide more detailed error message for bad request body errors. See doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-gateway-responses.html
- BAD_REQUEST_BODY:
- responseTemplates:
- application/json: '{"errorCode": "BadRequestBody", "message": "$context.error.validationErrorString"}'
- responseParameters:
- gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
- DEFAULT_4XX:
- responseParameters:
- gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
- DEFAULT_5XX:
- responseParameters:
- gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
- paths:
- /applications:
- post:
- operationId: CreateApplication
- requestBody:
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/CreateApplicationInput"
- required: true
- responses:
- "201":
- description: "Successfully Created an application."
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/Application"
- "400":
- description: "Bad Request Exception"
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/BadRequestException"
- "401":
- description: "Unauthorized Exception"
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/UnauthorizedException"
- "409":
- description: "Conflict Exception"
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ConflictException"
- "429":
- description: "Too Many Requests Exception"
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/TooManyRequestsException"
- "500":
- description: "Internal Server Error"
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/InternalServerErrorException"
- x-amazon-apigateway-integration:
- uri:
- Fn::Sub: arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${ApiLambda.Arn}:live/invocations
- httpMethod: POST
- type: aws_proxy
- passthroughBehavior: never
- security:
- - cognitoAuthorizer: []
- get:
- operationId: ListApplications
- parameters:
- - name: nextToken
- in: query
- required: false
- schema:
- type: string
- - name: maxItems
- in: query
- required: false
- schema:
- type: integer
- minimum: 1
- maximum: 100
- responses:
- "200":
- description: "Successfully list applications"
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/ApplicationList"
- "400":
- description: "Bad Request Exception"
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/BadRequestException"
- "401":
- description: "Unauthorized Exception"
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/UnauthorizedException"
- "429":
- description: "Too Many Requests Exception"
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/TooManyRequestsException"
- "500":
- description: "Internal Server Error"
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/InternalServerErrorException"
- x-amazon-apigateway-integration:
- uri:
- Fn::Sub: arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${ApiLambda.Arn}:live/invocations
- httpMethod: POST
- type: aws_proxy
- passthroughBehavior: never
- security:
- - cognitoAuthorizer: []
- "/applications/{applicationId}":
- get:
- operationId: GetApplication
- parameters:
- - name: applicationId
- in: path
- required: true
- schema:
- type: string
- pattern: ^[a-zA-Z0-9\-]{3,128}$
- responses:
- "200":
- description: "Successfully get an application"
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/Application"
- "400":
- description: "Bad Request Exception"
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/BadRequestException"
- "401":
- description: "Unauthorized Exception"
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/UnauthorizedException"
- "404":
- description: "Not Found Exception"
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/NotFoundException"
- "429":
- description: "Too Many Requests Exception"
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/TooManyRequestsException"
- "500":
- description: "Internal Server Error"
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/InternalServerErrorException"
- x-amazon-apigateway-integration:
- uri:
- Fn::Sub: arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${ApiLambda.Arn}:live/invocations
- httpMethod: POST
- type: aws_proxy
- passthroughBehavior: never
- security:
- - cognitoAuthorizer: []
- patch:
- operationId: UpdateApplication
- parameters:
- - name: applicationId
- in: path
- required: true
- schema:
- type: string
- pattern: ^[a-zA-Z0-9\-]{3,128}$
- requestBody:
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/UpdateApplicationInput"
- required: true
- responses:
- "200":
- description: "Successfully update an application"
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/Application"
- "400":
- description: "Bad Request Exception"
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/BadRequestException"
- "401":
- description: "Unauthorized Exception"
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/UnauthorizedException"
- "404":
- description: "Not Found Exception"
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/NotFoundException"
- "429":
- description: "Too Many Requests Exception"
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/TooManyRequestsException"
- "500":
- description: "Internal Server Error"
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/InternalServerErrorException"
- x-amazon-apigateway-integration:
- uri:
- Fn::Sub: arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${ApiLambda.Arn}:live/invocations
- httpMethod: POST
- type: aws_proxy
- passthroughBehavior: never
- security:
- - cognitoAuthorizer: []
- delete:
- operationId: DeleteApplication
- parameters:
- - name: applicationId
- in: path
- required: true
- schema:
- type: string
- pattern: ^[a-zA-Z0-9\-]{3,128}$
- responses:
- "204":
- description: "Successfully delete an application"
- "400":
- description: "Bad Request Exception"
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/BadRequestException"
- "401":
- description: "Unauthorized Exception"
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/UnauthorizedException"
- "404":
- description: "Not Found Exception"
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/NotFoundException"
- "429":
- description: "Too Many Requests Exception"
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/TooManyRequestsException"
- "500":
- description: "Internal Server Error"
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/InternalServerErrorException"
- x-amazon-apigateway-integration:
- uri:
- Fn::Sub: arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${ApiLambda.Arn}:live/invocations
- httpMethod: POST
- type: aws_proxy
- passthroughBehavior: never
- security:
- - cognitoAuthorizer: []
- components:
- securitySchemes:
- cognitoAuthorizer:
- type: apiKey
- name: Authorization
- in: header
- x-amazon-apigateway-authtype: cognito_user_pools
- x-amazon-apigateway-authorizer:
- providerARNs:
- - Fn::GetAtt: ApplicationsApiUserPool.Arn
- type: cognito_user_pools
- schemas:
- BadRequestException:
- type: object
- properties:
- message:
- type: string
- errorCode:
- type: string
- UnauthorizedException:
- type: object
- properties:
- message:
- type: string
- errorCode:
- type: string
- NotFoundException:
- type: object
- properties:
- message:
- type: string
- errorCode:
- type: string
- ConflictException:
- type: object
- properties:
- message:
- type: string
- errorCode:
- type: string
- TooManyRequestsException:
- type: object
- properties:
- message:
- type: string
- errorCode:
- type: string
- InternalServerErrorException:
- type: object
- properties:
- message:
- type: string
- errorCode:
- type: string
- CreateApplicationInput:
- type: object
- required:
- - applicationId
- - description
- - author
- properties:
- applicationId:
- type: string
- pattern: ^[a-zA-Z0-9\-]{3,128}$
- description:
- type: string
- minLength: 3
- maxLength: 256
- author:
- type: string
- pattern: ^[a-zA-Z0-9\-]{1,128}$
- homePageUrl:
- type: string
- pattern: ^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$
- UpdateApplicationInput:
- type: object
- properties:
- description:
- type: string
- minLength: 3
- maxLength: 256
- author:
- type: string
- pattern: ^[a-zA-Z0-9\-]{1,128}$
- homePageUrl:
- type: string
- pattern: ^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$
- Application:
- type: object
- required:
- - applicationId
- - description
- - author
- properties:
- applicationId:
- type: string
- description:
- type: string
- author:
- type: string
- creationTime:
- type: string
- homePageUrl:
- type: string
- ApplicationSummary:
- type: object
- properties:
- applicationId:
- type: string
- description:
- type: string
- creationTime:
- type: string
- ApplicationList:
- type: object
- properties:
- applications:
- type: array
- items:
- $ref: "#/components/schemas/ApplicationSummary"
- nextToken:
- type: string