Skip to content

Commit 827266d

Browse files
committed
Add oas example of change validation
1 parent a0afbd9 commit 827266d

2 files changed

Lines changed: 76 additions & 0 deletions

File tree

aip/general/0163/aip.md.j2

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,12 @@ live request is likely to succeed, but is not a full guarantee of success.
6767
- In protocol buffers, the same response type is always used for a single RPC.
6868
The operation **may** return the response message with no fields populated.
6969

70+
{% tab operations %}
71+
72+
{% sample 'standard_operation.oas.yaml', 'paths' %}
73+
74+
- The `dryRun` query parameter **must** be `type: boolean`.
75+
- The `dryRun` query parameter **must not** be `required: true`.
76+
- createBook could also return a 204 response if `dryRun` is `true`.
77+
7078
{% endtabs %}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
openapi: 3.0.3
2+
info:
3+
title: Library
4+
version: 1.0.0
5+
paths:
6+
/publishers/{publisherId}/books/{bookId}:
7+
parameters:
8+
- name: publisherId
9+
in: path
10+
description: The id of the book publisher.
11+
required: true
12+
schema:
13+
type: string
14+
- name: bookId
15+
in: path
16+
description: The id of the book.
17+
required: true
18+
schema:
19+
type: string
20+
patch:
21+
operationId: createBook
22+
description: Create a single book.
23+
requestBody:
24+
content:
25+
application/json:
26+
schema:
27+
$ref: '#/components/schemas/Book'
28+
parameters:
29+
- name: dryRun
30+
in: query
31+
description: |
32+
If set, validate the request and preview the book,
33+
but do not actually post it.
34+
schema:
35+
type: boolean
36+
responses:
37+
'200':
38+
description: OK
39+
content:
40+
application/json:
41+
schema:
42+
$ref: '#/components/schemas/Book'
43+
components:
44+
schemas:
45+
Book:
46+
description: A representation of a single book.
47+
type: object
48+
properties:
49+
name:
50+
type: string
51+
description: |
52+
The name of the book.
53+
Format: publishers/{publisher}/books/{book}
54+
isbn:
55+
type: string
56+
description: |
57+
The ISBN (International Standard Book Number) for this book.
58+
title:
59+
type: string
60+
description: The title of the book.
61+
authors:
62+
type: array
63+
items:
64+
type: string
65+
description: The author or authors of the book.
66+
rating:
67+
type: number
68+
description: The rating assigned to the book.

0 commit comments

Comments
 (0)