|
| 1 | +service: serverless-openapi-doc-demo |
| 2 | +frameworkVersion: ">=3.0.0 < 4.0.0" |
| 3 | +provider: |
| 4 | + name: aws |
| 5 | + runtime: nodejs14.x |
| 6 | + |
| 7 | +plugins: |
| 8 | + - ../../../index.js |
| 9 | + |
| 10 | +custom: |
| 11 | + defaultStage: uat |
| 12 | + documentation: |
| 13 | + description: Description for my OpenAPI File |
| 14 | + version: 1.0.0 |
| 15 | + tags: |
| 16 | + - name: DynamoDB |
| 17 | + description: Functions that operate with DynamoDB |
| 18 | + externalDocumentation: |
| 19 | + url: https://aws.amazon.com/dynamodb/ |
| 20 | + description: How to use DynamoDB |
| 21 | + - name: OpenSearch |
| 22 | + description: Functions that operate with ElasticSearch/OpenSearch |
| 23 | + externalDocumentation: |
| 24 | + url: https://aws.amazon.com/opensearch-service/ |
| 25 | + description: How to use Elasticsearch |
| 26 | + servers: |
| 27 | + - url: "{url}/content" |
| 28 | + description: The endpoint |
| 29 | + variables: |
| 30 | + url: |
| 31 | + default: https://uat.example.com |
| 32 | + description: the API URL |
| 33 | + securitySchemes: |
| 34 | + Authorization: |
| 35 | + type: apiKey |
| 36 | + name: Authorization |
| 37 | + in: header |
| 38 | + models: |
| 39 | + - name: CreateContentBody |
| 40 | + content: |
| 41 | + application/json: |
| 42 | + schema: |
| 43 | + type: object |
| 44 | + properties: |
| 45 | + content: |
| 46 | + type: string |
| 47 | + examples: |
| 48 | + - name: content |
| 49 | + description: The content to create or update |
| 50 | + value: { content: "my name is" } |
| 51 | + - name: FilterContentBody |
| 52 | + content: |
| 53 | + application/json: |
| 54 | + schema: |
| 55 | + type: object |
| 56 | + properties: |
| 57 | + size: |
| 58 | + type: number |
| 59 | + keyword: |
| 60 | + type: string |
| 61 | + examples: |
| 62 | + - name: content |
| 63 | + description: Filters to use |
| 64 | + value: { size: 10, keyword: "John" } |
| 65 | + - name: ErrorResponse |
| 66 | + content: |
| 67 | + application/json: |
| 68 | + schema: |
| 69 | + type: object |
| 70 | + properties: |
| 71 | + message: |
| 72 | + type: string |
| 73 | + errors: |
| 74 | + type: object |
| 75 | + nullable: true |
| 76 | + - name: SuccessResponse |
| 77 | + content: |
| 78 | + application/json: |
| 79 | + schema: |
| 80 | + type: object |
| 81 | + properties: |
| 82 | + message: |
| 83 | + type: string |
| 84 | + |
| 85 | +functions: |
| 86 | + getContent: |
| 87 | + handler: handler.getContent |
| 88 | + events: |
| 89 | + - httpApi: |
| 90 | + path: /{contentId} |
| 91 | + method: GET |
| 92 | + documentation: |
| 93 | + description: A method to bring back content from OpenSearch |
| 94 | + summary: get content from OpenSearch |
| 95 | + pathParams: |
| 96 | + - name: contentId |
| 97 | + description: The id of the piece of content to get |
| 98 | + schema: |
| 99 | + type: string |
| 100 | + format: uuid |
| 101 | + tags: |
| 102 | + - OpenSearch |
| 103 | + methodResponses: |
| 104 | + - statusCode: 200 |
| 105 | + responseBody: |
| 106 | + description: The content requested |
| 107 | + responseModels: |
| 108 | + application/json: SuccessResponse |
| 109 | + owasp: true |
| 110 | + - statusCode: 404 |
| 111 | + responseBody: |
| 112 | + description: An error occured |
| 113 | + responseModels: |
| 114 | + application/json: ErrorResponse |
| 115 | + owasp: true |
| 116 | + |
| 117 | + createContent: |
| 118 | + handler: handler.createContent |
| 119 | + events: |
| 120 | + - http: |
| 121 | + path: / |
| 122 | + method: POST |
| 123 | + documentation: |
| 124 | + description: A way to create content on OpenSearch |
| 125 | + summary: Create content on OpenSearch |
| 126 | + requestBody: |
| 127 | + description: The content to store on OpenSearch |
| 128 | + requestModels: |
| 129 | + application/json: CreateContentBody |
| 130 | + tags: |
| 131 | + - OpenSearch |
| 132 | + methodResponses: |
| 133 | + - statusCode: 201 |
| 134 | + responseBody: |
| 135 | + description: The content requested |
| 136 | + responseModels: |
| 137 | + application/json: SuccessResponse |
| 138 | + - statusCode: 404 |
| 139 | + responseBody: |
| 140 | + description: An error occured |
| 141 | + responseModels: |
| 142 | + application/json: ErrorResponse |
| 143 | + security: |
| 144 | + - Authorization: [] |
| 145 | + |
| 146 | + filterContent: |
| 147 | + handler: handler.filterContent |
| 148 | + events: |
| 149 | + - http: |
| 150 | + path: /search |
| 151 | + method: POST |
| 152 | + documentation: |
| 153 | + description: A way to search for content on OpenSearch |
| 154 | + summary: Search content on OpenSearch |
| 155 | + requestBody: |
| 156 | + description: Set of filters to be able to filter content on |
| 157 | + requestModels: |
| 158 | + application/json: FilterContentBody |
| 159 | + tags: |
| 160 | + - OpenSearch |
| 161 | + methodResponses: |
| 162 | + - statusCode: 200 |
| 163 | + responseBody: |
| 164 | + description: The content requested |
| 165 | + responseModels: |
| 166 | + application/json: SuccessResponse |
| 167 | + - statusCode: 404 |
| 168 | + responseBody: |
| 169 | + description: An error occured |
| 170 | + responseModels: |
| 171 | + application/json: ErrorResponse |
| 172 | + |
| 173 | + mapContent: |
| 174 | + handler: handler.mapContent |
| 175 | + events: |
| 176 | + - http: |
| 177 | + path: /{contentId} |
| 178 | + method: POST |
| 179 | + documentation: |
| 180 | + description: Map a piece of content from OpenSearch to DynamoDB |
| 181 | + summary: Map content to DynamoDB |
| 182 | + pathParams: |
| 183 | + - name: contentId |
| 184 | + description: The id of the piece of content to get |
| 185 | + schema: |
| 186 | + type: string |
| 187 | + format: uuid |
| 188 | + tags: |
| 189 | + - DynamoDB |
| 190 | + methodResponses: |
| 191 | + - statusCode: 201 |
| 192 | + responseBody: |
| 193 | + description: The content requested |
| 194 | + responseModels: |
| 195 | + application/json: SuccessResponse |
| 196 | + - statusCode: 404 |
| 197 | + responseBody: |
| 198 | + description: An error occured |
| 199 | + responseModels: |
| 200 | + application/json: ErrorResponse |
| 201 | + security: |
| 202 | + - Authorization: [] |
| 203 | + |
| 204 | + updateContent: |
| 205 | + handler: handler.updateContent |
| 206 | + events: |
| 207 | + - http: |
| 208 | + path: /{contentId} |
| 209 | + method: PUT |
| 210 | + documentation: |
| 211 | + description: A way to update content on OpenSearch |
| 212 | + summary: Update content on OpenSearch |
| 213 | + pathParams: |
| 214 | + - name: contentId |
| 215 | + description: The id of the piece of content to get |
| 216 | + schema: |
| 217 | + type: string |
| 218 | + format: uuid |
| 219 | + requestBody: |
| 220 | + description: The content to update on OpenSearch |
| 221 | + requestModels: |
| 222 | + application/json: CreateContentBody |
| 223 | + tags: |
| 224 | + - OpenSearch |
| 225 | + methodResponses: |
| 226 | + - statusCode: 201 |
| 227 | + responseBody: |
| 228 | + description: The content requested |
| 229 | + responseModels: |
| 230 | + application/json: SuccessResponse |
| 231 | + - statusCode: 404 |
| 232 | + responseBody: |
| 233 | + description: An error occured |
| 234 | + responseModels: |
| 235 | + application/json: ErrorResponse |
| 236 | + security: |
| 237 | + - Authorization: [] |
0 commit comments