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

openapi-typescript

Package Overview
Dependencies
Maintainers
1
Versions
144
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openapi-typescript - npm Package Compare versions

Comparing version 2.4.1 to 2.4.2

18

dist-node/index.js

@@ -419,3 +419,3 @@ 'use strict';

output += `requestBody: {\n`;
Object.entries(operation.requestBody.content).forEach(([contentType, {
Object.entries(operation.requestBody.content || {}).forEach(([contentType, {
schema

@@ -451,14 +451,16 @@ }]) => {

let output = "";
Object.entries(paths).forEach(([path, methods]) => {
Object.entries(paths).forEach(([path, pathItem]) => {
output += `"${path}": {\n`;
Object.entries(methods).forEach(([method, operation]) => {
if (method !== "parameters") {
Object.entries(pathItem).forEach(([field, operation]) => {
const isMethod = ["get", "put", "post", "delete", "options", "head", "patch", "trace"].includes(field);
if (isMethod) {
operation = operation;
if (operation.operationId) {
output += `"${method}": operations["${operation.operationId}"];\n`;
output += `"${field}": operations["${operation.operationId}"];\n`;
operations[operation.operationId] = operation;
} else {
if (operation.description) output += comment(operation.description);
output += `"${method}": ${transformOperation(operation)}`;
output += `"${field}": ${transformOperation(operation)}`;
}

@@ -468,4 +470,4 @@ }

if (methods.parameters) {
output += transformParameters(methods.parameters);
if (pathItem.parameters) {
output += transformParameters(pathItem.parameters);
}

@@ -472,0 +474,0 @@

@@ -138,3 +138,3 @@ import propertyMapper from "./property-mapper";

output += `requestBody: {\n`;
Object.entries(operation.requestBody.content).forEach(([contentType, { schema }]) => {
Object.entries(operation.requestBody.content || {}).forEach(([contentType, { schema }]) => {
output += `"${contentType}": ${transform(schema)};\n`;

@@ -167,9 +167,19 @@ });

let output = "";
Object.entries(paths).forEach(([path, methods]) => {
Object.entries(paths).forEach(([path, pathItem]) => {
output += `"${path}": {\n`;
Object.entries(methods).forEach(([method, operation]) => {
if (method !== "parameters") {
Object.entries(pathItem).forEach(([field, operation]) => {
const isMethod = [
"get",
"put",
"post",
"delete",
"options",
"head",
"patch",
"trace",
].includes(field);
if (isMethod) {
operation = operation;
if (operation.operationId) {
output += `"${method}": operations["${operation.operationId}"];\n`;
output += `"${field}": operations["${operation.operationId}"];\n`;
operations[operation.operationId] = operation;

@@ -180,8 +190,8 @@ }

output += comment(operation.description);
output += `"${method}": ${transformOperation(operation)}`;
output += `"${field}": ${transformOperation(operation)}`;
}
}
});
if (methods.parameters) {
output += transformParameters(methods.parameters);
if (pathItem.parameters) {
output += transformParameters(pathItem.parameters);
}

@@ -188,0 +198,0 @@ output += `}\n`;

@@ -5,8 +5,21 @@ export interface OpenAPI3Schemas {

export interface OpenAPI3Paths {
[path: string]: {
[method: string]: OpenAPI3Operation | Parameter[];
};
[path: string]: OpenAPI3PathItemObject;
}
export declare type OpenAPI3PathItemObject = {
$ref?: string;
summary?: string;
description?: string;
get?: OpenAPI3Operation;
put?: OpenAPI3Operation;
post?: OpenAPI3Operation;
delete?: OpenAPI3Operation;
options?: OpenAPI3Operation;
head?: OpenAPI3Operation;
patch?: OpenAPI3Operation;
trace?: OpenAPI3Operation;
parameters?: Parameter[];
};
export interface OpenAPI3Operation {
operationId?: string;
summary?: string;
description?: string;

@@ -39,3 +52,3 @@ parameters?: Parameter[];

description?: string;
content: {
content?: {
[contentType: string]: {

@@ -42,0 +55,0 @@ schema: OpenAPI3SchemaObject | {

{
"name": "openapi-typescript",
"description": "Generate TypeScript types from Swagger OpenAPI specs",
"version": "2.4.1",
"version": "2.4.2",
"license": "ISC",

@@ -6,0 +6,0 @@ "bin": {

@@ -5,3 +5,3 @@ [![version(scoped)](https://img.shields.io/npm/v/openapi-typescript.svg)](https://www.npmjs.com/package/openapi-typescript)

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-21-orange.svg?style=flat-square)](#contributors-)
[![All Contributors](https://img.shields.io/badge/all_contributors-23-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

@@ -287,2 +287,6 @@

</tr>
<tr>
<td align="center"><a href="https://rendall.dev"><img src="https://avatars2.githubusercontent.com/u/293263?v=4" width="100px;" alt=""/><br /><sub><b>Rendall</b></sub></a><br /><a href="https://github.com/drwpow/openapi-typescript/commits?author=rendall" title="Code">💻</a> <a href="https://github.com/drwpow/openapi-typescript/issues?q=author%3Arendall" title="Bug reports">🐛</a> <a href="https://github.com/drwpow/openapi-typescript/commits?author=rendall" title="Tests">⚠️</a></td>
<td align="center"><a href="https://massaioli.wordpress.com"><img src="https://avatars3.githubusercontent.com/u/149178?v=4" width="100px;" alt=""/><br /><sub><b>Robert Massaioli</b></sub></a><br /><a href="https://github.com/drwpow/openapi-typescript/commits?author=robertmassaioli" title="Code">💻</a> <a href="https://github.com/drwpow/openapi-typescript/issues?q=author%3Arobertmassaioli" title="Bug reports">🐛</a></td>
</tr>
</table>

@@ -289,0 +293,0 @@

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