
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
@openapi-integration/schema-resolver
Advanced tools
A tool for resolving openAPI json schema to typescript type definition.
this is a tool for resolving OpenAPI schema.
For the first part, it can convert json format OpenAPI schema to TypeScript type definition.
from
{
"components": {
"schemas": {
"ScheduleVO": {
"type": "object",
"properties": {
"team": {
"type": "string"
},
"schedules": {
"type": "array",
"nullable": true,
"items": {
"type": "array",
"items": {
"$ref": "#/components/schemas/BookVO"
}
}
},
"shiftId": {
"type": "string"
}
},
"title": "ScheduleVO"
},
"BookVO": {
"type": "object",
"properties": {
"price": {
"type": "string"
},
"address": {
"type": "string",
"nullable": true
}
},
"title": "BookVO"
}
}
}
}
to
const definitions = {
ScheduleVO: {
"schedules?": "IBookVo[][] | null",
"shiftId?": "string",
"team?": "string",
},
BookVO: {
"address?": "string | null",
"price?": "string",
},
};
Secondly, it can resolve json OpenAPI 'path' to request params and response material.
These material can help you generate request function you need in your project.
Example:
npm install @openapi-integration/schema-resolver
or
yarn add @openapi-integration/schema-resolver
There are three function in this tool:
SchemaResolver can resolve a OpenAPI schema object as its type:
SchemaResolver.of({
results: {},
schema,
key,
parentKey,
})
.resolve()
.getSchemaType();
"IBookDetailVo"
or
{
"authorName?": "string | null"
}
DefinitionsResolver can organize all resolved schema in OpenAPI.components as interface in TypeScript.
DefinitionsResolver.of(openAPI.components)
.scanDefinitions()
.toDeclarations();
const definitions = DefinitionsResolver
.of(openAPI.components)
.scanDefinitions()
.resolvedDefinitions;
console.log(definitions);
// {
// AttachmentBO: {
// "authorName?": "string",
// "createdDate?": "number",
// "fileName?": "string",
// "id?": "string",
// "mimeType?": "string",
// "path?": "string",
// },
// }
const interfaceStrings = DefinitionsResolver
.of(openAPI.components)
.scanDefinitions()
.toDeclarations()
console.log(interfaceStrings);
// ["export interface IAttachmentBo {\n 'authorName'?: string;\n'createdDate'?: number;\n'fileName'?: string;\n'id'?: string;\n'mimeType'?: string;\n'path'?: string;\n }",]
PathResolver can resolve OpenAPI.paths to object which contain all definition for request.
PathResolver.of(openAPI.paths).resolve();
resolvedPaths:
const resolvedPaths = PathResolver.of(openAPI.paths).resolve().resolvedPaths;
console.log(resolvedPaths);
// [{
// THeader: {
// Authorities: "string",
// "User-Id": "string",
// "User-Name": "string",
// },
// TReq: {
// uploadAttachmentUsingPOSTRequest: {
// attachment: "FormData",
// },
// },
// TResp: "IAttachmentBo",
// bodyParams: [],
// formDataParams: [],
// method: "post",
// operationId: "uploadAttachmentUsingPOST",
// pathParams: [],
// queryParams: [],
// requestBody: "uploadAttachmentUsingPOSTRequest",
// url: "/",
// },]
contentType - contentType for each request:
record - key: operationId, value: contentType
const contentType = PathResolver.of(openAPI.paths).resolve().contentType
console.log(contentType);
// {
// UpdateBookJourneyUsingPOST: "application/json",
// updateBookByIdUsingPUT: "application/json",
// uploadAttachmentUsingPOST: "multipart/form-data",
// uploadDocumentUsingPOST: "multipart/form-data",
// }
extraDefinitions - definitions for enum type
const extraDefinitions = PathResolver.of(openAPI.paths).resolve().extraDefinitions;
console.log(extraDefinitions);
// {
// "FromFrom#EnumTypeSuffix": [
// "AAA",
// "BBB"
// ]
// }
FAQs
A tool for resolving openAPI json schema to typescript type definition.
We found that @openapi-integration/schema-resolver demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.