Skip to content

Commit 424ab62

Browse files
committed
Add new properties of OpenAPI
1 parent 6070826 commit 424ab62

File tree

2 files changed

+152
-37
lines changed

2 files changed

+152
-37
lines changed

v2.6/.test.json.ignore

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,12 @@
360360
},
361361
"documentation/openapi": {
362362
"description": "Very long description of what this endpoint does",
363+
"query_definition": [
364+
{
365+
"name": "page",
366+
"description": "The number of the page"
367+
}
368+
],
363369
"summary": "Get my favourite foo",
364370
"tags": [
365371
"foo",
@@ -1852,9 +1858,11 @@
18521858
"contact_url": "https://your.company/developers",
18531859
"license_name": "MIT",
18541860
"license_url": "https://opensource.org/licenses/MIT",
1855-
"tags": [
1856-
"B2B",
1857-
"Restricted"
1861+
"tag_definition": [
1862+
{
1863+
"name": "Tag1",
1864+
"description": "Description of tag1"
1865+
}
18581866
],
18591867
"schemes": [
18601868
"http",

v2.6/documentation/openapi.json

Lines changed: 141 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,23 @@
1616
"description": "The JSON Schemas you can reuse inside endpoint definitions using `ref`. You can either pass the JSON Schema object, or a bas64 string.",
1717
"examples": [
1818
{
19-
"Pet": {
20-
"type": "object",
21-
"required": [
22-
"id",
23-
"name"
24-
]
25-
}
19+
"Pet": {
20+
"type": "object",
21+
"required": [
22+
"id",
23+
"name"
24+
]
25+
}
2626
}
27-
],
28-
"patternProperties":{
27+
],
28+
"patternProperties": {
2929
".*": {
3030
"title": "JSON Schema",
3131
"description": "JSON Schema in base64 or as an object",
32-
"type":["string","object"]
32+
"type": [
33+
"string",
34+
"object"
35+
]
3336
}
3437
}
3538
},
@@ -132,7 +135,7 @@
132135
"tags": {
133136
"$id": "#documentation/openapi/tags",
134137
"title": "Tags",
135-
"description": "You can assign a list of tags to each API operation. Tagged operations may be handled differently by tools and libraries. For example, Swagger UI uses tags to group the displayed operations.\n\nSee: https://www.krakend.io/docs/enterprise/developer/openapi/",
138+
"description": "You can assign a list of tags to each API operation. If you declare tags in the `tag_definition` at the OpenAPI service level, they will have a description in the documentation. Tagged operations may be handled differently by tools and libraries. For example, Swagger UI uses tags to group the displayed operations.\n\nSee: https://www.krakend.io/docs/enterprise/developer/openapi/",
136139
"type": "array"
137140
},
138141
"schemes": {
@@ -172,6 +175,79 @@
172175
"string"
173176
]
174177
},
178+
"operation_id": {
179+
"$id": "#documentation/openapi/example",
180+
"title": "Operation ID",
181+
"description": "A unique string identifying the operation identifier. Usually the method + the endpoint. If provided, these IDs must be unique among all operations described in your API.\n\nSee: https://www.krakend.io/docs/enterprise/developer/openapi/",
182+
"type": "string",
183+
"examples": [
184+
"GET/foo"
185+
]
186+
},
187+
"tag_definition": {
188+
"$id": "#documentation/openapi/tag_definition",
189+
"title": "Tag definition",
190+
"description": "Sets a description for the tags classifiying endpoints when generating the OpenAPI spec.\n\nSee: https://www.krakend.io/docs/enterprise/developer/openapi/",
191+
"type": "array",
192+
"items": {
193+
"type": "object",
194+
"required": [
195+
"name"
196+
],
197+
"additionalProperties": false,
198+
"patternProperties": {
199+
"^[@$_#]": {}
200+
},
201+
"properties": {
202+
"name": {
203+
"type": "string"
204+
},
205+
"description": {
206+
"type": "string"
207+
}
208+
}
209+
},
210+
"examples": [
211+
[
212+
{
213+
"name": "Tag1",
214+
"description": "Description of tag1"
215+
}
216+
]
217+
]
218+
},
219+
"query_definition": {
220+
"$id": "#documentation/openapi/query_definition",
221+
"title": "Query definition",
222+
"description": "Sets a description for the query strings allowed in the endpoint. Make sure to include the same strings in the endpoint's `input_query_strings`.\n\nSee: https://www.krakend.io/docs/enterprise/developer/openapi/",
223+
"type": "array",
224+
"items": {
225+
"type": "object",
226+
"required": [
227+
"name"
228+
],
229+
"additionalProperties": false,
230+
"patternProperties": {
231+
"^[@$_#]": {}
232+
},
233+
"properties": {
234+
"name": {
235+
"type": "string"
236+
},
237+
"description": {
238+
"type": "string"
239+
}
240+
}
241+
},
242+
"examples": [
243+
[
244+
{
245+
"name": "page",
246+
"description": "The number of the page"
247+
}
248+
]
249+
]
250+
},
175251
"response_definition": {
176252
"$id": "#documentation/openapi/response_definition",
177253
"title": "Definition of errors (OAS3 only)",
@@ -183,42 +259,58 @@
183259
{
184260
"404": {
185261
"@comment": "Some comment",
186-
"description": "Page not found",
187-
"example": {
262+
"description": "Page not found",
263+
"example": {
188264
"status": "KO"
189-
},
190-
"content_type": "application/json"
191-
}
265+
},
266+
"content_type": "application/json"
267+
}
192268
}
193269
],
194270
"additionalProperties": false,
195-
"patternProperties":{
271+
"patternProperties": {
196272
"default|^[0-9]+$": {
197273
"type": "object",
198274
"additionalProperties": false,
199275
"patternProperties": {
200276
"^[@$_#]": {}
201277
},
202-
"required": ["content_type"],
278+
"required": [
279+
"content_type"
280+
],
203281
"properties": {
204282
"ref": {
205283
"type": "string",
206284
"title": "Reference",
207285
"description": "The relative reference to the `components/schema` OpenAPI definition that will be used as definition of the accepted request. Notice that the path `#/components/schemas/` is not needed.",
208-
"examples": ["your_schema_name"]
209-
286+
"examples": [
287+
"your_schema_name"
288+
]
210289
},
211290
"description": {
212-
"type": ["string"],
291+
"type": [
292+
"string"
293+
],
213294
"title": "Description",
214295
"description": "The description of this error code, e.g., `Page not found`.\n\nSee: https://www.krakend.io/docs/enterprise/developer/openapi/"
215296
},
216297
"example_schema": {
217-
"type": ["string","object"],
298+
"type": [
299+
"string",
300+
"object"
301+
],
218302
"description": "A JSON schema that describes the response format for the endpoint, directly as a JSON object, or encoded as a base64 string. Use either example or example_schema, but not both."
219303
},
220304
"example": {
221-
"type": ["string","object","array","boolean","integer","null","number"],
305+
"type": [
306+
"string",
307+
"object",
308+
"array",
309+
"boolean",
310+
"integer",
311+
"null",
312+
"number"
313+
],
222314
"title": "Content Type",
223315
"description": "A free form JSON object or a string you would like to show as a sample response of the endpoint. The examples assume they are JSON content types except when using the `output_encoding=string`.\n\nSee: https://www.krakend.io/docs/enterprise/developer/openapi/"
224316
},
@@ -240,39 +332,54 @@
240332
],
241333
"examples": [
242334
{
243-
244335
"@comment": "Some comment",
245-
"description": "Page not found",
246-
"example": {
336+
"description": "Page not found",
337+
"example": {
247338
"status": "KO"
248-
},
249-
"content_type": "application/json"
339+
},
340+
"content_type": "application/json"
250341
}
251342
],
252343
"additionalProperties": false,
253344
"patternProperties": {
254345
"^[@$_#]": {}
255346
},
256-
"required": ["content_type"],
347+
"required": [
348+
"content_type"
349+
],
257350
"properties": {
258351
"ref": {
259352
"type": "string",
260353
"title": "Reference",
261354
"description": "The relative reference to the `components/schema` OpenAPI definition that will be used as definition of the accepted request. Notice that the path `#/components/schemas/` is not needed.",
262-
"examples": ["your_schema_name"]
263-
355+
"examples": [
356+
"your_schema_name"
357+
]
264358
},
265359
"description": {
266-
"type": ["string"],
360+
"type": [
361+
"string"
362+
],
267363
"title": "Description",
268364
"description": "The description of the payload this endpoint accepts.\n\nSee: https://www.krakend.io/docs/enterprise/developer/openapi/"
269365
},
270366
"example_schema": {
271-
"type": ["string","object"],
367+
"type": [
368+
"string",
369+
"object"
370+
],
272371
"description": "A JSON schema that describes the request format for the accepted payload in the endpoint. Use either example or example_schema, but not both."
273372
},
274373
"example": {
275-
"type": ["string","object","array","boolean","integer","null","number"],
374+
"type": [
375+
"string",
376+
"object",
377+
"array",
378+
"boolean",
379+
"integer",
380+
"null",
381+
"number"
382+
],
276383
"title": "Content Type",
277384
"description": "A free form JSON object or a string you would like to show as a sample response of the endpoint. The examples assume they are JSON content types except when using the `output_encoding=string`.\n\nSee: https://www.krakend.io/docs/enterprise/developer/openapi/"
278385
},

0 commit comments

Comments
 (0)