-
Notifications
You must be signed in to change notification settings - Fork 28
feat(231): allow POST HTTP verb
#415
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
Open
kindermoumoute
wants to merge
1
commit into
aep-dev:main
Choose a base branch
from
kindermoumoute:231-post
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+15
−5
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -10,14 +10,15 @@ APIs **may** support batch get to retrieve a consistent set of resources. | |||||||||
|
|
||||||||||
| - The method's name **must** begin with `BatchGet`. The remainder of the method | ||||||||||
| name **must** be the plural form of the resource being retrieved. | ||||||||||
| - The HTTP verb **must** be `GET`. | ||||||||||
| - The HTTP verb **must** be `GET` or `POST`. | ||||||||||
| - The HTTP URI **must** end with `:batch-get`. | ||||||||||
| - The URI path **must** represent the collection for the resource, matching the | ||||||||||
| collection used for simple CRUD operations. If the operation spans parents, a | ||||||||||
| [wilcard](./reading-across-collections) **may** be accepted. | ||||||||||
| - There **must not** be a request body. | ||||||||||
| - When the HTTP verb is `GET`, there **must not** be a request body. | ||||||||||
| - If a GET request contains a body, the body **must** be ignored, and **must | ||||||||||
| not** cause an error. | ||||||||||
| - When the HTTP verb is `POST`, there **must** be a request body. | ||||||||||
|
|
||||||||||
| ### Request | ||||||||||
|
|
||||||||||
|
|
@@ -45,7 +46,8 @@ pattern: | |||||||||
| ```proto | ||||||||||
| rpc BatchGetBooks(BatchGetBooksRequest) returns (BatchGetBooksResponse) { | ||||||||||
| option (google.api.http) = { | ||||||||||
| get: "/v1/{parent=publishers/*}/books:batch-get" | ||||||||||
| post: "/v1/{parent=publishers/*}/books:batch-get" | ||||||||||
| body: "*" | ||||||||||
| }; | ||||||||||
| } | ||||||||||
|
|
||||||||||
|
|
@@ -55,7 +57,7 @@ message BatchGetBooksRequest { | |||||||||
| // If this is set, the parent of all of the books specified in `paths` | ||||||||||
| // must match this field. | ||||||||||
| string parent = 1 [ | ||||||||||
| (aep.api.field_info) = { resource_reference: [ "library.com/book" ], field_behavior: [ FIELD_BEHAVIOR_OPTIONAL ] } | ||||||||||
| (aep.api.field_info) = { resource_reference: [ "library.com/publisher" ], field_behavior: [ FIELD_BEHAVIOR_OPTIONAL ] } | ||||||||||
| ]; | ||||||||||
|
|
||||||||||
| // The paths of the books to retrieve. | ||||||||||
|
|
@@ -77,7 +79,8 @@ message BatchGetBooksRequest { | |||||||||
| - The field **should** identify the [resource type][aep-122-parent] that it | ||||||||||
| references. | ||||||||||
| - The comment for the field **should** document the resource pattern. | ||||||||||
| - There **must not** be a body key in the `google.api.http` annotation. | ||||||||||
| - When the HTTP verb is `GET`, there **must not** be a body key in the `google.api.http` annotation. | ||||||||||
| - When the HTTP verb is `POST`, there **must** be a body key in the `google.api.http` annotation. | ||||||||||
|
|
||||||||||
| {% tab oas %} | ||||||||||
|
|
||||||||||
|
|
@@ -159,6 +162,13 @@ get either succeeds for all requested resources or fails. When supported, the | |||||||||
| method must define a boolean parameter `transactional` that the user must | ||||||||||
| specify with the value `true` to request a transactional operation. | ||||||||||
|
|
||||||||||
| ## Rationale | ||||||||||
|
|
||||||||||
| ### Why allowing both `POST` and `GET` HTTP verb? | ||||||||||
|
|
||||||||||
| - Allowing the `POST` HTTP verb address practical limitations such as URL length constraints (e.g., 2048 characters). | ||||||||||
| - Allowing the `GET` HTTP verb maintains backward compatibility and cacheability. | ||||||||||
|
|
||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I think it's valuable to elaborate on the full conversation - oftentimes people come to the rationale section to hear about the "why" in depth, including context on pros / cons and alternatives. |
||||||||||
| ## Changelog | ||||||||||
|
|
||||||||||
| - **2024-04-22:** Adopt from Google AIP https://google.aip.dev/231 with the | ||||||||||
|
|
||||||||||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a grammatical nit.