-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterfaces.ts
158 lines (143 loc) · 3.09 KB
/
interfaces.ts
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
import { Parameter, Path, Schema } from 'swagger-schema-official';
export type Method = 'get' | 'post' | 'put' | 'delete';
export interface ExtendedSchema extends Schema {
['x-tyranid-openapi-collection-id']?: string;
['x-tyranid-openapi-name-path']?: string;
['x-tyranid-openapi-object-id']?: boolean;
['x-tyranid-openapi-methods']?: Method[];
['x-tyranid-openapi-name']?: string;
['x-tyranid-openapi-enum-collection-id']?: string;
['x-tyranid-openapi-partition-partial-filter-expression']?: any;
}
export interface SchemaOptions {
/**
* description to use instead of the main field note
*/
note?: string;
/**
* custom name for field / collection
*/
name?: string;
}
export interface FieldSchemaOptions extends SchemaOptions {
/**
* property should be returned / accepted by api
*/
include?: ('read' | 'write') | Method[];
/**
* override tyranid required field
*/
required?: boolean;
/**
* implementation should perform shallow cycle detection
*/
cycleCheck?: boolean;
/**
* only include this field for specific partition(s)
*/
partition?: string | string[];
}
export type CollectionSchemaOptions =
| IndividualCollectionSchemaOptions
| PartitionedCollectionSchemaOptions;
export interface IndividualCollectionSchemaOptions extends SchemaOptions {
/**
* methods to generate for this collection
*/
methods?: Method[];
/**
* whether this collection should be a
* child route of another (linked) collection
*/
parent?: string;
/**
* use parent scope for security (don't generate custom scope for this collection)
*/
useParentScope?: true;
/**
* partition query (if partitioned)
*/
partialFilterExpression: any;
}
export interface PartitionedCollectionSchemaOptions {
/**
* partition a collection into multiple virtual collections
* in the public api
*/
partition: IndividualCollectionSchemaOptions[];
}
/**
* container object for a generated Open API path
*/
export interface PathContainer {
id: string;
base: string;
paths: {
route: string;
path: Path;
}[];
}
/**
* container object for a generated Open API schema
*/
export interface SchemaContainer {
name: string;
pascalName: string;
id: string;
schema: ExtendedSchema;
}
/**
* additional properties on tyranid schema
* used by tyranid-Open API
*/
export interface SchemaAnnotation {
/**
* expose property to public api
*/
public?: boolean;
}
/**
* options for spec generation
*/
export interface Options {
/**
* api version, defaults to 1
*/
version?: string;
/**
* description of public api
*/
description?: string;
/**
* title of public api
*/
title?: string;
/**
* return yaml string
*/
yaml?: boolean;
/**
* terms of service for the api
*/
termsOfService?: string;
/**
* api host base url (defaults to http://localhost:9000)
*/
host?: string;
/**
* base path
*/
basePath?: string;
/**
* schemes
*/
schemes?: string[];
/**
* contact information for api
*/
contact?: {
email: string;
url: string;
name: string;
};
}