Skip to content

Commit 701d460

Browse files
committed
feat: adds additional operations for path item object
Signed-off-by: Vincent Biret <[email protected]>
1 parent 04cf0a5 commit 701d460

File tree

2 files changed

+76
-1
lines changed

2 files changed

+76
-1
lines changed

src/oas.md

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,6 +924,7 @@ The path itself is still exposed to the documentation viewer but they will not k
924924
| <a name="path-item-ref"></a>$ref | `string` | Allows for a referenced definition of this path item. The value MUST be in the form of a URI, and the referenced structure MUST be in the form of a [Path Item Object](#path-item-object). In case a Path Item Object field appears both in the defined object and the referenced object, the behavior is undefined. See the rules for resolving [Relative References](#relative-references-in-api-description-uris). <br><br>_**Note:** The behavior of `$ref` with adjacent properties is likely to change in future versions of this specification to bring it into closer alignment with the behavior of the [Reference Object](#reference-object)._ |
925925
| <a name="path-item-summary"></a>summary | `string` | An optional string summary, intended to apply to all operations in this path. |
926926
| <a name="path-item-description"></a>description | `string` | An optional string description, intended to apply to all operations in this path. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. |
927+
| <a name="path-item-additional-operations"></a>additionalOperations | Map[`string`, [Operation Object](#operation-object)] | A map of additional operations on this path. This map MUST NOT contain any entry matching (case-insensitive) any operation that can be defined on the parent path item object. |
927928
| <a name="path-item-get"></a>get | [Operation Object](#operation-object) | A definition of a GET operation on this path. |
928929
| <a name="path-item-put"></a>put | [Operation Object](#operation-object) | A definition of a PUT operation on this path. |
929930
| <a name="path-item-post"></a>post | [Operation Object](#operation-object) | A definition of a POST operation on this path. |
@@ -985,7 +986,39 @@ This object MAY be extended with [Specification Extensions](#specification-exten
985986
},
986987
"style": "simple"
987988
}
988-
]
989+
],
990+
"additionalOperations": {
991+
"query": {
992+
"description": "Returns pets based on ID",
993+
"summary": "Find pets by ID",
994+
"operationId": "queryPetsById",
995+
"responses": {
996+
"200": {
997+
"description": "pet response",
998+
"content": {
999+
"*/*": {
1000+
"schema": {
1001+
"type": "array",
1002+
"items": {
1003+
"$ref": "#/components/schemas/Pet"
1004+
}
1005+
}
1006+
}
1007+
}
1008+
},
1009+
"default": {
1010+
"description": "error payload",
1011+
"content": {
1012+
"text/html": {
1013+
"schema": {
1014+
"$ref": "#/components/schemas/ErrorModel"
1015+
}
1016+
}
1017+
}
1018+
}
1019+
}
1020+
}
1021+
}
9891022
}
9901023
```
9911024

@@ -1019,6 +1052,26 @@ parameters:
10191052
items:
10201053
type: string
10211054
style: simple
1055+
additionalOperations:
1056+
query:
1057+
description: Returns pets based on ID
1058+
summary: Find pets by ID
1059+
operationId: queryPetsById
1060+
responses:
1061+
'200':
1062+
description: pet response
1063+
content:
1064+
'*/*':
1065+
schema:
1066+
type: array
1067+
items:
1068+
$ref: '#/components/schemas/Pet'
1069+
default:
1070+
description: error payload
1071+
content:
1072+
text/html:
1073+
schema:
1074+
$ref: '#/components/schemas/ErrorModel'
10221075
```
10231076

10241077
#### Operation Object

src/schemas/validation/schema.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,28 @@ $defs:
230230
type: array
231231
items:
232232
$ref: '#/$defs/parameter-or-reference'
233+
additionalOperations:
234+
type: object
235+
additionalProperties:
236+
$ref: '#/$defs/operation'
237+
not:
238+
required:
239+
- get:
240+
$ref: '#/$defs/operation'
241+
- put:
242+
$ref: '#/$defs/operation'
243+
- post:
244+
$ref: '#/$defs/operation'
245+
- delete:
246+
$ref: '#/$defs/operation'
247+
- options:
248+
$ref: '#/$defs/operation'
249+
- head:
250+
$ref: '#/$defs/operation'
251+
- patch:
252+
$ref: '#/$defs/operation'
253+
- trace:
254+
$ref: '#/$defs/operation'
233255
get:
234256
$ref: '#/$defs/operation'
235257
put:

0 commit comments

Comments
 (0)