Skip to content
This repository has been archived by the owner on May 3, 2023. It is now read-only.

Handle google/protobuf/wrappers.proto types on protoc-gen-openapi #1

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
10 changes: 10 additions & 0 deletions cmd/protoc-gen-openapi/examples/tests/protobuftypes/message.proto
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import "google/api/annotations.proto";
import "google/api/httpbody.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/wrappers.proto";

option go_package = "github.com/google/gnostic/apps/protoc-gen-openapi/examples/tests/protobuftypes/message/v1;message";

Expand Down Expand Up @@ -101,4 +102,13 @@ message Message {
google.protobuf.Value value_type = 13;
// Description of repeated value
repeated google.protobuf.Value repeated_value_type = 14;
google.protobuf.BoolValue bool_value_type = 15;
google.protobuf.BytesValue bytes_value_type = 16;
google.protobuf.Int32Value int32_value_type = 17;
google.protobuf.UInt32Value uint32_value_type = 18;
google.protobuf.StringValue string_value_type = 19;
google.protobuf.Int64Value int64_value_type = 20;
google.protobuf.UInt64Value uint64_value_type = 21;
google.protobuf.FloatValue float_value_type = 22;
google.protobuf.DoubleValue double_value_type = 23;
}
105 changes: 105 additions & 0 deletions cmd/protoc-gen-openapi/examples/tests/protobuftypes/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,47 @@ paths:
type: array
items:
$ref: '#/components/schemas/GoogleProtobufValue'
- name: bool_value_type
in: query
schema:
type: boolean
- name: bytes_value_type
in: query
schema:
type: string
format: bytes
- name: int32_value_type
in: query
schema:
type: integer
format: int32
- name: uint32_value_type
in: query
schema:
type: integer
format: uint32
- name: string_value_type
in: query
schema:
type: string
- name: int64_value_type
in: query
schema:
type: string
- name: uint64_value_type
in: query
schema:
type: string
- name: float_value_type
in: query
schema:
type: number
format: float
- name: double_value_type
in: query
schema:
type: number
format: double
responses:
"200":
description: OK
Expand Down Expand Up @@ -211,6 +252,47 @@ paths:
type: array
items:
$ref: '#/components/schemas/GoogleProtobufValue'
- name: bool_value_type
in: query
schema:
type: boolean
- name: bytes_value_type
in: query
schema:
type: string
format: bytes
- name: int32_value_type
in: query
schema:
type: integer
format: int32
- name: uint32_value_type
in: query
schema:
type: integer
format: uint32
- name: string_value_type
in: query
schema:
type: string
- name: int64_value_type
in: query
schema:
type: string
- name: uint64_value_type
in: query
schema:
type: string
- name: float_value_type
in: query
schema:
type: number
format: float
- name: double_value_type
in: query
schema:
type: number
format: double
requestBody:
content:
application/json:
Expand Down Expand Up @@ -326,6 +408,29 @@ components:
items:
$ref: '#/components/schemas/GoogleProtobufValue'
description: Description of repeated value
bool_value_type:
type: boolean
bytes_value_type:
type: string
format: bytes
int32_value_type:
type: integer
format: int32
uint32_value_type:
type: integer
format: uint32
string_value_type:
type: string
int64_value_type:
type: string
uint64_value_type:
type: string
float_value_type:
type: number
format: float
double_value_type:
type: number
format: double
Message_EmbMessage:
type: object
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,47 @@ paths:
type: array
items:
$ref: '#/components/schemas/GoogleProtobufValue'
- name: boolValueType
in: query
schema:
type: boolean
- name: bytesValueType
in: query
schema:
type: string
format: bytes
- name: int32ValueType
in: query
schema:
type: integer
format: int32
- name: uint32ValueType
in: query
schema:
type: integer
format: uint32
- name: stringValueType
in: query
schema:
type: string
- name: int64ValueType
in: query
schema:
type: string
- name: uint64ValueType
in: query
schema:
type: string
- name: floatValueType
in: query
schema:
type: number
format: float
- name: doubleValueType
in: query
schema:
type: number
format: double
responses:
"200":
description: OK
Expand Down Expand Up @@ -211,6 +252,47 @@ paths:
type: array
items:
$ref: '#/components/schemas/GoogleProtobufValue'
- name: boolValueType
in: query
schema:
type: boolean
- name: bytesValueType
in: query
schema:
type: string
format: bytes
- name: int32ValueType
in: query
schema:
type: integer
format: int32
- name: uint32ValueType
in: query
schema:
type: integer
format: uint32
- name: stringValueType
in: query
schema:
type: string
- name: int64ValueType
in: query
schema:
type: string
- name: uint64ValueType
in: query
schema:
type: string
- name: floatValueType
in: query
schema:
type: number
format: float
- name: doubleValueType
in: query
schema:
type: number
format: double
requestBody:
content:
application/json:
Expand Down Expand Up @@ -326,6 +408,29 @@ components:
items:
$ref: '#/components/schemas/GoogleProtobufValue'
description: Description of repeated value
boolValueType:
type: boolean
bytesValueType:
type: string
format: bytes
int32ValueType:
type: integer
format: int32
uint32ValueType:
type: integer
format: uint32
stringValueType:
type: string
int64ValueType:
type: string
uint64ValueType:
type: string
floatValueType:
type: number
format: float
doubleValueType:
type: number
format: double
Message_EmbMessage:
type: object
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,47 @@ paths:
type: array
items:
$ref: '#/components/schemas/google.protobuf.Value'
- name: boolValueType
in: query
schema:
type: boolean
- name: bytesValueType
in: query
schema:
type: string
format: bytes
- name: int32ValueType
in: query
schema:
type: integer
format: int32
- name: uint32ValueType
in: query
schema:
type: integer
format: uint32
- name: stringValueType
in: query
schema:
type: string
- name: int64ValueType
in: query
schema:
type: string
- name: uint64ValueType
in: query
schema:
type: string
- name: floatValueType
in: query
schema:
type: number
format: float
- name: doubleValueType
in: query
schema:
type: number
format: double
responses:
"200":
description: OK
Expand Down Expand Up @@ -211,6 +252,47 @@ paths:
type: array
items:
$ref: '#/components/schemas/google.protobuf.Value'
- name: boolValueType
in: query
schema:
type: boolean
- name: bytesValueType
in: query
schema:
type: string
format: bytes
- name: int32ValueType
in: query
schema:
type: integer
format: int32
- name: uint32ValueType
in: query
schema:
type: integer
format: uint32
- name: stringValueType
in: query
schema:
type: string
- name: int64ValueType
in: query
schema:
type: string
- name: uint64ValueType
in: query
schema:
type: string
- name: floatValueType
in: query
schema:
type: number
format: float
- name: doubleValueType
in: query
schema:
type: number
format: double
requestBody:
content:
application/json:
Expand Down Expand Up @@ -342,6 +424,29 @@ components:
items:
$ref: '#/components/schemas/google.protobuf.Value'
description: Description of repeated value
boolValueType:
type: boolean
bytesValueType:
type: string
format: bytes
int32ValueType:
type: integer
format: int32
uint32ValueType:
type: integer
format: uint32
stringValueType:
type: string
int64ValueType:
type: string
uint64ValueType:
type: string
floatValueType:
type: number
format: float
doubleValueType:
type: number
format: double
tests.protobuftypes.message.v1.Message_EmbMessage:
type: object
properties:
Expand Down
Loading