Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@samchon/openapi

Package Overview
Dependencies
Maintainers
1
Versions
147
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@samchon/openapi - npm Package Compare versions

Comparing version 0.1.16 to 0.1.17-dev.20240418

lib/internal/OpenApiTypeChecker.d.ts

1

lib/internal/SwaggerV2Converter.js

@@ -57,2 +57,3 @@ "use strict";

.filter((p) => p !== undefined &&
p.in !== "body" &&
p.schema ===

@@ -59,0 +60,0 @@ undefined).map(convertParameter)

@@ -37,2 +37,3 @@ import { OpenApiV3 } from "./OpenApiV3";

export declare namespace OpenApi {
type Method = "get" | "post" | "put" | "delete" | "options" | "head" | "patch" | "trace";
/**

@@ -45,3 +46,13 @@ * Convert Swagger or OpenAPI document into emended OpenAPI v3.1 document.

const convert: (input: SwaggerV2.IDocument | OpenApiV3.IDocument | OpenApiV3_1.IDocument | OpenApi.IDocument) => IDocument;
type Method = "get" | "post" | "put" | "delete" | "options" | "head" | "patch" | "trace";
/**
* Downgrade to Swagger v2.0 document.
*
* Downgrade the given document (emeneded OpenAPI v3.1) into Swagger v2.0.
*
* @param document Emended OpenAPI v3.1 document to downgrade
* @param version Version to downgrade
* @returns Swagger v2.0 document
*/
function downgrade(document: IDocument, version: "2.0"): SwaggerV2.IDocument;
function downgrade(document: IDocument, version: "3.0"): OpenApiV3.IDocument;
interface IDocument {

@@ -48,0 +59,0 @@ openapi: `3.1.${number}`;

@@ -8,4 +8,6 @@ "use strict";

const OpenApiV3Converter_1 = require("./internal/OpenApiV3Converter");
const OpenApiV3Downgrader_1 = require("./internal/OpenApiV3Downgrader");
const OpenApiV3_1Converter_1 = require("./internal/OpenApiV3_1Converter");
const SwaggerV2Converter_1 = require("./internal/SwaggerV2Converter");
const SwaggerV2Downgrader_1 = require("./internal/SwaggerV2Downgrader");
/**

@@ -60,2 +62,19 @@ * Emended OpenAPI v3.1 definition used by `typia` and `nestia`.

};
/**
* Downgrade to OpenAPI v2.3 document.
*
* Downgrade the given document (emeneded OpenAPI v3.1) into OpenAPI v3.0.
*
* @param document Emended OpenAPI v3.1 document to downgrade
* @param version Version to downgrade
* @returns OpenAPI v3.0 document
*/
function downgrade(document, version) {
if (version === "2.0")
return SwaggerV2Downgrader_1.SwaggerV2Downgrader.downgrade(document);
else if (version === "3.0")
return OpenApiV3Downgrader_1.OpenApiV3Downgrader.downgrade(document);
throw new TypeError("Unrecognized Swagger/OpenAPI version.");
}
OpenApi.downgrade = downgrade;
})(OpenApi || (exports.OpenApi = OpenApi = {}));

2

package.json
{
"name": "@samchon/openapi",
"version": "0.1.16",
"version": "0.1.17-dev.20240418",
"description": "OpenAPI definitions and converters for 'typia' and 'nestia'.",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

@@ -79,2 +79,3 @@ import { OpenApi } from "../OpenApi";

p !== undefined &&
p.in !== "body" &&
(p as SwaggerV2.IOperation.IBodyParameter).schema ===

@@ -81,0 +82,0 @@ undefined,

@@ -5,4 +5,6 @@ import { OpenApiV3 } from "./OpenApiV3";

import { OpenApiV3Converter } from "./internal/OpenApiV3Converter";
import { OpenApiV3Downgrader } from "./internal/OpenApiV3Downgrader";
import { OpenApiV3_1Converter } from "./internal/OpenApiV3_1Converter";
import { SwaggerV2Converter } from "./internal/SwaggerV2Converter";
import { SwaggerV2Downgrader } from "./internal/SwaggerV2Downgrader";

@@ -42,2 +44,12 @@ /**

export namespace OpenApi {
export type Method =
| "get"
| "post"
| "put"
| "delete"
| "options"
| "head"
| "patch"
| "trace";
/**

@@ -62,12 +74,38 @@ * Convert Swagger or OpenAPI document into emended OpenAPI v3.1 document.

export type Method =
| "get"
| "post"
| "put"
| "delete"
| "options"
| "head"
| "patch"
| "trace";
/**
* Downgrade to Swagger v2.0 document.
*
* Downgrade the given document (emeneded OpenAPI v3.1) into Swagger v2.0.
*
* @param document Emended OpenAPI v3.1 document to downgrade
* @param version Version to downgrade
* @returns Swagger v2.0 document
*/
export function downgrade(
document: IDocument,
version: "2.0",
): SwaggerV2.IDocument;
export function downgrade(
document: IDocument,
version: "3.0",
): OpenApiV3.IDocument;
/**
* Downgrade to OpenAPI v2.3 document.
*
* Downgrade the given document (emeneded OpenAPI v3.1) into OpenAPI v3.0.
*
* @param document Emended OpenAPI v3.1 document to downgrade
* @param version Version to downgrade
* @returns OpenAPI v3.0 document
*/
export function downgrade(
document: IDocument,
version: string,
): SwaggerV2.IDocument | OpenApiV3.IDocument {
if (version === "2.0") return SwaggerV2Downgrader.downgrade(document);
else if (version === "3.0") return OpenApiV3Downgrader.downgrade(document);
throw new TypeError("Unrecognized Swagger/OpenAPI version.");
}
/* -----------------------------------------------------------

@@ -74,0 +112,0 @@ PATH ITEMS

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