Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save keiththompson/5b2d23f1dd7cf5dd52eace5b6e1342cd to your computer and use it in GitHub Desktop.
Save keiththompson/5b2d23f1dd7cf5dd52eace5b6e1342cd to your computer and use it in GitHub Desktop.
Open API 3.0 Todo-app sample
openapi: 3.0.0
info:
description: Serverless demo application
version: "1.0.0-oas3"
title: Simple Todo API
contact:
email: keithjoethompson@gmail.com
tags:
- name: Todo Application
description: Serverless demo application
paths:
/todo:
post:
tags:
- Todo Application
summary: Creates a Todo
description: |
Create a Todo yet to be completed.
responses:
'200':
description: The created Todo
content:
application/json:
schema:
$ref: '#/components/schemas/Todo'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Todo'
description: The Todo to be created
required: true
security:
- TodoUserPool: []
x-amazon-apigateway-integration:
responses:
default:
statusCode: 200
uri:
Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${AddTodoFunction.Arn}/invocations
passthroughBehavior: when_no_match
httpMethod: POST
type: aws_proxy
get:
tags:
- Todo Application
summary: Lists all Todos
description: |
Lists all created Todos.
responses:
'200':
description: A list of Todos
content:
application/json:
schema:
$ref: '#/components/schemas/ArrayOfTodos'
security:
- TodoUserPool: []
x-amazon-apigateway-integration:
responses:
default:
statusCode: 200
uri:
Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${ListTodoFunction.Arn}/invocations
passthroughBehavior: when_no_match
httpMethod: POST
type: aws_proxy
components:
schemas:
Todo:
type: object
required:
- uid
- text
properties:
uid:
type: string
example: b12be200-0a79-4b71-8968-274c5313c7a0
text:
type: string
example: Pick up flowers for Betty
completed:
type: boolean
example: false
ArrayOfTodos:
type: array
items:
$ref: '#/components/schemas/Todo'
securitySchemes:
TodoUserPool:
type: apiKey
name: Authorization
in: header
x-amazon-apigateway-authtype: cognito_user_pools
x-amazon-apigateway-authorizer:
type: cognito_user_pools
providerARNs:
- Fn::Sub: arn:aws:cognito-idp:${AWS::Region}:${AWS::AccountId}:userpool/${TodoUserPool.Arn}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment