Skip to content

Commit 2d26622

Browse files
feat: Support format for 64-bit integer field types
1 parent ee84fd2 commit 2d26622

8 files changed

Lines changed: 338 additions & 1 deletion

File tree

cmd/protoc-gen-openapi/examples/tests/protobuftypes/message.proto

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,10 @@ message Message {
115115
google.protobuf.DoubleValue double_value_type = 23;
116116
google.protobuf.Timestamp timestamp_type = 24;
117117
google.protobuf.Duration duration_type = 25;
118+
// Description of 64-bit integer values
119+
int64 int64_type = 26;
120+
sint64 sint64_type = 27;
121+
uint64 uint64_type = 28;
122+
fixed64 fixed64_type = 29;
123+
sfixed64 sfixed64_type = 30;
118124
}

cmd/protoc-gen-openapi/examples/tests/protobuftypes/openapi.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,31 @@ paths:
150150
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
151151
type: string
152152
description: Represents a a duration between -315,576,000,000s and 315,576,000,000s (around 10000 years). Precision is in nanoseconds. 1 nanosecond is represented as 0.000000001s
153+
- name: int64_type
154+
in: query
155+
schema:
156+
type: string
157+
format: int64
158+
- name: sint64_type
159+
in: query
160+
schema:
161+
type: string
162+
format: sint64
163+
- name: uint64_type
164+
in: query
165+
schema:
166+
type: string
167+
format: uint64
168+
- name: fixed64_type
169+
in: query
170+
schema:
171+
type: string
172+
format: fixed64
173+
- name: sfixed64_type
174+
in: query
175+
schema:
176+
type: string
177+
format: sfixed64
153178
responses:
154179
"200":
155180
description: OK
@@ -315,6 +340,31 @@ paths:
315340
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
316341
type: string
317342
description: Represents a a duration between -315,576,000,000s and 315,576,000,000s (around 10000 years). Precision is in nanoseconds. 1 nanosecond is represented as 0.000000001s
343+
- name: int64_type
344+
in: query
345+
schema:
346+
type: string
347+
format: int64
348+
- name: sint64_type
349+
in: query
350+
schema:
351+
type: string
352+
format: sint64
353+
- name: uint64_type
354+
in: query
355+
schema:
356+
type: string
357+
format: uint64
358+
- name: fixed64_type
359+
in: query
360+
schema:
361+
type: string
362+
format: fixed64
363+
- name: sfixed64_type
364+
in: query
365+
schema:
366+
type: string
367+
format: sfixed64
318368
requestBody:
319369
content:
320370
application/json:
@@ -459,6 +509,21 @@ components:
459509
duration_type:
460510
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
461511
type: string
512+
int64_type:
513+
type: string
514+
format: int64
515+
sint64_type:
516+
type: string
517+
format: sint64
518+
uint64_type:
519+
type: string
520+
format: uint64
521+
fixed64_type:
522+
type: string
523+
format: fixed64
524+
sfixed64_type:
525+
type: string
526+
format: sfixed64
462527
Message_EmbMessage:
463528
type: object
464529
properties:

cmd/protoc-gen-openapi/examples/tests/protobuftypes/openapi_default_response.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,31 @@ paths:
150150
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
151151
type: string
152152
description: Represents a a duration between -315,576,000,000s and 315,576,000,000s (around 10000 years). Precision is in nanoseconds. 1 nanosecond is represented as 0.000000001s
153+
- name: int64Type
154+
in: query
155+
schema:
156+
type: string
157+
format: int64
158+
- name: sint64Type
159+
in: query
160+
schema:
161+
type: string
162+
format: sint64
163+
- name: uint64Type
164+
in: query
165+
schema:
166+
type: string
167+
format: uint64
168+
- name: fixed64Type
169+
in: query
170+
schema:
171+
type: string
172+
format: fixed64
173+
- name: sfixed64Type
174+
in: query
175+
schema:
176+
type: string
177+
format: sfixed64
153178
responses:
154179
"200":
155180
description: OK
@@ -315,6 +340,31 @@ paths:
315340
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
316341
type: string
317342
description: Represents a a duration between -315,576,000,000s and 315,576,000,000s (around 10000 years). Precision is in nanoseconds. 1 nanosecond is represented as 0.000000001s
343+
- name: int64Type
344+
in: query
345+
schema:
346+
type: string
347+
format: int64
348+
- name: sint64Type
349+
in: query
350+
schema:
351+
type: string
352+
format: sint64
353+
- name: uint64Type
354+
in: query
355+
schema:
356+
type: string
357+
format: uint64
358+
- name: fixed64Type
359+
in: query
360+
schema:
361+
type: string
362+
format: fixed64
363+
- name: sfixed64Type
364+
in: query
365+
schema:
366+
type: string
367+
format: sfixed64
318368
requestBody:
319369
content:
320370
application/json:
@@ -459,6 +509,21 @@ components:
459509
durationType:
460510
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
461511
type: string
512+
int64Type:
513+
type: string
514+
format: int64
515+
sint64Type:
516+
type: string
517+
format: sint64
518+
uint64Type:
519+
type: string
520+
format: uint64
521+
fixed64Type:
522+
type: string
523+
format: fixed64
524+
sfixed64Type:
525+
type: string
526+
format: sfixed64
462527
Message_EmbMessage:
463528
type: object
464529
properties:

