File tree Expand file tree Collapse file tree 1 file changed +41
-1
lines changed
Expand file tree Collapse file tree 1 file changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -118,7 +118,47 @@ message PublishBookRequest {
118118
119119{% tab oas %}
120120
121- **Note:** OAS content not yet written.
121+ State transition methods in OpenAPI follow these requirements:
122+
123+ - The HTTP method **must** be `POST`.
124+ - The path **must** use the `:` separator followed by the action verb (e.g.,
125+ `:publish`).
126+ - The request body **should** be an object containing any additional parameters
127+ beyond the resource path.
128+ - If no additional parameters are needed, an empty object `{}` **should** be
129+ sent.
130+ - The response **should** be the resource itself (e.g., the `Book` object).
131+ - If the operation is long-running, the response **should** be an `Operation`
132+ object which resolves to the resource.
133+ - The resource path parameters (e.g., `publisher_id`, `book_id`) **should** be
134+ the only path variables in the URI. All other parameters **should** be in the
135+ request body.
136+ - If the state transition is not allowed, the API **must** return
137+ `400 Bad Request`.
138+
139+ Example OpenAPI specification:
140+
141+ ```yaml
142+ components:
143+ schemas:
144+ Book:
145+ type: object
146+ properties:
147+ name:
148+ type: string
149+ description: |
150+ The resource name of the book.
151+ Format: publishers/{publisher_id}/books/{book_id}
152+ state:
153+ type: string
154+ readOnly: true
155+ enum:
156+ - DRAFT
157+ - PUBLISHED
158+ description: |
159+ Output only. The current state of the book. This field cannot be
160+ directly updated through create or update methods.
161+ ```
122162
123163{% endtabs %}
124164
You can’t perform that action at this time.
0 commit comments