Skip to content

Commit fa0fc26

Browse files
committed
examples: regenerate
1 parent 0f3b8ca commit fa0fc26

File tree

3 files changed

+300
-2
lines changed

3 files changed

+300
-2
lines changed

templates/hugo-markdown.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Message template
8686
| ----- | ---- | ----------- |
8787
{{range .Fields}}{{ if (not .Desc.ContainingOneof) }}{{template "field" .}}{{end}}{{end}}
8888
{{- end -}}
89-
{{range .Oneofs}}{{template "oneof" .}}{{end}}
89+
{{range .Oneofs}}{{ if .Desc.IsSynthetic }}{{template "field" (index .Fields 0) }}{{else}}{{template "oneof" .}}{{end}}{{end}}
9090

9191
{{if .Extensions}}
9292
| Extension | Type | Base | Number | Description |
@@ -110,7 +110,7 @@ Message template
110110
Field template
111111
***************************************************************/}}
112112
{{define "field" -}}
113-
| {{.Desc.Name}}{{ if .Desc.IsList }}[]{{ end }} |
113+
| {{.Desc.Name }}{{ if .Desc.IsList }}[]{{ end }}{{ if .Desc.HasOptionalKeyword }} (optional){{ end }} |
114114
{{- if (or (is_primitive .) (is_google_type .)) -}}
115115
{{ field_type . }}
116116
{{- else -}}