cmd/protoc-gen-openapi/examples/tests/protobuftypes/openapi_fq_schema_naming.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,31 @@ paths:
150150
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
151151
type: string
152152
description: Represents a a duration between -315,576,000,000s and 315,576,000,000s (around 10000 years). Precision is in nanoseconds. 1 nanosecond is represented as 0.000000001s
153+
- name: int64Type
154+
in: query
155+
schema:
156+
type: string
157+
format: int64
158+
- name: sint64Type
159+
in: query
160+
schema:
161+
type: string
162+
format: sint64
163+
- name: uint64Type
164+
in: query
165+
schema:
166+
type: string
167+
format: uint64
168+
- name: fixed64Type
169+
in: query
170+
schema:
171+
type: string
172+
format: fixed64
173+
- name: sfixed64Type
174+
in: query
175+
schema:
176+
type: string
177+
format: sfixed64
153178
responses:
154179
"200":
155180
description: OK
@@ -315,6 +340,31 @@ paths:
315340
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
316341
type: string
317342
description: Represents a a duration between -315,576,000,000s and 315,576,000,000s (around 10000 years). Precision is in nanoseconds. 1 nanosecond is represented as 0.000000001s
343+
- name: int64Type
344+
in: query
345+
schema:
346+
type: string
347+
format: int64
348+
- name: sint64Type
349+
in: query
350+
schema:
351+
type: string
352+
format: sint64
353+
- name: uint64Type
354+
in: query
355+
schema:
356+
type: string
357+
format: uint64
358+
- name: fixed64Type
359+
in: query
360+
schema:
361+
type: string
362+
format: fixed64
363+
- name: sfixed64Type
364+
in: query
365+
schema:
366+
type: string
367+
format: sfixed64
318368
requestBody:
319369
content:
320370
application/json:
@@ -475,6 +525,21 @@ components:
475525
durationType:
476526
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
477527
type: string
528+
int64Type:
529+
type: string
530+
format: int64
531+
sint64Type:
532+
type: string
533+
format: sint64
534+
uint64Type:
535+
type: string
536+
format: uint64
537+
fixed64Type:
538+
type: string
539+
format: fixed64
540+
sfixed64Type:
541+
type: string
542+
format: sfixed64
478543
tests.protobuftypes.message.v1.Message_EmbMessage:
479544
type: object
480545
properties:

cmd/protoc-gen-openapi/examples/tests/protobuftypes/openapi_json.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,31 @@ paths:
150150
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
151151
type: string
152152
description: Represents a a duration between -315,576,000,000s and 315,576,000,000s (around 10000 years). Precision is in nanoseconds. 1 nanosecond is represented as 0.000000001s
153+
- name: int64Type
154+
in: query
155+
schema:
156+
type: string
157+
format: int64
158+
- name: sint64Type
159+
in: query
160+
schema:
161+
type: string
162+
format: sint64
163+
- name: uint64Type
164+
in: query
165+
schema:
166+
type: string
167+
format: uint64
168+
- name: fixed64Type
169+
in: query
170+
schema:
171+
type: string
172+
format: fixed64
173+
- name: sfixed64Type
174+
in: query
175+
schema:
176+
type: string
177+
format: sfixed64
153178
responses:
154179
"200":
155180
description: OK
@@ -315,6 +340,31 @@ paths:
315340
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
316341
type: string
317342
description: Represents a a duration between -315,576,000,000s and 315,576,000,000s (around 10000 years). Precision is in nanoseconds. 1 nanosecond is represented as 0.000000001s
343+
- name: int64Type
344+
in: query
345+
schema:
346+
type: string
347+
format: int64
348+
- name: sint64Type
349+
in: query
350+
schema:
351+
type: string
352+
format: sint64
353+
- name: uint64Type
354+
in: query
355+
schema:
356+
type: string
357+
format: uint64
358+
- name: fixed64Type
359+
in: query
360+
schema:
361+
type: string
362+
format: fixed64
363+
- name: sfixed64Type
364+
in: query
365+
schema:
366+
type: string
367+
format: sfixed64
318368
requestBody:
319369
content:
320370
application/json:
@@ -459,6 +509,21 @@ components:
459509
durationType:
460510
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
461511
type: string
512+
int64Type:
513+
type: string
514+
format: int64
515+
sint64Type:
516+
type: string
517+
format: sint64
518+
uint64Type:
519+
type: string
520+
format: uint64
521+
fixed64Type:
522+
type: string
523+
format: fixed64
524+
sfixed64Type:
525+
type: string
526+
format: sfixed64
462527
Message_EmbMessage:
463528
type: object
464529
properties:

0 commit comments

Comments
 (0)