openapi-modifier
Version:
This package allows you to automate the process of modifying OpenAPI specifications by applying a set of predefined rules
69 lines (68 loc) • 3.29 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.operationIdConfigSchema = exports.anyEndpointDescriptorConfigSchema = exports.endpointDescriptorConfigSchema = exports.simpleEndpointDescriptorConfigSchema = exports.endpointResponseDescriptorConfigSchema = exports.anyComponentDescriptorConfigSchema = exports.componentDescriptorConfigSchema = exports.simpleComponentDescriptorConfigSchema = exports.anyComponentWithCorrectionDescriptorConfigSchema = exports.componentWithCorrectionDescriptorConfigSchema = exports.simpleComponentWithCorrectionDescriptorConfigSchema = exports.parameterDescriptorConfigSchema = exports.endpointParameterWithCorrectionDescriptorConfigSchema = exports.endpointParameterDescriptorConfigSchema = exports.correctionConfigSchema = exports.parameterInConfigSchema = exports.openAPISchemaConfigSchema = exports.patchMethodConfigSchema = void 0;
const zod_1 = require("zod");
exports.patchMethodConfigSchema = zod_1.z.union([zod_1.z.literal('deepmerge'), zod_1.z.literal('merge')]);
exports.openAPISchemaConfigSchema = zod_1.z.any();
exports.parameterInConfigSchema = zod_1.z.union([zod_1.z.literal('query'), zod_1.z.literal('header'), zod_1.z.literal('path'), zod_1.z.literal('cookie')]);
exports.correctionConfigSchema = zod_1.z.string();
exports.endpointParameterDescriptorConfigSchema = zod_1.z
.object({
name: zod_1.z.string(),
in: exports.parameterInConfigSchema,
})
.strict();
exports.endpointParameterWithCorrectionDescriptorConfigSchema = zod_1.z
.object({
name: zod_1.z.string(),
in: exports.parameterInConfigSchema,
correction: exports.correctionConfigSchema.optional(),
})
.strict();
exports.parameterDescriptorConfigSchema = zod_1.z
.object({
path: zod_1.z.string(),
method: zod_1.z.string(),
name: zod_1.z.string(),
in: exports.parameterInConfigSchema,
})
.strict();
exports.simpleComponentWithCorrectionDescriptorConfigSchema = zod_1.z.string();
exports.componentWithCorrectionDescriptorConfigSchema = zod_1.z
.object({
componentName: zod_1.z.string(),
correction: exports.correctionConfigSchema.optional(),
})
.strict();
exports.anyComponentWithCorrectionDescriptorConfigSchema = zod_1.z.union([
exports.simpleComponentWithCorrectionDescriptorConfigSchema,
exports.componentWithCorrectionDescriptorConfigSchema,
]);
exports.simpleComponentDescriptorConfigSchema = zod_1.z.string();
exports.componentDescriptorConfigSchema = zod_1.z
.object({
componentName: zod_1.z.string(),
})
.strict();
exports.anyComponentDescriptorConfigSchema = zod_1.z.union([
exports.simpleComponentDescriptorConfigSchema,
exports.componentDescriptorConfigSchema,
]);
exports.endpointResponseDescriptorConfigSchema = zod_1.z
.object({
code: zod_1.z.string(),
contentType: zod_1.z.string(),
})
.strict();
exports.simpleEndpointDescriptorConfigSchema = zod_1.z.string();
exports.endpointDescriptorConfigSchema = zod_1.z
.object({
path: zod_1.z.string(),
method: zod_1.z.string(),
})
.strict();
exports.anyEndpointDescriptorConfigSchema = zod_1.z.union([
exports.endpointDescriptorConfigSchema,
exports.simpleEndpointDescriptorConfigSchema,
]);
exports.operationIdConfigSchema = zod_1.z.string();