@samchon/openapi
Advanced tools
Comparing version 0.1.13 to 0.1.14-dev.20240415
@@ -5,2 +5,4 @@ import { OpenApi } from "../OpenApi"; | ||
const convert: (input: OpenApiV3.IDocument) => OpenApi.IDocument; | ||
const convertComponents: (input: OpenApiV3.IComponents) => OpenApi.IComponents; | ||
const convertSchema: (input: OpenApiV3.IJsonSchema) => OpenApi.IJsonSchema; | ||
} |
@@ -8,3 +8,3 @@ "use strict"; | ||
var _a; | ||
return (Object.assign(Object.assign({}, input), { components: convertComponents((_a = input.components) !== null && _a !== void 0 ? _a : {}), paths: input.paths | ||
return (Object.assign(Object.assign({}, input), { components: OpenApiV3Converter.convertComponents((_a = input.components) !== null && _a !== void 0 ? _a : {}), paths: input.paths | ||
? Object.fromEntries(Object.entries(input.paths) | ||
@@ -60,3 +60,3 @@ .filter(([_, v]) => v !== undefined) | ||
}; | ||
const convertParameter = (input) => (Object.assign(Object.assign({}, input), { schema: convertSchema(input.schema) })); | ||
const convertParameter = (input) => (Object.assign(Object.assign({}, input), { schema: OpenApiV3Converter.convertSchema(input.schema) })); | ||
const convertRequestBody = (doc) => (input) => { | ||
@@ -104,3 +104,3 @@ var _a, _b, _c; | ||
key, | ||
Object.assign(Object.assign({}, value), { schema: value.schema ? convertSchema(value.schema) : undefined }), | ||
Object.assign(Object.assign({}, value), { schema: value.schema ? OpenApiV3Converter.convertSchema(value.schema) : undefined }), | ||
])); | ||
@@ -110,11 +110,11 @@ /* ----------------------------------------------------------- | ||
----------------------------------------------------------- */ | ||
const convertComponents = (input) => ({ | ||
OpenApiV3Converter.convertComponents = (input) => ({ | ||
schemas: input.schemas | ||
? Object.fromEntries(Object.entries(input.schemas) | ||
.filter(([_, v]) => v !== undefined) | ||
.map(([key, value]) => [key, convertSchema(value)])) | ||
.map(([key, value]) => [key, OpenApiV3Converter.convertSchema(value)])) | ||
: undefined, | ||
securitySchemes: input.securitySchemes, | ||
}); | ||
const convertSchema = (input) => { | ||
OpenApiV3Converter.convertSchema = (input) => { | ||
const nullable = { value: false }; | ||
@@ -144,3 +144,3 @@ const union = []; | ||
else if (TypeChecker.isArray(schema)) | ||
union.push(Object.assign(Object.assign({}, schema), { items: convertSchema(schema.items) })); | ||
union.push(Object.assign(Object.assign({}, schema), { items: OpenApiV3Converter.convertSchema(schema.items) })); | ||
else if (TypeChecker.isObject(schema)) | ||
@@ -151,3 +151,3 @@ union.push(Object.assign(Object.assign({}, schema), { | ||
.filter(([_, v]) => v !== undefined) | ||
.map(([key, value]) => [key, convertSchema(value)])) | ||
.map(([key, value]) => [key, OpenApiV3Converter.convertSchema(value)])) | ||
: undefined, | ||
@@ -157,3 +157,3 @@ additionalProperties: schema.additionalProperties | ||
schema.additionalProperties !== null | ||
? convertSchema(schema.additionalProperties) | ||
? OpenApiV3Converter.convertSchema(schema.additionalProperties) | ||
: schema.additionalProperties | ||
@@ -160,0 +160,0 @@ : undefined, |
{ | ||
"name": "@samchon/openapi", | ||
"version": "0.1.13", | ||
"version": "0.1.14-dev.20240415", | ||
"description": "OpenAPI definitions and converters for 'typia' and 'nestia'.", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -189,3 +189,3 @@ import { OpenApi } from "../OpenApi"; | ||
----------------------------------------------------------- */ | ||
const convertComponents = ( | ||
export const convertComponents = ( | ||
input: OpenApiV3.IComponents, | ||
@@ -202,3 +202,5 @@ ): OpenApi.IComponents => ({ | ||
}); | ||
const convertSchema = (input: OpenApiV3.IJsonSchema): OpenApi.IJsonSchema => { | ||
export const convertSchema = ( | ||
input: OpenApiV3.IJsonSchema, | ||
): OpenApi.IJsonSchema => { | ||
const nullable: { value: boolean } = { value: false }; | ||
@@ -205,0 +207,0 @@ const union: OpenApi.IJsonSchema[] = []; |
169043
4276