Skip to content
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

Add component mandate for OAS resources #212

Merged
merged 4 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
26 changes: 16 additions & 10 deletions aep/general/0004/aep.md.j2
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,25 @@ message Topic {

{% tab oas %}

For OpenAPI 3.0, use the `x-aep-resource` extension:
For OpenAPI 3.0, Resources must be defined in `#components/schemas` and use the `x-aep-resource` extension:
rambleraptor marked this conversation as resolved.
Show resolved Hide resolved

```json
{
"type": "object",
"x-aep-resource": {
"singular": "user-event",
"plural": "user-events",
"patterns": [
"projects/{project}/user-events/{user-event}",
"folder/{folder}/user-events/{user-event}",
"users/{user}/events/{user-event}"
]
"components": {
rambleraptor marked this conversation as resolved.
Show resolved Hide resolved
"schemas": {
"UserEvent": {
"type": "object",
"x-aep-resource": {
"singular": "user-event",
"plural": "user-events",
"patterns": [
"projects/{project}/user-events/{user-event}",
"folder/{folder}/user-events/{user-event}",
"users/{user}/events/{user-event}"
]
}
}
}
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion aep/general/0131/aep.md.j2
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ metadata:
- The `operationId` **must** begin with the word `get`. The remainder of the
`operationId` **should** be the singular form of the resource type's name.
- The response content **must** be the resource itself. For example:
`#/components/schemas/Book`
`#/components/schemas/Book`. The response **must** reference a schema with a `x-aep-resource` extension.
rambleraptor marked this conversation as resolved.
Show resolved Hide resolved
- The URI **should** contain a variable for each individual ID in the resource
hierarchy.
- The path parameter for all resource IDs **must** be in the form
Expand Down
10 changes: 10 additions & 0 deletions aep/general/0131/get.oas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,23 @@ paths:
components:
schema:
Book:
type: object
x-aep-resource:
singular: book
plural: books
patterns:
- 'publishers/{publisher}/books/{book}'
description: A representation of a single book.
properties:
name:
type: string
description: |
The name of the book.
Format: publishers/{publisher}/books/{book}
publisher:
type: string
description: |
The name of the publisher.
isbn:
type: string
description: |
Expand Down
2 changes: 1 addition & 1 deletion aep/general/0141/aep.md.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Quantities
# Quantities

Many services need to represent a discrete quantity of items (number of bytes,
number of miles, number of nodes, etc.).
Expand Down
Loading