@mintlify/validation 0.1.32 → 0.1.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/openapi/convertOpenApi.d.ts +1 -27
- package/dist/openapi/convertParameters.d.ts +8 -0
- package/dist/openapi/convertSchema.d.ts +11 -0
- package/dist/openapi/convertSecurity.d.ts +13 -0
- package/dist/openapi/convertServers.d.ts +8 -0
- package/dist/openapi/types/endpoint.d.ts +9 -6
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OpenAPIV3_1 } from 'openapi-types';
|
|
2
|
-
import type { BodySchema, DataSchemaArray, Endpoint, HttpMethod,
|
|
2
|
+
import type { BodySchema, DataSchemaArray, Endpoint, HttpMethod, ResponseSchema } from './types/endpoint';
|
|
3
3
|
export declare class InvalidSchemaError extends Error {
|
|
4
4
|
constructor(message?: string);
|
|
5
5
|
}
|
|
@@ -9,35 +9,9 @@ export declare class ImpossibleSchemaError extends Error {
|
|
|
9
9
|
export declare class ConversionError extends Error {
|
|
10
10
|
constructor(message?: string);
|
|
11
11
|
}
|
|
12
|
-
type ConvertServersParams = OpenAPIV3_1.ServerObject[] | undefined;
|
|
13
|
-
type ConvertServersType = Server[] | undefined;
|
|
14
|
-
export declare const convertServers: (servers: ConvertServersParams) => ConvertServersType;
|
|
15
|
-
type ConvertParametersParams = {
|
|
16
|
-
pathParameters?: OpenAPIV3_1.ParameterObject[];
|
|
17
|
-
operationParameters?: OpenAPIV3_1.ParameterObject[];
|
|
18
|
-
};
|
|
19
|
-
export declare const convertParameters: ({ pathParameters, operationParameters, }: ConvertParametersParams) => ParameterSections;
|
|
20
|
-
export declare const convertSchema: (schema?: OpenAPIV3_1.SchemaObject, required?: boolean) => DataSchemaArray;
|
|
21
|
-
export declare const combineTopLevelSchemas: (schema1: OpenAPIV3_1.SchemaObject, schema2: OpenAPIV3_1.SchemaObject) => OpenAPIV3_1.SchemaObject;
|
|
22
|
-
export declare const convertProperties: (properties?: {
|
|
23
|
-
[key: string]: OpenAPIV3_1.SchemaObject;
|
|
24
|
-
} | undefined, required?: string[]) => {
|
|
25
|
-
[key: string]: DataSchemaArray;
|
|
26
|
-
};
|
|
27
|
-
type ConvertSecurityParams = {
|
|
28
|
-
securityRequirements?: OpenAPIV3_1.SecurityRequirementObject[];
|
|
29
|
-
securitySchemes: OpenAPIV3_1.ComponentsObject['securitySchemes'];
|
|
30
|
-
};
|
|
31
|
-
export declare const convertSecurity: ({ securityRequirements, securitySchemes, }: ConvertSecurityParams) => SecurityOption[];
|
|
32
|
-
type AddSecurityParametersParams = {
|
|
33
|
-
securityScheme: OpenAPIV3_1.SecuritySchemeObject;
|
|
34
|
-
parameterSections: SecurityOption;
|
|
35
|
-
};
|
|
36
|
-
export declare const addSecurityParameters: ({ securityScheme, parameterSections, }: AddSecurityParametersParams) => void;
|
|
37
12
|
export declare const convertBody: (body?: OpenAPIV3_1.RequestBodyObject) => BodySchema;
|
|
38
13
|
export declare const convertResponses: (responses: OpenAPIV3_1.ResponsesObject) => ResponseSchema;
|
|
39
14
|
export declare const convertResponse: (response: OpenAPIV3_1.ResponseObject) => {
|
|
40
15
|
[contentType: string]: DataSchemaArray;
|
|
41
16
|
};
|
|
42
17
|
export declare const convertOpenAPIV3_1ToEndpoint: (spec: OpenAPIV3_1.Document, path: string, method: HttpMethod) => Endpoint | undefined;
|
|
43
|
-
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { OpenAPIV3_1 } from 'openapi-types';
|
|
2
|
+
import { ParameterSections } from './types/endpoint';
|
|
3
|
+
type ConvertParametersParams = {
|
|
4
|
+
pathParameters?: OpenAPIV3_1.ParameterObject[];
|
|
5
|
+
operationParameters?: OpenAPIV3_1.ParameterObject[];
|
|
6
|
+
};
|
|
7
|
+
export declare const convertParameters: ({ pathParameters, operationParameters, }: ConvertParametersParams) => ParameterSections;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { OpenAPIV3_1 } from 'openapi-types';
|
|
2
|
+
import { DataSchemaArray } from './types/endpoint';
|
|
3
|
+
export declare const convertSchema: (schema?: OpenAPIV3_1.SchemaObject, required?: boolean) => DataSchemaArray;
|
|
4
|
+
export declare const combineTopLevelSchemas: (schema1: OpenAPIV3_1.SchemaObject, schema2: OpenAPIV3_1.SchemaObject) => OpenAPIV3_1.SchemaObject;
|
|
5
|
+
export declare const addKeyIfDefined: <D, K extends keyof D>(key: K, value: D[K], destination: D) => void;
|
|
6
|
+
export declare const copyKeyIfDefined: <D, K extends keyof D>(key: K, source: Pick<D, K>, destination: D) => void;
|
|
7
|
+
export declare const convertProperties: (properties?: {
|
|
8
|
+
[key: string]: OpenAPIV3_1.SchemaObject;
|
|
9
|
+
} | undefined, required?: string[]) => {
|
|
10
|
+
[key: string]: DataSchemaArray;
|
|
11
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { OpenAPIV3_1 } from 'openapi-types';
|
|
2
|
+
import { SecurityOption } from './types/endpoint';
|
|
3
|
+
type ConvertSecurityParams = {
|
|
4
|
+
securityRequirements?: OpenAPIV3_1.SecurityRequirementObject[];
|
|
5
|
+
securitySchemes: OpenAPIV3_1.ComponentsObject['securitySchemes'];
|
|
6
|
+
};
|
|
7
|
+
export declare const convertSecurity: ({ securityRequirements, securitySchemes, }: ConvertSecurityParams) => SecurityOption[];
|
|
8
|
+
type AddSecurityParametersParams = {
|
|
9
|
+
securityScheme: OpenAPIV3_1.SecuritySchemeObject;
|
|
10
|
+
parameterSections: SecurityOption;
|
|
11
|
+
};
|
|
12
|
+
export declare const addSecurityParameters: ({ securityScheme, parameterSections, }: AddSecurityParametersParams) => void;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { OpenAPIV3_1 } from 'openapi-types';
|
|
2
|
+
import { Server } from './types/endpoint';
|
|
3
|
+
type ConvertServersParams = {
|
|
4
|
+
servers?: OpenAPIV3_1.ServerObject[];
|
|
5
|
+
};
|
|
6
|
+
type ConvertServersType = Server[] | undefined;
|
|
7
|
+
export declare const convertServers: ({ servers }: ConvertServersParams) => ConvertServersType;
|
|
8
|
+
export {};
|
|
@@ -26,7 +26,7 @@ export type ServerVariableStringEnumSchema = {
|
|
|
26
26
|
default: string;
|
|
27
27
|
description?: string;
|
|
28
28
|
};
|
|
29
|
-
export type HttpMethod =
|
|
29
|
+
export type HttpMethod = 'get' | 'put' | 'post' | 'delete' | 'options' | 'head' | 'patch' | 'trace';
|
|
30
30
|
export type RequestSchema = {
|
|
31
31
|
security: SecurityOption[];
|
|
32
32
|
parameters: ParameterSections;
|
|
@@ -39,9 +39,9 @@ export type BodySchema = {
|
|
|
39
39
|
[contentType: string]: DataSchemaArray;
|
|
40
40
|
};
|
|
41
41
|
export type ParameterSchema = {
|
|
42
|
-
required
|
|
42
|
+
required?: boolean;
|
|
43
43
|
description?: string;
|
|
44
|
-
deprecated
|
|
44
|
+
deprecated?: boolean;
|
|
45
45
|
schema: DataSchemaArray | 'basic' | 'bearer';
|
|
46
46
|
};
|
|
47
47
|
export type PathParameterSchema = ParameterSchema & {
|
|
@@ -63,9 +63,9 @@ export type ResponseSchema = {
|
|
|
63
63
|
[code: string]: BodySchema;
|
|
64
64
|
};
|
|
65
65
|
export type DataSchemaArray = [DataSchema, ...DataSchema[]];
|
|
66
|
-
export declare const typeList: readonly ["boolean", "string", "number", "integer", "object", "array", "stringEnum", "numberEnum", "integerEnum", "null"];
|
|
67
|
-
export type SchemaType = typeof typeList[number];
|
|
68
|
-
export type DataSchema = BooleanSchema | StringSchema | NumberSchema | ObjectSchema | ArraySchema | StringEnumSchema | NumberEnumSchema | NullSchema;
|
|
66
|
+
export declare const typeList: readonly ["boolean", "string", "number", "integer", "object", "array", "stringEnum", "numberEnum", "integerEnum", "null", "any"];
|
|
67
|
+
export type SchemaType = (typeof typeList)[number];
|
|
68
|
+
export type DataSchema = BooleanSchema | StringSchema | NumberSchema | ObjectSchema | ArraySchema | StringEnumSchema | NumberEnumSchema | NullSchema | AnySchema;
|
|
69
69
|
export type BaseSchema<T> = {
|
|
70
70
|
type: SchemaType;
|
|
71
71
|
title?: string;
|
|
@@ -122,4 +122,7 @@ export type NumberEnumSchema = {
|
|
|
122
122
|
export type NullSchema = {
|
|
123
123
|
type: 'null';
|
|
124
124
|
} & BaseSchema<null>;
|
|
125
|
+
export type AnySchema = {
|
|
126
|
+
type: 'any';
|
|
127
|
+
} & BaseSchema<unknown>;
|
|
125
128
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintlify/validation",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.34",
|
|
4
4
|
"description": "Validates mint.json files",
|
|
5
5
|
"author": "Mintlify, Inc.",
|
|
6
6
|
"repository": {
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"webpack": "^5.75.0",
|
|
69
69
|
"webpack-cli": "^5.0.1"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "76e1d446955886479af2cec8fbdbd3b5b1ae60e4"
|
|
72
72
|
}
|