@ts-rest/open-api
Advanced tools
Comparing version 3.40.1 to 3.41.0
# @ts-rest/open-api | ||
## 3.41.0 | ||
### Patch Changes | ||
- a0ee91d: Fix setting of response description | ||
## 3.40.1 | ||
@@ -4,0 +10,0 @@ |
@@ -153,9 +153,11 @@ 'use strict'; | ||
: null; | ||
const responses = Object.keys(path.route.responses).reduce((acc, key) => { | ||
const keyAsNumber = Number(key); | ||
const responseSchema = getOpenApiSchemaFromZod(path.route.responses[keyAsNumber], true); | ||
const responses = Object.entries(path.route.responses).reduce((acc, [statusCode, response]) => { | ||
const responseSchema = getOpenApiSchemaFromZod(response, true); | ||
const description = core.isZodType(response) && response.description | ||
? response.description | ||
: statusCode; | ||
return { | ||
...acc, | ||
[keyAsNumber]: { | ||
description: `${keyAsNumber}`, | ||
[statusCode]: { | ||
description, | ||
...(responseSchema | ||
@@ -162,0 +164,0 @@ ? { |
@@ -1,2 +0,2 @@ | ||
import { isAppRoute, isZodType, isZodObject, extractZodObjectShape } from '@ts-rest/core'; | ||
import { isZodType, isAppRoute, isZodObject, extractZodObjectShape } from '@ts-rest/core'; | ||
import { generateSchema } from '@anatine/zod-openapi'; | ||
@@ -149,9 +149,11 @@ | ||
: null; | ||
const responses = Object.keys(path.route.responses).reduce((acc, key) => { | ||
const keyAsNumber = Number(key); | ||
const responseSchema = getOpenApiSchemaFromZod(path.route.responses[keyAsNumber], true); | ||
const responses = Object.entries(path.route.responses).reduce((acc, [statusCode, response]) => { | ||
const responseSchema = getOpenApiSchemaFromZod(response, true); | ||
const description = isZodType(response) && response.description | ||
? response.description | ||
: statusCode; | ||
return { | ||
...acc, | ||
[keyAsNumber]: { | ||
description: `${keyAsNumber}`, | ||
[statusCode]: { | ||
description, | ||
...(responseSchema | ||
@@ -158,0 +160,0 @@ ? { |
{ | ||
"name": "@ts-rest/open-api", | ||
"version": "3.40.1", | ||
"version": "3.41.0", | ||
"dependencies": { | ||
@@ -5,0 +5,0 @@ "@anatine/zod-openapi": "^1.12.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32584
433