Skip to content

feat: adds additional operations for path item object #4514

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 27 commits into from
Apr 1, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
701d460
feat: adds additional operations for path item object
baywet Mar 28, 2025
524cc6f
chore: adds test data for additional operations
baywet Mar 28, 2025
b12f34b
fix: schema definition for outlawed properties
baywet Mar 28, 2025
692b413
fix: schema indentation and adds required keyword
baywet Mar 28, 2025
62dbf31
fix: 🤦 vincent needs a coffee
baywet Mar 28, 2025
15e99ca
Apply suggestions from code review
baywet Mar 28, 2025
72a29d7
Update tests/schema/pass/path-item-object-example.yaml
baywet Mar 28, 2025
2452ad1
chore: moves additional operations after the defined operations
baywet Mar 28, 2025
4cf5168
ci: adds a failing test for methods that should be defined on the par…
baywet Mar 28, 2025
cfdc4bc
Update tests/schema/fail/path-item-object-example.yaml
baywet Mar 28, 2025
d5141ec
chore: renames fail file to have more explicit definition of the case
baywet Mar 31, 2025
6ed7fe8
feat: adds query as "principal" operation type in path item
baywet Mar 31, 2025
61fee04
fix: excluded operations filter for additional operations
baywet Mar 31, 2025
d3c477c
docs: updates wording for additional operations exclusions
baywet Mar 31, 2025
2dc3e06
docs: updates additional operation samples to match hoisting of query
baywet Mar 31, 2025
e465abc
Merge branch 'feat/additional-operations' of https://github.com/baywe…
baywet Mar 31, 2025
3fb4d91
ci: fixes pass example test
baywet Mar 31, 2025
dd0cf16
docs: adds a query example to pass tests
baywet Mar 31, 2025
fc29d3a
docs: precisions around capitalization
baywet Mar 31, 2025
9a53a9d
ci: restricts to RFC9110 methods syntax
baywet Mar 31, 2025
621d1c3
docs: adds the query method to the spec
baywet Mar 31, 2025
ed5cfe4
fix: tchar definition
baywet Mar 31, 2025
480dc75
Fix regex character class
handrews Mar 31, 2025
1826161
Fix character class in regular expression
handrews Mar 31, 2025
3ee2d24
Undo my incorrect additional "fix"
handrews Mar 31, 2025
0c4f6be
docs: typo fix in html attribute name
baywet Apr 1, 2025
238aaca
docs: schema regex fix
baywet Apr 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 54 additions & 1 deletion src/oas.md
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,7 @@ The path itself is still exposed to the documentation viewer but they will not k
| <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)._ |
| <a name="path-item-summary"></a>summary | `string` | An optional string summary, intended to apply to all operations in this path. |
| <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. |
| <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. |
| <a name="path-item-get"></a>get | [Operation Object](#operation-object) | A definition of a GET operation on this path. |
| <a name="path-item-put"></a>put | [Operation Object](#operation-object) | A definition of a PUT operation on this path. |
| <a name="path-item-post"></a>post | [Operation Object](#operation-object) | A definition of a POST operation on this path. |
Expand Down Expand Up @@ -985,7 +986,39 @@ This object MAY be extended with [Specification Extensions](#specification-exten
},
"style": "simple"
}
]
],
"additionalOperations": {
"query": {
"description": "Returns pets based on ID",
"summary": "Find pets by ID",
"operationId": "queryPetsById",
"responses": {
"200": {
"description": "pet response",
"content": {
"*/*": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Pet"
}
}
}
}
},
"default": {
"description": "error payload",
"content": {
"text/html": {
"schema": {
"$ref": "#/components/schemas/ErrorModel"
}
}
}
}
}
}
}
}
```

Expand Down Expand Up @@ -1019,6 +1052,26 @@ parameters:
items:
type: string
style: simple
additionalOperations:
query:
description: Returns pets based on ID
summary: Find pets by ID
operationId: queryPetsById
responses:
'200':
description: pet response
content:
'*/*':
schema:
type: array
items:
$ref: '#/components/schemas/Pet'
default:
description: error payload
content:
text/html:
schema:
$ref: '#/components/schemas/ErrorModel'
```

#### Operation Object
Expand Down
46 changes: 46 additions & 0 deletions src/schemas/validation/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,52 @@ $defs:
type: array
items:
$ref: '#/$defs/parameter-or-reference'
additionalOperations:
type: object
additionalProperties:
$ref: '#/$defs/operation'
not:
anyOf:
- properties:
get:
$ref: '#/$defs/operation'
required:
- get
- properties:
put:
$ref: '#/$defs/operation'
required:
- put
- properties:
post:
$ref: '#/$defs/operation'
required:
- post
- properties:
delete:
$ref: '#/$defs/operation'
required:
- delete
- properties:
options:
$ref: '#/$defs/operation'
required:
- options
- properties:
head:
$ref: '#/$defs/operation'
required:
- head
- properties:
patch:
$ref: '#/$defs/operation'
required:
- patch
- properties:
trace:
$ref: '#/$defs/operation'
required:
- trace
get:
$ref: '#/$defs/operation'
put:
Expand Down
22 changes: 21 additions & 1 deletion tests/schema/pass/path-item-object-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,24 @@ paths:
type: array
items:
type: string
style: simple
style: simple
additionalOperations:
query:
description: Returns pets based on ID
summary: Find pets by ID
operationId: queryPetsById
responses:
'200':
description: pet response
content:
'*/*':
schema:
type: array
items:
$ref: '#/components/schemas/Pet'
default:
description: error payload
content:
text/html:
schema:
$ref: '#/components/schemas/ErrorModel'