-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathtypes.ts
More file actions
44 lines (37 loc) · 1.18 KB
/
types.ts
File metadata and controls
44 lines (37 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import type { JSONSchema4 } from 'json-schema'
import type { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types'
export type OpenAPIVersion = '3.0' | '3.1'
export interface OpenAPIMetadata {
title: string
version: string
description?: string
}
export interface PluginOptions {
enabled?: boolean
openapiVersion?: OpenAPIVersion
specEndpoint?: string
authEndpoint?: string
metadata: OpenAPIMetadata
}
export type SanitizedPluginOptions = Required<Omit<PluginOptions, 'enabled' | 'specEndpoint'>>
type ParameterObject<TVersion extends OpenAPIVersion = '3.0'> = TVersion extends '3.1'
? OpenAPIV3_1.ParameterObject
: OpenAPIV3.ParameterObject
type SchemaObject<TVersion extends OpenAPIVersion = '3.0'> = TVersion extends '3.1'
? OpenAPIV3_1.SchemaObject
: OpenAPIV3.SchemaObject
export interface CustomEndpointDocumentation<TVersion extends OpenAPIVersion = '3.0'> {
description: string
parameters?: ParameterObject<TVersion>[]
queryParameters?: Record<
string,
{
description?: string
required?: boolean
schema: SchemaObject<TVersion> | string
}
>
requestBody?: SchemaObject<TVersion>
responses?: Record<string, JSONSchema4>
summary?: string
}