@mintlify/validation 0.1.39 → 0.1.41
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/LICENSE +21 -21
- package/README.md +55 -55
- package/dist/index.d.ts +11 -6
- package/dist/index.js +1 -1
- package/dist/mint-config/common.d.ts +6 -6
- package/dist/mint-config/flattenUnionErrorMessages.d.ts +7 -7
- package/dist/mint-config/hexadecimalPattern.d.ts +1 -1
- package/dist/mint-config/schemas/analytics.d.ts +171 -171
- package/dist/mint-config/schemas/anchorColors.d.ts +14 -14
- package/dist/mint-config/schemas/anchors.d.ts +46 -46
- package/dist/mint-config/schemas/colors.d.ts +61 -61
- package/dist/mint-config/schemas/config.d.ts +816 -798
- package/dist/mint-config/schemas/favicon.d.ts +2 -2
- package/dist/mint-config/schemas/name.d.ts +2 -2
- package/dist/mint-config/schemas/navigation.d.ts +3 -3
- package/dist/mint-config/schemas/tabs.d.ts +11 -11
- package/dist/mint-config/schemas/versions.d.ts +11 -11
- package/dist/mint-config/types/analytics.d.ts +3 -3
- package/dist/mint-config/types/anchors.d.ts +4 -3
- package/dist/mint-config/types/colors.d.ts +3 -3
- package/dist/mint-config/types/config.d.ts +3 -3
- package/dist/mint-config/types/navigation.d.ts +6 -6
- package/dist/mint-config/types/versions.d.ts +3 -3
- package/dist/mint-config/validateAnchorsWarnings.d.ts +4 -4
- package/dist/mint-config/validateVersionsInNavigation.d.ts +5 -5
- package/dist/openapi/convertOpenApi.d.ts +18 -18
- package/dist/openapi/convertParameters.d.ts +9 -9
- package/dist/openapi/convertSchema.d.ts +11 -11
- package/dist/openapi/convertSecurity.d.ts +14 -14
- package/dist/openapi/convertServers.d.ts +8 -8
- package/dist/openapi/types/endpoint.d.ts +128 -128
- package/dist/schemas/analytics.d.ts +171 -0
- package/dist/schemas/anchorColors.d.ts +14 -0
- package/dist/schemas/anchors.d.ts +46 -0
- package/dist/schemas/colors.d.ts +61 -0
- package/dist/schemas/config.d.ts +799 -0
- package/dist/schemas/favicon.d.ts +2 -0
- package/dist/schemas/name.d.ts +2 -0
- package/dist/schemas/navigation.d.ts +3 -0
- package/dist/schemas/tabs.d.ts +11 -0
- package/dist/schemas/versions.d.ts +11 -0
- package/dist/types/analytics.d.ts +3 -0
- package/dist/types/anchors.d.ts +3 -0
- package/dist/types/colors.d.ts +3 -0
- package/dist/types/config.d.ts +3 -0
- package/dist/types/endpoint.d.ts +125 -0
- package/dist/types/navigation.d.ts +6 -0
- package/dist/types/versions.d.ts +3 -0
- package/dist/utils/common.d.ts +6 -0
- package/dist/utils/convertOpenApi.d.ts +43 -0
- package/dist/utils/flattenUnionErrorMessages.d.ts +7 -0
- package/dist/utils/hexadecimalPattern.d.ts +1 -0
- package/dist/utils/validateAnchorsWarnings.d.ts +4 -0
- package/dist/utils/validateVersionsInNavigation.d.ts +5 -0
- package/package.json +75 -72
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { z } from
|
|
2
|
-
export declare const faviconSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const faviconSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { z } from
|
|
2
|
-
export declare const nameSchema: z.ZodString;
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const nameSchema: z.ZodString;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { NavigationType } from '../types/navigation';
|
|
3
|
-
export declare const navigationConfigSchema: z.ZodArray<z.ZodType<NavigationType, z.ZodTypeDef, NavigationType>, "many">;
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { NavigationType } from '../types/navigation';
|
|
3
|
+
export declare const navigationConfigSchema: z.ZodArray<z.ZodType<NavigationType, z.ZodTypeDef, NavigationType>, "many">;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const tabsSchema: z.ZodArray<z.ZodObject<{
|
|
3
|
-
name: z.ZodString;
|
|
4
|
-
url: z.ZodString;
|
|
5
|
-
}, "strip", z.ZodTypeAny, {
|
|
6
|
-
name: string;
|
|
7
|
-
url: string;
|
|
8
|
-
}, {
|
|
9
|
-
name: string;
|
|
10
|
-
url: string;
|
|
11
|
-
}>, "many">;
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const tabsSchema: z.ZodArray<z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
url: z.ZodString;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
name: string;
|
|
7
|
+
url: string;
|
|
8
|
+
}, {
|
|
9
|
+
name: string;
|
|
10
|
+
url: string;
|
|
11
|
+
}>, "many">;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const versionsSchema: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
3
|
-
name: z.ZodString;
|
|
4
|
-
url: z.ZodString;
|
|
5
|
-
}, "strict", z.ZodTypeAny, {
|
|
6
|
-
name: string;
|
|
7
|
-
url: string;
|
|
8
|
-
}, {
|
|
9
|
-
name: string;
|
|
10
|
-
url: string;
|
|
11
|
-
}>]>, "many">;
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const versionsSchema: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
url: z.ZodString;
|
|
5
|
+
}, "strict", z.ZodTypeAny, {
|
|
6
|
+
name: string;
|
|
7
|
+
url: string;
|
|
8
|
+
}, {
|
|
9
|
+
name: string;
|
|
10
|
+
url: string;
|
|
11
|
+
}>]>, "many">;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { analyticsSchema } from '../schemas/analytics';
|
|
3
|
-
export type AnalyticsType = z.infer<typeof analyticsSchema>;
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { analyticsSchema } from '../schemas/analytics';
|
|
3
|
+
export type AnalyticsType = z.infer<typeof analyticsSchema>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { anchorsSchema } from '../schemas/anchors';
|
|
3
|
-
export type AnchorsType = z.infer<typeof anchorsSchema>;
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { anchorsSchema } from '../schemas/anchors';
|
|
3
|
+
export type AnchorsType = z.infer<typeof anchorsSchema>;
|
|
4
|
+
export type AnchorType = AnchorsType[0];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { colorsSchema } from '../schemas/colors';
|
|
3
|
-
export type ColorsType = z.infer<typeof colorsSchema>;
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { colorsSchema } from '../schemas/colors';
|
|
3
|
+
export type ColorsType = z.infer<typeof colorsSchema>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { configSchema } from '../schemas/config';
|
|
3
|
-
export type ConfigType = z.infer<typeof configSchema>;
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { configSchema } from '../schemas/config';
|
|
3
|
+
export type ConfigType = z.infer<typeof configSchema>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export type NavigationEntry = string | NavigationType;
|
|
2
|
-
export type NavigationType = {
|
|
3
|
-
group: string;
|
|
4
|
-
pages: NavigationEntry[];
|
|
5
|
-
version?: string;
|
|
6
|
-
};
|
|
1
|
+
export type NavigationEntry = string | NavigationType;
|
|
2
|
+
export type NavigationType = {
|
|
3
|
+
group: string;
|
|
4
|
+
pages: NavigationEntry[];
|
|
5
|
+
version?: string;
|
|
6
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { versionsSchema } from '../schemas/versions';
|
|
3
|
-
export type VersionsType = z.infer<typeof versionsSchema>;
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { versionsSchema } from '../schemas/versions';
|
|
3
|
+
export type VersionsType = z.infer<typeof versionsSchema>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MintValidationResults } from './common';
|
|
2
|
-
import { AnchorsType } from './types/anchors';
|
|
3
|
-
import { NavigationType } from './types/navigation';
|
|
4
|
-
export declare function validateAnchorsWarnings(anchors: AnchorsType | undefined, navigation: NavigationType[] | undefined): MintValidationResults;
|
|
1
|
+
import { MintValidationResults } from './common';
|
|
2
|
+
import { AnchorsType } from './types/anchors';
|
|
3
|
+
import { NavigationType } from './types/navigation';
|
|
4
|
+
export declare function validateAnchorsWarnings(anchors: AnchorsType | undefined, navigation: NavigationType[] | undefined): MintValidationResults;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MintValidationResults } from './common';
|
|
2
|
-
import { NavigationEntry, NavigationType } from './types/navigation';
|
|
3
|
-
import { VersionsType } from './types/versions';
|
|
4
|
-
export declare function flattenNavigationVersions(nav: NavigationEntry[], versions?: string[]): string[];
|
|
5
|
-
export declare function validateVersionsInNavigation(navigation: NavigationType[] | undefined, versions?: VersionsType | undefined): MintValidationResults;
|
|
1
|
+
import { MintValidationResults } from './common';
|
|
2
|
+
import { NavigationEntry, NavigationType } from './types/navigation';
|
|
3
|
+
import { VersionsType } from './types/versions';
|
|
4
|
+
export declare function flattenNavigationVersions(nav: NavigationEntry[], versions?: string[]): string[];
|
|
5
|
+
export declare function validateVersionsInNavigation(navigation: NavigationType[] | undefined, versions?: VersionsType | undefined): MintValidationResults;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { OpenAPIV3_1 } from 'openapi-types';
|
|
2
|
-
import type { BodySchema, DataSchemaArray, Endpoint, HttpMethod, ResponseSchema } from './types/endpoint';
|
|
3
|
-
export declare const generateMessage: (path: string[], messages?: string[]) => string;
|
|
4
|
-
export declare class InvalidSchemaError extends Error {
|
|
5
|
-
constructor(path: string[], ...messages: string[]);
|
|
6
|
-
}
|
|
7
|
-
export declare class ImpossibleSchemaError extends Error {
|
|
8
|
-
constructor(path: string[], ...messages: string[]);
|
|
9
|
-
}
|
|
10
|
-
export declare class ConversionError extends Error {
|
|
11
|
-
constructor(path: string[], ...messages: string[]);
|
|
12
|
-
}
|
|
13
|
-
export declare const convertBody: (path: string[], body: OpenAPIV3_1.RequestBodyObject | undefined) => BodySchema;
|
|
14
|
-
export declare const convertResponses: (path: string[], responses: OpenAPIV3_1.ResponsesObject) => ResponseSchema;
|
|
15
|
-
export declare const convertResponse: (path: string[], response: OpenAPIV3_1.ResponseObject) => {
|
|
16
|
-
[contentType: string]: DataSchemaArray;
|
|
17
|
-
};
|
|
18
|
-
export declare const convertOpenAPIV3_1ToEndpoint: (spec: OpenAPIV3_1.Document, path: string, method: HttpMethod) => Endpoint | undefined;
|
|
1
|
+
import { OpenAPIV3_1 } from 'openapi-types';
|
|
2
|
+
import type { BodySchema, DataSchemaArray, Endpoint, HttpMethod, ResponseSchema } from './types/endpoint';
|
|
3
|
+
export declare const generateMessage: (path: string[], messages?: string[]) => string;
|
|
4
|
+
export declare class InvalidSchemaError extends Error {
|
|
5
|
+
constructor(path: string[], ...messages: string[]);
|
|
6
|
+
}
|
|
7
|
+
export declare class ImpossibleSchemaError extends Error {
|
|
8
|
+
constructor(path: string[], ...messages: string[]);
|
|
9
|
+
}
|
|
10
|
+
export declare class ConversionError extends Error {
|
|
11
|
+
constructor(path: string[], ...messages: string[]);
|
|
12
|
+
}
|
|
13
|
+
export declare const convertBody: (path: string[], body: OpenAPIV3_1.RequestBodyObject | undefined) => BodySchema;
|
|
14
|
+
export declare const convertResponses: (path: string[], responses: OpenAPIV3_1.ResponsesObject) => ResponseSchema;
|
|
15
|
+
export declare const convertResponse: (path: string[], response: OpenAPIV3_1.ResponseObject) => {
|
|
16
|
+
[contentType: string]: DataSchemaArray;
|
|
17
|
+
};
|
|
18
|
+
export declare const convertOpenAPIV3_1ToEndpoint: (spec: OpenAPIV3_1.Document, path: string, method: HttpMethod) => Endpoint | undefined;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { OpenAPIV3_1 } from 'openapi-types';
|
|
2
|
-
import { ParameterSections } from './types/endpoint';
|
|
3
|
-
export type ConvertParametersParams = {
|
|
4
|
-
path: string[];
|
|
5
|
-
method: string;
|
|
6
|
-
pathParameters: OpenAPIV3_1.ParameterObject[] | undefined;
|
|
7
|
-
operationParameters: OpenAPIV3_1.ParameterObject[] | undefined;
|
|
8
|
-
};
|
|
9
|
-
export declare const convertParameters: ({ path, method, pathParameters, operationParameters, }: ConvertParametersParams) => ParameterSections;
|
|
1
|
+
import { OpenAPIV3_1 } from 'openapi-types';
|
|
2
|
+
import { ParameterSections } from './types/endpoint';
|
|
3
|
+
export type ConvertParametersParams = {
|
|
4
|
+
path: string[];
|
|
5
|
+
method: string;
|
|
6
|
+
pathParameters: OpenAPIV3_1.ParameterObject[] | undefined;
|
|
7
|
+
operationParameters: OpenAPIV3_1.ParameterObject[] | undefined;
|
|
8
|
+
};
|
|
9
|
+
export declare const convertParameters: ({ path, method, pathParameters, operationParameters, }: ConvertParametersParams) => ParameterSections;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { OpenAPIV3_1 } from 'openapi-types';
|
|
2
|
-
import { DataSchemaArray } from './types/endpoint';
|
|
3
|
-
export declare const convertSchema: (path: string[], schema: OpenAPIV3_1.SchemaObject | undefined, required?: boolean) => DataSchemaArray;
|
|
4
|
-
export declare const combineTopLevelSchemas: (path: string[], 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: (path: string[], properties: {
|
|
8
|
-
[key: string]: OpenAPIV3_1.SchemaObject;
|
|
9
|
-
} | undefined, required?: string[]) => {
|
|
10
|
-
[key: string]: DataSchemaArray;
|
|
11
|
-
};
|
|
1
|
+
import { OpenAPIV3_1 } from 'openapi-types';
|
|
2
|
+
import { DataSchemaArray } from './types/endpoint';
|
|
3
|
+
export declare const convertSchema: (path: string[], schema: OpenAPIV3_1.SchemaObject | undefined, required?: boolean) => DataSchemaArray;
|
|
4
|
+
export declare const combineTopLevelSchemas: (path: string[], 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: (path: string[], properties: {
|
|
8
|
+
[key: string]: OpenAPIV3_1.SchemaObject;
|
|
9
|
+
} | undefined, required?: string[]) => {
|
|
10
|
+
[key: string]: DataSchemaArray;
|
|
11
|
+
};
|
|
@@ -1,14 +1,14 @@
|
|
|
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
|
-
securityName: string;
|
|
10
|
-
securityScheme: OpenAPIV3_1.SecuritySchemeObject;
|
|
11
|
-
parameterSections: SecurityOption;
|
|
12
|
-
};
|
|
13
|
-
export declare const addSecurityParameters: ({ securityName, securityScheme, parameterSections, }: AddSecurityParametersParams) => void;
|
|
14
|
-
export {};
|
|
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
|
+
securityName: string;
|
|
10
|
+
securityScheme: OpenAPIV3_1.SecuritySchemeObject;
|
|
11
|
+
parameterSections: SecurityOption;
|
|
12
|
+
};
|
|
13
|
+
export declare const addSecurityParameters: ({ securityName, securityScheme, parameterSections, }: AddSecurityParametersParams) => void;
|
|
14
|
+
export {};
|
|
@@ -1,8 +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 {};
|
|
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 {};
|
|
@@ -1,128 +1,128 @@
|
|
|
1
|
-
export type Endpoint = {
|
|
2
|
-
description?: string;
|
|
3
|
-
path: string;
|
|
4
|
-
method: HttpMethod;
|
|
5
|
-
servers?: Server[];
|
|
6
|
-
request: RequestSchema;
|
|
7
|
-
response: ResponseSchema;
|
|
8
|
-
deprecated: boolean;
|
|
9
|
-
};
|
|
10
|
-
export type Server = {
|
|
11
|
-
url: string;
|
|
12
|
-
description?: string;
|
|
13
|
-
variables?: {
|
|
14
|
-
[variableName: string]: ServerVariableSchema;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
export type ServerVariableSchema = ServerVariableStringSchema | ServerVariableStringEnumSchema;
|
|
18
|
-
export type ServerVariableStringSchema = {
|
|
19
|
-
type: 'string';
|
|
20
|
-
default: string;
|
|
21
|
-
description?: string;
|
|
22
|
-
};
|
|
23
|
-
export type ServerVariableStringEnumSchema = {
|
|
24
|
-
type: 'stringEnum';
|
|
25
|
-
enum: string[];
|
|
26
|
-
default: string;
|
|
27
|
-
description?: string;
|
|
28
|
-
};
|
|
29
|
-
export type HttpMethod = 'get' | 'put' | 'post' | 'delete' | 'options' | 'head' | 'patch' | 'trace';
|
|
30
|
-
export type RequestSchema = {
|
|
31
|
-
security: SecurityOption[];
|
|
32
|
-
parameters: ParameterSections;
|
|
33
|
-
body: BodySchema;
|
|
34
|
-
};
|
|
35
|
-
export type SecurityOption = NonPathParameterSections & {
|
|
36
|
-
title: string;
|
|
37
|
-
};
|
|
38
|
-
export type BodySchema = {
|
|
39
|
-
[contentType: string]: DataSchemaArray;
|
|
40
|
-
};
|
|
41
|
-
export type ParameterSchema = {
|
|
42
|
-
required?: boolean;
|
|
43
|
-
description?: string;
|
|
44
|
-
deprecated?: boolean;
|
|
45
|
-
schema: DataSchemaArray | 'basic' | 'bearer';
|
|
46
|
-
};
|
|
47
|
-
export type PathParameterSchema = ParameterSchema & {
|
|
48
|
-
required: true;
|
|
49
|
-
};
|
|
50
|
-
export type ParameterGroup = {
|
|
51
|
-
[name: string]: ParameterSchema;
|
|
52
|
-
};
|
|
53
|
-
export type PathParameterGroup = {
|
|
54
|
-
[name: string]: PathParameterSchema;
|
|
55
|
-
};
|
|
56
|
-
type NonPathParameterLocations = 'query' | 'header' | 'cookie';
|
|
57
|
-
type PathParameterLocations = 'path';
|
|
58
|
-
export type ParameterLocations = NonPathParameterLocations | PathParameterLocations;
|
|
59
|
-
type NonPathParameterSections = Record<NonPathParameterLocations, ParameterGroup>;
|
|
60
|
-
type PathParameterSections = Record<PathParameterLocations, PathParameterGroup>;
|
|
61
|
-
export type ParameterSections = NonPathParameterSections & PathParameterSections;
|
|
62
|
-
export type ResponseSchema = {
|
|
63
|
-
[code: string]: BodySchema;
|
|
64
|
-
};
|
|
65
|
-
export type DataSchemaArray = [DataSchema, ...DataSchema[]];
|
|
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
|
-
export type BaseSchema<T> = {
|
|
70
|
-
type: SchemaType;
|
|
71
|
-
title?: string;
|
|
72
|
-
description?: string;
|
|
73
|
-
default?: T;
|
|
74
|
-
example?: T;
|
|
75
|
-
required?: boolean;
|
|
76
|
-
readOnly?: boolean;
|
|
77
|
-
writeOnly?: boolean;
|
|
78
|
-
deprecated?: boolean;
|
|
79
|
-
};
|
|
80
|
-
export type BooleanSchema = {
|
|
81
|
-
type: 'boolean';
|
|
82
|
-
} & BaseSchema<boolean>;
|
|
83
|
-
export type StringSchema = {
|
|
84
|
-
type: 'string';
|
|
85
|
-
format?: string;
|
|
86
|
-
pattern?: string;
|
|
87
|
-
maxLength?: number;
|
|
88
|
-
minLength?: number;
|
|
89
|
-
} & BaseSchema<string>;
|
|
90
|
-
export type NumberSchema = {
|
|
91
|
-
type: 'number' | 'integer';
|
|
92
|
-
multipleOf?: number;
|
|
93
|
-
maximum?: number;
|
|
94
|
-
exclusiveMaximum?: boolean;
|
|
95
|
-
minimum?: number;
|
|
96
|
-
exclusiveMinimum?: boolean;
|
|
97
|
-
} & BaseSchema<number>;
|
|
98
|
-
export type ObjectSchema = {
|
|
99
|
-
type: 'object';
|
|
100
|
-
additionalProperties?: boolean | DataSchemaArray;
|
|
101
|
-
maxProperties?: number;
|
|
102
|
-
minProperties?: number;
|
|
103
|
-
properties: {
|
|
104
|
-
[key: string]: DataSchemaArray;
|
|
105
|
-
};
|
|
106
|
-
} & BaseSchema<object>;
|
|
107
|
-
export type ArraySchema = {
|
|
108
|
-
type: 'array';
|
|
109
|
-
items: DataSchemaArray;
|
|
110
|
-
maxItems?: number;
|
|
111
|
-
minItems?: number;
|
|
112
|
-
uniqueItems?: boolean;
|
|
113
|
-
} & BaseSchema<unknown[]>;
|
|
114
|
-
export type StringEnumSchema = {
|
|
115
|
-
type: 'stringEnum';
|
|
116
|
-
enum: string[];
|
|
117
|
-
} & BaseSchema<string>;
|
|
118
|
-
export type NumberEnumSchema = {
|
|
119
|
-
type: 'numberEnum' | 'integerEnum';
|
|
120
|
-
enum: number[];
|
|
121
|
-
} & BaseSchema<number>;
|
|
122
|
-
export type NullSchema = {
|
|
123
|
-
type: 'null';
|
|
124
|
-
} & BaseSchema<null>;
|
|
125
|
-
export type AnySchema = {
|
|
126
|
-
type: 'any';
|
|
127
|
-
} & BaseSchema<unknown>;
|
|
128
|
-
export {};
|
|
1
|
+
export type Endpoint = {
|
|
2
|
+
description?: string;
|
|
3
|
+
path: string;
|
|
4
|
+
method: HttpMethod;
|
|
5
|
+
servers?: Server[];
|
|
6
|
+
request: RequestSchema;
|
|
7
|
+
response: ResponseSchema;
|
|
8
|
+
deprecated: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type Server = {
|
|
11
|
+
url: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
variables?: {
|
|
14
|
+
[variableName: string]: ServerVariableSchema;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export type ServerVariableSchema = ServerVariableStringSchema | ServerVariableStringEnumSchema;
|
|
18
|
+
export type ServerVariableStringSchema = {
|
|
19
|
+
type: 'string';
|
|
20
|
+
default: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
};
|
|
23
|
+
export type ServerVariableStringEnumSchema = {
|
|
24
|
+
type: 'stringEnum';
|
|
25
|
+
enum: string[];
|
|
26
|
+
default: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
};
|
|
29
|
+
export type HttpMethod = 'get' | 'put' | 'post' | 'delete' | 'options' | 'head' | 'patch' | 'trace';
|
|
30
|
+
export type RequestSchema = {
|
|
31
|
+
security: SecurityOption[];
|
|
32
|
+
parameters: ParameterSections;
|
|
33
|
+
body: BodySchema;
|
|
34
|
+
};
|
|
35
|
+
export type SecurityOption = NonPathParameterSections & {
|
|
36
|
+
title: string;
|
|
37
|
+
};
|
|
38
|
+
export type BodySchema = {
|
|
39
|
+
[contentType: string]: DataSchemaArray;
|
|
40
|
+
};
|
|
41
|
+
export type ParameterSchema = {
|
|
42
|
+
required?: boolean;
|
|
43
|
+
description?: string;
|
|
44
|
+
deprecated?: boolean;
|
|
45
|
+
schema: DataSchemaArray | 'basic' | 'bearer';
|
|
46
|
+
};
|
|
47
|
+
export type PathParameterSchema = ParameterSchema & {
|
|
48
|
+
required: true;
|
|
49
|
+
};
|
|
50
|
+
export type ParameterGroup = {
|
|
51
|
+
[name: string]: ParameterSchema;
|
|
52
|
+
};
|
|
53
|
+
export type PathParameterGroup = {
|
|
54
|
+
[name: string]: PathParameterSchema;
|
|
55
|
+
};
|
|
56
|
+
type NonPathParameterLocations = 'query' | 'header' | 'cookie';
|
|
57
|
+
type PathParameterLocations = 'path';
|
|
58
|
+
export type ParameterLocations = NonPathParameterLocations | PathParameterLocations;
|
|
59
|
+
type NonPathParameterSections = Record<NonPathParameterLocations, ParameterGroup>;
|
|
60
|
+
type PathParameterSections = Record<PathParameterLocations, PathParameterGroup>;
|
|
61
|
+
export type ParameterSections = NonPathParameterSections & PathParameterSections;
|
|
62
|
+
export type ResponseSchema = {
|
|
63
|
+
[code: string]: BodySchema;
|
|
64
|
+
};
|
|
65
|
+
export type DataSchemaArray = [DataSchema, ...DataSchema[]];
|
|
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
|
+
export type BaseSchema<T> = {
|
|
70
|
+
type: SchemaType;
|
|
71
|
+
title?: string;
|
|
72
|
+
description?: string;
|
|
73
|
+
default?: T;
|
|
74
|
+
example?: T;
|
|
75
|
+
required?: boolean;
|
|
76
|
+
readOnly?: boolean;
|
|
77
|
+
writeOnly?: boolean;
|
|
78
|
+
deprecated?: boolean;
|
|
79
|
+
};
|
|
80
|
+
export type BooleanSchema = {
|
|
81
|
+
type: 'boolean';
|
|
82
|
+
} & BaseSchema<boolean>;
|
|
83
|
+
export type StringSchema = {
|
|
84
|
+
type: 'string';
|
|
85
|
+
format?: string;
|
|
86
|
+
pattern?: string;
|
|
87
|
+
maxLength?: number;
|
|
88
|
+
minLength?: number;
|
|
89
|
+
} & BaseSchema<string>;
|
|
90
|
+
export type NumberSchema = {
|
|
91
|
+
type: 'number' | 'integer';
|
|
92
|
+
multipleOf?: number;
|
|
93
|
+
maximum?: number;
|
|
94
|
+
exclusiveMaximum?: boolean;
|
|
95
|
+
minimum?: number;
|
|
96
|
+
exclusiveMinimum?: boolean;
|
|
97
|
+
} & BaseSchema<number>;
|
|
98
|
+
export type ObjectSchema = {
|
|
99
|
+
type: 'object';
|
|
100
|
+
additionalProperties?: boolean | DataSchemaArray;
|
|
101
|
+
maxProperties?: number;
|
|
102
|
+
minProperties?: number;
|
|
103
|
+
properties: {
|
|
104
|
+
[key: string]: DataSchemaArray;
|
|
105
|
+
};
|
|
106
|
+
} & BaseSchema<object>;
|
|
107
|
+
export type ArraySchema = {
|
|
108
|
+
type: 'array';
|
|
109
|
+
items: DataSchemaArray;
|
|
110
|
+
maxItems?: number;
|
|
111
|
+
minItems?: number;
|
|
112
|
+
uniqueItems?: boolean;
|
|
113
|
+
} & BaseSchema<unknown[]>;
|
|
114
|
+
export type StringEnumSchema = {
|
|
115
|
+
type: 'stringEnum';
|
|
116
|
+
enum: string[];
|
|
117
|
+
} & BaseSchema<string>;
|
|
118
|
+
export type NumberEnumSchema = {
|
|
119
|
+
type: 'numberEnum' | 'integerEnum';
|
|
120
|
+
enum: number[];
|
|
121
|
+
} & BaseSchema<number>;
|
|
122
|
+
export type NullSchema = {
|
|
123
|
+
type: 'null';
|
|
124
|
+
} & BaseSchema<null>;
|
|
125
|
+
export type AnySchema = {
|
|
126
|
+
type: 'any';
|
|
127
|
+
} & BaseSchema<unknown>;
|
|
128
|
+
export {};
|