UNPKG

openapi-ts-json-schema

Version:

OpenAPI to JSON schema generator with TypeScript in mind

28 lines (27 loc) 709 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isOpenApiParameterObject = void 0; const _1 = require("."); const PARAMETERS_IN_VALUES = [ 'query', 'path', 'header', 'cookie', // oas 2 parameters 'formData', 'body', ]; /** * Detect OpenAPI parameters * https://swagger.io/docs/specification/describing-parameters/ */ function isOpenApiParameterObject(schema) { if ((0, _1.isObject)(schema) && typeof schema.name === 'string' && typeof schema.in === 'string' && PARAMETERS_IN_VALUES.includes(schema.in)) { return true; } return false; } exports.isOpenApiParameterObject = isOpenApiParameterObject;