testdata/example1/booking.md

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
---
2+
title: com.example.booking
3+
description: API Specification for the com.example.booking package.
4+
---
5+
6+
<a name="booking-proto"></a><p align="right"><a href="#top">Top</a></p>
7+
8+
<!-- begin services -->
9+
10+
11+
<a name="com-example-booking-BookingService"></a>
12+
13+
### BookingService
14+
15+
Service for handling vehicle bookings.
16+
17+
18+
19+
| Method Name | Request Type | Response Type | Description |
20+
| ----------- | ------------ | ------------- | ------------|
21+
| BookVehicle | [Booking](#com-example-booking-Booking) | [BookingStatus](#com-example-booking-BookingStatus) | Used to book a vehicle. Pass in a Booking and a BookingStatus will be returned. |
22+
| BookingUpdates | [BookingStatusID](#com-example-booking-BookingStatusID) | [BookingStatus](#com-example-booking-BookingStatus) stream | Used to subscribe to updates of the BookingStatus. |
23+
24+
25+
26+
<!-- begin services -->
27+
28+
29+
30+
<a name="com-example-booking-BookingStatusID"></a>
31+
32+
### BookingStatusID
33+
34+
Represents the booking status ID.
35+
36+
37+
38+
39+
| Field | Type | Description |
40+
| ----- | ---- | ----------- |
41+
| id |int32| Unique booking status ID. |
42+
43+
44+
45+
46+
<!-- end nested messages -->
47+
48+
<!-- end nested enums -->
49+
50+
51+
52+
53+
<a name="com-example-booking-BookingStatus"></a>
54+
55+
### BookingStatus
56+
57+
Represents the status of a vehicle booking.
58+
59+
60+
61+
62+
| Field | Type | Description |
63+
| ----- | ---- | ----------- |
64+
| id |int32| Unique booking status ID. |
65+
| description |string| Booking status description. E.g. "Active". |
66+
67+
68+
69+
70+
<!-- end nested messages -->
71+
72+
<!-- end nested enums -->
73+
74+
75+
76+
77+
<a name="com-example-booking-Booking"></a>
78+
79+
### Booking
80+
81+
Represents the booking of a vehicle.
82+
83+
Vehicles are quite fun. But drive carefully!
84+
85+
86+
87+
88+
| Field | Type | Description |
89+
| ----- | ---- | ----------- |
90+
| vehicle_id |int32| ID of booked vehicle. |
91+
| customer_id |int32| Customer that booked the vehicle. |
92+
| status |[BookingStatus](#com-example-booking-BookingStatus)| Status of the booking. |
93+
| confirmation_sent |bool| Has booking confirmation been sent? |
94+
| payment_received |bool| Has payment been received? |
95+
| color_preference |string| Color preference of the customer. |
96+
97+
98+
99+
100+
<!-- end nested messages -->
101+
102+
<!-- end nested enums -->
103+
104+
105+
106+
107+
<a name="com-example-booking-EmptyBookingMessage"></a>
108+
109+
### EmptyBookingMessage
110+
111+
An empty message for testing
112+
113+
114+
115+
116+
117+
118+
119+
<!-- end nested messages -->
120+
121+
<!-- end nested enums -->
122+
123+
124+
<!-- end messages -->
125+
126+
<!-- begin file-level enums -->
127+
<!-- end file-level enums -->
128+
129+
<!-- begin file-level extensions -->
130+
<!-- end file-level extensions -->
131+

testdata/example1/vehicle.md

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
---
2+
title: com.example
3+
description: API Specification for the com.example package.
4+
---
5+
6+
<a name="vehicle-proto"></a><p align="right"><a href="#top">Top</a></p>
7+
8+
<!-- begin services -->
9+
10+
<!-- begin services -->
11+
12+
13+
14+
<a name="com-example-Manufacturer"></a>
15+
16+
### Manufacturer
17+
18+
Represents a manufacturer of cars.
19+
20+
21+
22+
23+
| Field | Type | Description |
24+
| ----- | ---- | ----------- |
25+
| id |int32| The unique manufacturer ID. |
26+
| code |string| A manufacturer code, e.g. "DKL4P". |
27+
| details (optional) |string| Manufacturer details (minimum orders et.c.). |
28+
| category (optional) |[Manufacturer.Category](#com-example-Manufacturer-Category)| Manufacturer category. |
29+
30+
31+
32+
33+
<!-- end nested messages -->
34+
35+
36+
37+
<a name="com-example-Manufacturer-Category"></a>
38+
39+
### Manufacturer.Category
40+
Manufacturer category. A manufacturer may be either inhouse or external.
41+
42+
43+
44+
| Name | Number | Description |
45+
| ---- | ------ | ----------- |
46+
| CATEGORY_INHOUSE | 0 | The manufacturer is inhouse. |
47+
| CATEGORY_EXTERNAL | 1 | The manufacturer is external. |
48+
49+
50+
<!-- end nested enums -->
51+
52+
53+
54+
55+
<a name="com-example-Model"></a>
56+
57+
### Model
58+
59+
Represents a vehicle model.
60+
61+
62+
63+
64+
| Field | Type | Description |
65+
| ----- | ---- | ----------- |
66+
| id |string| The unique model ID. |
67+
| model_code |string| The car model code, e.g. "PZ003". |
68+
| model_name |string| The car model name, e.g. "Z3". |
69+
| daily_hire_rate_dollars |sint32| Dollars per day. |
70+
| daily_hire_rate_cents |sint32| Cents per day. |
71+
72+
73+
74+
75+
<!-- end nested messages -->
76+
77+
<!-- end nested enums -->
78+
79+
80+
81+
82+
<a name="com-example-Vehicle"></a>
83+
84+
### Vehicle
85+
86+
Represents a vehicle that can be hired.
87+
88+
89+
90+
91+
| Field | Type | Description |
92+
| ----- | ---- | ----------- |
93+
| id |int32| Unique vehicle ID. |
94+
| model |[Model](#com-example-Model)| Vehicle model. |
95+
| reg_number |string| Vehicle registration number. |
96+
| mileage (optional) |sint32| Current vehicle mileage, if known. |
97+
| category (optional) |[Vehicle.Category](#com-example-Vehicle-Category)| Vehicle category. |
98+
| daily_hire_rate_dollars (optional) |sint32| Dollars per day. |
99+
| daily_hire_rate_cents (optional) |sint32| Cents per day. |
100+
101+
102+
103+
| Extension | Type | Base | Number | Description |
104+
| --------- | ---- | ---- | ------ | ----------- |
105+
| series | Vehicle.series | Vehicle | 100 | Vehicle model series. |
106+
107+
108+
109+
110+
111+
<a name="com-example-Vehicle-Category"></a>
112+
113+
### Category
114+
115+
Represents a vehicle category. E.g. "Sedan" or "Truck".
116+
117+
118+
119+
120+
| Field | Type | Description |
121+
| ----- | ---- | ----------- |
122+
| code |string| Category code. E.g. "S". |
123+
| description |string| Category name. E.g. "Sedan". |
124+
125+
126+
127+
128+
<!-- end nested messages -->
129+
130+
<!-- end nested enums -->
131+
132+
133+
<!-- end nested messages -->
134+
135+
<!-- end nested enums -->
136+
137+
138+
<!-- end messages -->
139+
140+
<!-- begin file-level enums -->
141+
142+
143+
<a name="com-example-Coolness"></a>
144+
145+
### Coolness
146+
147+
148+
149+
| Name | Number | Description |
150+
| ---- | ------ | ----------- |
151+
| COOLNESS_UNSPECIFIED | 0 | The coolness is unknown. |
152+
| COOLNESS_MAX | 1 | The coolness is maximum. |
153+
154+
155+
<!-- end file-level enums -->
156+
157+
<!-- begin file-level extensions -->
158+
159+
<a name="vehicle-proto-extensions"></a>
160+
161+
### Extensions
162+
| Extension | Type | Extension Point | Number | Description |
163+
| --------- | ---- | ---- | ------ | ----------- |
164+
| country | com.example.country | Manufacturer | 100 | Manufacturer country. |
165+
166+
<!-- end file-level extensions -->
167+

0 commit comments

Comments
 (0)