-
Notifications
You must be signed in to change notification settings - Fork 76
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 typescript handler dist path for operations w…
…ith inline request bodies (#607) When an operation has inline request body schemas (rather than a $ref) in OpenAPI, the operation ID is suffixed with "Operation" in the generated code, but the operation nickname remains unchanged. Previously, the operation ID was used for the handler dist reference in the generated functions, but the nickname was used to generate the actual filename. Address this by using the nickname in both places for typescript generated functions. Fixes #606
- Loading branch information
Showing
8 changed files
with
767 additions
and
114 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
86 changes: 86 additions & 0 deletions
86
packages/type-safe-api/test/resources/specs/inline-body.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,86 @@ | ||
openapi: 3.0.3 | ||
info: | ||
version: 1.0.0 | ||
title: Test | ||
paths: | ||
/typescript: | ||
post: | ||
operationId: typescriptTest | ||
x-handler: | ||
language: typescript | ||
requestBody: | ||
required: true | ||
content: | ||
application/json: | ||
# Schema is inline rather than a $ref | ||
schema: | ||
type: object | ||
properties: | ||
field1: | ||
type: string | ||
field2: | ||
type: string | ||
responses: | ||
200: | ||
description: OK | ||
content: | ||
'application/json': | ||
schema: | ||
$ref: '#/components/schemas/TestResponseContent' | ||
/java: | ||
post: | ||
operationId: javaTest | ||
x-handler: | ||
language: java | ||
requestBody: | ||
required: true | ||
content: | ||
application/json: | ||
# Schema is inline rather than a $ref | ||
schema: | ||
type: object | ||
properties: | ||
field1: | ||
type: string | ||
field2: | ||
type: string | ||
responses: | ||
200: | ||
description: OK | ||
content: | ||
'application/json': | ||
schema: | ||
$ref: '#/components/schemas/TestResponseContent' | ||
/python: | ||
post: | ||
operationId: pythonTest | ||
x-handler: | ||
language: python | ||
requestBody: | ||
required: true | ||
content: | ||
application/json: | ||
# Schema is inline rather than a $ref | ||
schema: | ||
type: object | ||
properties: | ||
field1: | ||
type: string | ||
field2: | ||
type: string | ||
responses: | ||
200: | ||
description: OK | ||
content: | ||
'application/json': | ||
schema: | ||
$ref: '#/components/schemas/TestResponseContent' | ||
components: | ||
schemas: | ||
TestResponseContent: | ||
type: object | ||
properties: | ||
message: | ||
type: string | ||
required: | ||
- message |
Oops, something went wrong.