Skip to content

Commit

Permalink
feat: Support format for 64-bit integer field types
Browse files Browse the repository at this point in the history
  • Loading branch information
esraaghanemali committed Oct 15, 2023
1 parent ee84fd2 commit 775f962
Show file tree
Hide file tree
Showing 8 changed files with 338 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,10 @@ message Message {
google.protobuf.DoubleValue double_value_type = 23;
google.protobuf.Timestamp timestamp_type = 24;
google.protobuf.Duration duration_type = 25;
// Description of 64-bit integer values
string int64_type = 26;
string sint64_type = 27;
string uint64_type = 28;
string fixed64_type = 29;
string sfixed64_type = 30;
}
65 changes: 65 additions & 0 deletions cmd/protoc-gen-openapi/examples/tests/protobuftypes/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,31 @@ paths:
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
type: string
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
- name: int64_type
in: query
schema:
type: string
format: int64
- name: sint64_type
in: query
schema:
type: string
format: sint64
- name: uint64_type
in: query
schema:
type: string
format: uint64
- name: fixed64_type
in: query
schema:
type: string
format: fixed64
- name: sfixed64_type
in: query
schema:
type: string
format: sfixed64
responses:
"200":
description: OK
Expand Down Expand Up @@ -315,6 +340,31 @@ paths:
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
type: string
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
- name: int64_type
in: query
schema:
type: string
format: int64
- name: sint64_type
in: query
schema:
type: string
format: sint64
- name: uint64_type
in: query
schema:
type: string
format: uint64
- name: fixed64_type
in: query
schema:
type: string
format: fixed64
- name: sfixed64_type
in: query
schema:
type: string
format: sfixed64
requestBody:
content:
application/json:
Expand Down Expand Up @@ -459,6 +509,21 @@ components:
duration_type:
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
type: string
int64_type:
type: string
format: int64
sint64_type:
type: string
format: sint64
uint64_type:
type: string
format: uint64
fixed64_type:
type: string
format: fixed64
sfixed64_type:
type: string
format: sfixed64
Message_EmbMessage:
type: object
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,31 @@ paths:
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
type: string
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
- name: int64Type
in: query
schema:
type: string
format: int64
- name: sint64Type
in: query
schema:
type: string
format: sint64
- name: uint64Type
in: query
schema:
type: string
format: uint64
- name: fixed64Type
in: query
schema:
type: string
format: fixed64
- name: sfixed64Type
in: query
schema:
type: string
format: sfixed64
responses:
"200":
description: OK
Expand Down Expand Up @@ -315,6 +340,31 @@ paths:
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
type: string
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
- name: int64Type
in: query
schema:
type: string
format: int64
- name: sint64Type
in: query
schema:
type: string
format: sint64
- name: uint64Type
in: query
schema:
type: string
format: uint64
- name: fixed64Type
in: query
schema:
type: string
format: fixed64
- name: sfixed64Type
in: query
schema:
type: string
format: sfixed64
requestBody:
content:
application/json:
Expand Down Expand Up @@ -459,6 +509,21 @@ components:
durationType:
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
type: string
int64Type:
type: string
format: int64
sint64Type:
type: string
format: sint64
uint64Type:
type: string
format: uint64
fixed64Type:
type: string
format: fixed64
sfixed64Type:
type: string
format: sfixed64
Message_EmbMessage:
type: object
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,31 @@ paths:
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
type: string
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
- name: int64Type
in: query
schema:
type: string
format: int64
- name: sint64Type
in: query
schema:
type: string
format: sint64
- name: uint64Type
in: query
schema:
type: string
format: uint64
- name: fixed64Type
in: query
schema:
type: string
format: fixed64
- name: sfixed64Type
in: query
schema:
type: string
format: sfixed64
responses:
"200":
description: OK
Expand Down Expand Up @@ -315,6 +340,31 @@ paths:
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
type: string
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
- name: int64Type
in: query
schema:
type: string
format: int64
- name: sint64Type
in: query
schema:
type: string
format: sint64
- name: uint64Type
in: query
schema:
type: string
format: uint64
- name: fixed64Type
in: query
schema:
type: string
format: fixed64
- name: sfixed64Type
in: query
schema:
type: string
format: sfixed64
requestBody:
content:
application/json:
Expand Down Expand Up @@ -475,6 +525,21 @@ components:
durationType:
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
type: string
int64Type:
type: string
format: int64
sint64Type:
type: string
format: sint64
uint64Type:
type: string
format: uint64
fixed64Type:
type: string
format: fixed64
sfixed64Type:
type: string
format: sfixed64
tests.protobuftypes.message.v1.Message_EmbMessage:
type: object
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,31 @@ paths:
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
type: string
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
- name: int64Type
in: query
schema:
type: string
format: int64
- name: sint64Type
in: query
schema:
type: string
format: sint64
- name: uint64Type
in: query
schema:
type: string
format: uint64
- name: fixed64Type
in: query
schema:
type: string
format: fixed64
- name: sfixed64Type
in: query
schema:
type: string
format: sfixed64
responses:
"200":
description: OK
Expand Down Expand Up @@ -315,6 +340,31 @@ paths:
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
type: string
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
- name: int64Type
in: query
schema:
type: string
format: int64
- name: sint64Type
in: query
schema:
type: string
format: sint64
- name: uint64Type
in: query
schema:
type: string
format: uint64
- name: fixed64Type
in: query
schema:
type: string
format: fixed64
- name: sfixed64Type
in: query
schema:
type: string
format: sfixed64
requestBody:
content:
application/json:
Expand Down Expand Up @@ -459,6 +509,21 @@ components:
durationType:
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
type: string
int64Type:
type: string
format: int64
sint64Type:
type: string
format: sint64
uint64Type:
type: string
format: uint64
fixed64Type:
type: string
format: fixed64
sfixed64Type:
type: string
format: sfixed64
Message_EmbMessage:
type: object
properties:
Expand Down
Loading

0 comments on commit 775f962

Please sign in to comment.