forked from doordash-oss/oapi-codegen-dd
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfiguration-schema.json
More file actions
369 lines (369 loc) · 13 KB
/
configuration-schema.json
File metadata and controls
369 lines (369 loc) · 13 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
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Configuration",
"description": "Configuration defines code generation customizations.",
"type": "object",
"additionalProperties": false,
"properties": {
"package": {
"type": "string",
"description": "PackageName to generate the code under."
},
"copyright-header": {
"type": "string",
"description": "CopyrightHeader is the header to add to the generated code. Use without //."
},
"skip-prune": {
"type": "boolean",
"description": "SkipPrune indicates whether to skip pruning unused components on the generated code."
},
"output": {
"$ref": "#/definitions/Output",
"description": "Output specifies the output options for the generated code."
},
"generate": {
"$ref": "#/definitions/GenerateOptions",
"description": "Generate options for the generated code."
},
"filter": {
"$ref": "#/definitions/FilterConfig",
"description": "Filter is the configuration for filtering the paths and operations to be parsed."
},
"overlay": {
"$ref": "#/definitions/OverlayOptions",
"description": "Overlay specifies OpenAPI Overlay files to apply to the spec before generation."
},
"additional-imports": {
"type": "array",
"description": "AdditionalImports defines any additional Go imports to add to the generated code.",
"items": {
"$ref": "#/definitions/AdditionalImport"
}
},
"error-mapping": {
"type": "object",
"description": "ErrorMapping is the configuration for mapping the OpenAPI error responses to Go types. The key is the generated error type name and the value is the dotted json path to the string result.",
"additionalProperties": {
"type": "string"
}
},
"client": {
"type": "object",
"description": "Client defines options for the generated client.",
"$ref": "#/definitions/Client"
},
"user-templates": {
"type": "object",
"description": "UserTemplates is the map of user-provided templates overriding the default ones.",
"additionalProperties": {
"type": "string"
}
},
"user-context": {
"type": "object",
"description": "UserContext is the map of user-provided context values to be used in templates user overrides.",
"additionalProperties": true
}
},
"required": [],
"definitions": {
"Output": {
"type": "object",
"additionalProperties": false,
"properties": {
"use-single-file": {
"type": "boolean",
"description": "Whether to generate the output into a single file."
},
"directory": {
"type": "string",
"description": "Directory where generated files should be placed."
},
"filename": {
"type": "string",
"description": "Filename to use if single file output is enabled."
}
},
"required": []
},
"GenerateOptions": {
"type": "object",
"additionalProperties": false,
"properties": {
"client": {
"type": "boolean",
"description": "Client specifies whether to generate a client. Defaults to false."
},
"models": {
"type": "boolean",
"description": "Models specifies whether to generate model types. Defaults to true. Set to false when models are generated in a separate package."
},
"handler": {
"$ref": "#/definitions/HandlerOptions",
"description": "Handler specifies options for handler/server code generation. If not specified, no handler code is generated."
},
"mcp-server": {
"$ref": "#/definitions/MCPServerOptions",
"description": "MCPServer specifies options for MCP (Model Context Protocol) server generation. If set, generates MCP tools that wrap the generated client for AI assistant integration. Requires client generation to be enabled."
},
"omit-description": {
"type": "boolean",
"description": "OmitDescription specifies whether to omit schema description from the spec in the generated code. Defaults to false."
},
"default-int-type": {
"type": "string",
"description": "DefaultIntType specifies the default integer type to use in the generated code. Can be 'int', 'int32', or 'int64'. Defaults to 'int'."
},
"always-prefix-enum-values": {
"type": "boolean",
"description": "AlwaysPrefixEnumValues specifies whether to always prefix enum values with the schema name. Defaults to true."
},
"validation": {
"$ref": "#/definitions/ValidationOptions",
"description": "Validation specifies options for Validate() method generation."
}
},
"required": []
},
"FilterConfig": {
"type": "object",
"additionalProperties": false,
"properties": {
"include": {
"$ref": "#/definitions/FilterParamsConfig",
"description": "Paths, tags, operation IDs, and schema properties to include."
},
"exclude": {
"$ref": "#/definitions/FilterParamsConfig",
"description": "Paths, tags, operation IDs, and schema properties to exclude."
}
},
"required": []
},
"FilterParamsConfig": {
"type": "object",
"additionalProperties": false,
"properties": {
"paths": {
"type": "array",
"items": {
"type": "string"
},
"description": "List of paths to include or exclude."
},
"tags": {
"type": "array",
"items": {
"type": "string"
},
"description": "List of tags to include or exclude."
},
"operation-ids": {
"type": "array",
"items": {
"type": "string"
},
"description": "List of operation IDs to include or exclude."
},
"schema-properties": {
"type": "object",
"description": "Mapping of schema names to property names to include or exclude.",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
}
}
},
"extensions": {
"type": "array",
"description": "List of extension names to include or exclude",
"items": {
"type": "string"
}
}
},
"required": []
},
"OverlayOptions": {
"type": "object",
"additionalProperties": false,
"description": "Specifies OpenAPI Overlay files to apply to the spec before generation. See https://spec.openapis.org/overlay/v1.0.0.html",
"properties": {
"sources": {
"type": "array",
"description": "List of overlay files to apply to the OpenAPI spec. Each source can be a file path or URL. Overlays are applied in order.",
"items": {
"type": "string"
}
}
},
"required": []
},
"AdditionalImport": {
"type": "object",
"additionalProperties": false,
"properties": {
"alias": {
"type": "string",
"description": "Optional alias for the import."
},
"package": {
"type": "string",
"description": "Package path to import."
}
},
"required": [
"package"
]
},
"Client": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"description": "Name of the generated client struct."
},
"timeout": {
"type": "string",
"description": "Timeout for the generated client."
}
},
"required": []
},
"ValidationOptions": {
"type": "object",
"additionalProperties": false,
"properties": {
"skip": {
"type": "boolean",
"description": "Skip specifies whether to skip Validation method generation. Defaults to false."
},
"simple": {
"type": "boolean",
"description": "Simple specifies whether to use the simple validation approach. Defaults to false. Simple validation uses validate.Struct() for all types, whereas complex validation generates custom Validate() methods."
},
"response": {
"type": "boolean",
"description": "Response specifies whether to generate Validate() methods for response types. Useful for contract testing to ensure responses match the OpenAPI spec. Defaults to false."
}
},
"required": []
},
"HandlerOptions": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"description": "Name of the generated service interface. Defaults to 'Service'."
},
"kind": {
"type": "string",
"enum": ["beego", "chi", "echo", "fasthttp", "fiber", "gin", "goframe", "go-zero", "gorilla-mux", "hertz", "iris", "kratos", "std-http"],
"description": "Router/framework to generate for. Required."
},
"models-package-alias": {
"type": "string",
"description": "Package alias to prefix model types with. Used when models are generated separately (generate.models: false). Example: 'types' will generate 'types.User' instead of 'User'."
},
"multipart-max-memory": {
"type": "integer",
"description": "Maximum memory in MB for multipart form parsing. Defaults to 32MB. Files exceeding this are stored in temp files."
},
"validation": {
"$ref": "#/definitions/HandlerValidation",
"description": "Validation options for request/response validation in handlers."
},
"output": {
"$ref": "#/definitions/ScaffoldOutput",
"description": "Output options for scaffolded handler files (service.go, middleware.go). Falls back to root output if not set."
},
"middleware": {
"$ref": "#/definitions/MiddlewareOptions",
"description": "Middleware generation options. If set, generates a scaffold middleware.go."
},
"server": {
"$ref": "#/definitions/ServerOptions",
"description": "Server generation options. If set, generates a scaffold server/main.go."
}
},
"required": ["kind"]
},
"ScaffoldOutput": {
"type": "object",
"additionalProperties": false,
"description": "Output options for scaffolded files (service.go, middleware.go).",
"properties": {
"directory": {
"type": "string",
"description": "Output directory, relative to the spec/config file location."
},
"package": {
"type": "string",
"description": "Package name for the generated file."
},
"overwrite": {
"type": "boolean",
"description": "Force regeneration of scaffold-once files (e.g., service.go, middleware.go). Normally these files are only generated if they don't exist. Defaults to false."
}
},
"required": []
},
"MiddlewareOptions": {
"type": "object",
"additionalProperties": false,
"description": "Options for generating middleware.go. Currently empty but allows for future extensibility.",
"properties": {},
"required": []
},
"MCPServerOptions": {
"type": "object",
"additionalProperties": false,
"description": "Options for MCP (Model Context Protocol) server generation. MCP servers expose API operations as tools that AI assistants (Claude, Cursor, etc.) can invoke.",
"properties": {
"default-skip": {
"type": "boolean",
"description": "If true, skip all operations by default unless x-mcp.skip is explicitly false. If false (default), include all operations unless x-mcp.skip is true."
}
},
"required": []
},
"ServerOptions": {
"type": "object",
"additionalProperties": false,
"properties": {
"directory": {
"type": "string",
"description": "Directory for the generated server main.go. Defaults to 'server'."
},
"port": {
"type": "integer",
"default": 8080,
"description": "Port for the server to listen on. Defaults to 8080."
},
"handler-package": {
"type": "string",
"description": "Import path for the handler package. Required."
}
},
"required": ["handler-package"]
},
"HandlerValidation": {
"type": "object",
"additionalProperties": false,
"properties": {
"request": {
"type": "boolean",
"description": "Request enables validation of incoming requests. Defaults to false."
},
"response": {
"type": "boolean",
"description": "Response enables validation of outgoing responses. Useful for contract testing. Defaults to false."
}
},
"required": []
}
}
}