-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(#178): handle $ref in response object
- Loading branch information
Showing
3 changed files
with
67 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"openapi-zod-client": minor | ||
--- | ||
|
||
handle $ref in responses object |
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
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,59 @@ | ||
import { getZodiosEndpointDefinitionList } from "../src"; | ||
import { expect, test } from "vitest"; | ||
|
||
test("resolve-ref-responses", () => { | ||
// Without the refiner function passed. | ||
expect( | ||
getZodiosEndpointDefinitionList({ | ||
openapi: "3.0.3", | ||
info: { version: "1", title: "Example API" }, | ||
paths: { | ||
"/": { | ||
get: { | ||
operationId: "getExample", | ||
responses: { | ||
"200": { | ||
$ref: "#/components/responses/ExampleResponse" | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
components: { | ||
responses: { | ||
ExampleResponse: { | ||
description: "example response", | ||
content: { "application/json": { schema: { type: "string" } } }, | ||
} | ||
} | ||
}, | ||
}) | ||
).toMatchInlineSnapshot(` | ||
{ | ||
"deepDependencyGraph": {}, | ||
"endpoints": [ | ||
{ | ||
"description": undefined, | ||
"errors": [], | ||
"method": "get", | ||
"parameters": [], | ||
"path": "/", | ||
"requestFormat": "json", | ||
"response": "z.string()", | ||
}, | ||
], | ||
"issues": { | ||
"ignoredFallbackResponse": [], | ||
"ignoredGenericError": [], | ||
}, | ||
"refsDependencyGraph": {}, | ||
"resolver": { | ||
"getSchemaByRef": [Function], | ||
"resolveRef": [Function], | ||
"resolveSchemaName": [Function], | ||
}, | ||
"schemaByName": {}, | ||
"zodSchemaByName": {}, | ||
} | ||
`); | ||
}); |
d897485
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
openapi-zod-client – ./
openapi-zod-client-git-main-astahmer.vercel.app
openapi-zod-client-astahmer.vercel.app
openapi-zod-client.vercel.app