New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More โ†’
Socket
Sign inDemoInstall
Socket

@ts-rest/open-api

Package Overview
Dependencies
Maintainers
1
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ts-rest/open-api - npm Package Compare versions

Comparing version 3.27.0-rc.0 to 3.27.0

15

CHANGELOG.md
# @ts-rest/open-api
## 3.27.0-rc.0
## 3.27.0
### Minor Changes
- b85118a: Add support for headers (using Zod) in open-api generation, from PR #318
### Patch Changes
- 55411ad: Upgrade zod to 3.21.4
Upgrade @anatine/zod-openapi to 2.0.1
## 3.26.4
## 3.26.3
## 3.26.2

@@ -6,0 +19,0 @@

@@ -60,2 +60,21 @@ 'use strict';

};
const getHeaderParameters = (zodObject) => {
const isZodObj = core.isZodObject(zodObject);
if (!isZodObj) {
return [];
}
const zodShape = core.extractZodObjectShape(zodObject);
return Object.entries(zodShape).map(([key, value]) => {
const schema = getOpenApiSchemaFromZod(value);
const isRequired = !value.isOptional();
return {
name: key,
in: 'header',
...(isRequired && { required: true }),
...({
schema: schema,
}),
};
});
};
const getQueryParametersFromZod = (zodObject, jsonQuery = false) => {

@@ -110,2 +129,3 @@ const isZodObj = core.isZodObject(zodObject);

const pathParams = getPathParameters(path.path, path.route.pathParams);
const headerParams = getHeaderParameters(path.route.headers);
const querySchema = getQueryParametersFromZod(path.route.query, !!options.jsonQuery);

@@ -139,3 +159,3 @@ const bodySchema = ((_a = path.route) === null || _a === void 0 ? void 0 : _a.method) !== 'GET'

tags: path.paths,
parameters: [...pathParams, ...querySchema],
parameters: [...pathParams, ...headerParams, ...querySchema],
...(options.setOperationId ? { operationId: path.id } : {}),

@@ -142,0 +162,0 @@ ...(bodySchema

6

package.json
{
"name": "@ts-rest/open-api",
"version": "3.27.0-rc.0",
"version": "3.27.0",
"dependencies": {

@@ -9,4 +9,4 @@ "@anatine/zod-openapi": "^1.12.0",

"peerDependencies": {
"zod": "^3.0.0",
"@ts-rest/core": "3.27.0-rc.0"
"zod": "^3.21.0",
"@ts-rest/core": "3.27.0"
},

@@ -13,0 +13,0 @@ "typedoc": {

@@ -55,3 +55,3 @@ # ts-rest

Fulfil the contract on your sever, with a type-safe router:
Fulfil the contract on your server, with a type-safe router:

@@ -125,2 +125,3 @@ ```typescript

<td align="center" valign="top" width="14.28%"><a href="https://github.com/baryla"><img src="https://avatars.githubusercontent.com/u/10336085?v=4?s=100" width="100px;" alt="Adrian Barylski"/><br /><sub><b>Adrian Barylski</b></sub></a><br /><a href="https://github.com/ts-rest/ts-rest/commits?author=baryla" title="Code">๐Ÿ’ป</a> <a href="https://github.com/ts-rest/ts-rest/commits?author=baryla" title="Documentation">๐Ÿ“–</a> <a href="https://github.com/ts-rest/ts-rest/commits?author=baryla" title="Tests">โš ๏ธ</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://nad.dev"><img src="https://avatars.githubusercontent.com/u/6670753?v=4?s=100" width="100px;" alt="Neil A. Dobson"/><br /><sub><b>Neil A. Dobson</b></sub></a><br /><a href="https://github.com/ts-rest/ts-rest/commits?author=neildobson-au" title="Code">๐Ÿ’ป</a></td>
</tr>

@@ -127,0 +128,0 @@ </tbody>

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with โšก๏ธ by Socket Inc