Skip to content

Commit 046bd25

Browse files
author
Luke Sneeringer
committed
Working on the OAS examples.
1 parent ba39650 commit 046bd25

File tree

4 files changed

+116
-2
lines changed

4 files changed

+116
-2
lines changed

aip/general/0131/get.oas.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ paths:
77
/publishers/{publisherId}/books/{bookId}:
88
get:
99
operationId: getBook
10-
description: Get a single book.
10+
description: Retrieve a single book.
1111
responses:
1212
200:
1313
description: OK

aip/general/0131/get.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import "google/api/field_behavior.proto";
2020
import "google/api/resource.proto";
2121

2222
service Library {
23-
// Get a single book.
23+
// Retrieve a single book.
2424
rpc GetBook(GetBookRequest) returns (Book) {
2525
option (google.api.http) = {
2626
get: "/v1/{name=publishers/*/books/*}"

aip/general/0162/aip.md.j2

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ revision ID in the standard `Get` operation (AIP-131):
8282

8383
{% sample 'revisions.proto', 'message GetBookRequest' %}
8484

85+
{% tab oas %}
86+
87+
{% sample 'revisions.oas.yaml', '/publishers/{publisherId}/books/{bookId}' %}
88+
8589
{% endtabs %}
8690

8791
If the user passes a revision ID that does not exist, the API **must** fail
@@ -102,6 +106,10 @@ Revision" custom operation:
102106

103107
{% sample 'revisions.proto', 'rpc TagBookRevision', 'message TagBookRevisionRequest' %}
104108

109+
{% tab oas %}
110+
111+
{% sample 'revisions.oas.yaml', '/publishers/{publisherId}/books/{bookId}:tagRevision' %}
112+
105113
{% endtabs %}
106114

107115
- The `id` field **should** require an explicit revision ID to be provided.

aip/general/0162/revisions.oas.yaml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
---
2+
openapi: 3.0.3
3+
info:
4+
title: Library
5+
version: 1.0.0
6+
paths:
7+
/publishers/{publisherId}/books/{bookId}:
8+
get:
9+
operationId: getBook
10+
description: Retrieve a single book.
11+
responses:
12+
200:
13+
description: OK
14+
content:
15+
application/json:
16+
schema:
17+
$ref: '#/components/schemas/Book'
18+
/publishers/{publisherId}/books/{bookId}:listRevisions:
19+
get:
20+
operationId: listBookRevisions
21+
description: List all revisions of a single book.
22+
parameters:
23+
- name: maxPageSize
24+
in: query
25+
schema:
26+
type: int32
27+
description: The maximum number of revisions to return per page.
28+
- name: pageToken
29+
in: query
30+
schema:
31+
type: string
32+
description: |
33+
The page token, received from a previous ListBookRevisions call.
34+
Provide this to retrieve the subsequent page.
35+
responses:
36+
200:
37+
description: OK
38+
content:
39+
application/json:
40+
description: Response structure for listing book revisions.
41+
properties:
42+
books:
43+
type: array
44+
items:
45+
$ref: '#/components/schemas/Book'
46+
description: The revisions of the book.
47+
nextPageToken:
48+
type: string
49+
description: |
50+
A token that can be sent as `pageToken` to retrieve the
51+
next page.
52+
53+
If this field is omitted, there are no subsequent pages.
54+
/publishers/{publisherId}/books/{bookId}:tagRevision:
55+
post:
56+
operationId: tagBookRevision
57+
description: |
58+
Tag a single book revision with a user-specified tag.
59+
The tag may then be used in place of the canonical revision ID.
60+
61+
If a tag is sent that already exists, the tag will be removed from its
62+
original revision and assigned to the provided revision.
63+
requestBody:
64+
content:
65+
application/json:
66+
description: Request structure for tagging a book revision.
67+
properties:
68+
id:
69+
type: string
70+
description: |
71+
The ID of the book to be tagged, including the revision ID.
72+
required: true
73+
tag:
74+
type: string
75+
description: |
76+
The tag to apply. The tag should be at most 40 characters,
77+
and match `[a-z][a-z0-9-]{3,38}[a-z0-9]`.
78+
required: true
79+
responses:
80+
200:
81+
description: OK
82+
content:
83+
application/json:
84+
schema:
85+
$ref: '#/components/schemas/Book'
86+
components:
87+
schema:
88+
Book:
89+
description: A representation of a single book.
90+
properties:
91+
id:
92+
type: string
93+
description: |
94+
The resource ID of the book.
95+
Format: publishers/{publisher}/books/{book}
96+
# Other fields...
97+
revisionId:
98+
type: string
99+
description: |
100+
The revision ID of the book.
101+
A new revision is committed whenever the book is changed in any way.
102+
The format is an 8-character hexadecimal string.
103+
revisionCreateTime:
104+
type: string
105+
format: datetime
106+
description: The timestamp when the revision was created.

0 commit comments

Comments
 (0)