-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(type-safe-api): fix duplicate 200 response for operations with de…
…fault responses OpenAPI generator treated "default" responses as responses with code 0, however parseOpenapi treats default as 200. Adjust code generation to follow OpenAPI for backwards compatibility and to avoid duplicate 200 responses. Note that this should be revisited such that code generation allows for any response code other than those defined to be returned for the default response, rather than 0. References #841
- Loading branch information
Showing
4 changed files
with
1,523 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
packages/type-safe-api/test/resources/specs/default-response.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
openapi: 3.0.3 | ||
info: | ||
version: 1.0.0 | ||
title: My API | ||
description: See https://github.com/aws/aws-pdk/issues/841 | ||
paths: | ||
/hello: | ||
get: | ||
operationId: sayHello | ||
x-handler: | ||
language: typescript | ||
parameters: | ||
- in: query | ||
name: name | ||
schema: | ||
type: string | ||
required: true | ||
responses: | ||
200: | ||
description: Successful response | ||
content: | ||
'application/json': | ||
schema: | ||
$ref: '#/components/schemas/SayHelloResponseContent' | ||
default: | ||
description: An error due to the client not being authorized to access the resource | ||
content: | ||
'application/json': | ||
schema: | ||
$ref: '#/components/schemas/ServiceUnavailableErrorResponseContent' | ||
components: | ||
schemas: | ||
SayHelloResponseContent: | ||
type: object | ||
properties: | ||
id: | ||
$ref: '#/components/schemas/HelloId' | ||
message: | ||
type: string | ||
required: | ||
- message | ||
HelloId: | ||
type: string | ||
format: uuid | ||
ServiceUnavailableErrorResponseContent: | ||
type: object | ||
properties: | ||
message: | ||
type: string | ||
required: | ||
- message |
Oops, something went wrong.