diff --git a/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi.yaml b/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi.yaml index c63dc62e..82fdf247 100644 --- a/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi.yaml @@ -42,7 +42,8 @@ components: type: object properties: id: - type: string + type: integer + format: int64 label: type: string GoogleProtobufAny: @@ -90,7 +91,8 @@ components: type: object properties: id: - type: string + type: integer + format: int64 label: type: string Status: diff --git a/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_default_response.yaml b/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_default_response.yaml index 4d510192..7c2a594e 100644 --- a/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_default_response.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_default_response.yaml @@ -42,7 +42,8 @@ components: type: object properties: id: - type: string + type: integer + format: int64 label: type: string GoogleProtobufAny: @@ -90,7 +91,8 @@ components: type: object properties: id: - type: string + type: integer + format: int64 label: type: string Status: diff --git a/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_fq_schema_naming.yaml b/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_fq_schema_naming.yaml index 1c343d1e..364104b1 100644 --- a/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_fq_schema_naming.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_fq_schema_naming.yaml @@ -66,7 +66,8 @@ components: type: object properties: id: - type: string + type: integer + format: int64 label: type: string tests.mapfields.message.v1.Message: @@ -106,7 +107,8 @@ components: type: object properties: id: - type: string + type: integer + format: int64 label: type: string tags: diff --git a/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_json.yaml b/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_json.yaml index 8e8b796e..239a451b 100644 --- a/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_json.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_json.yaml @@ -42,7 +42,8 @@ components: type: object properties: id: - type: string + type: integer + format: int64 label: type: string GoogleProtobufAny: @@ -90,7 +91,8 @@ components: type: object properties: id: - type: string + type: integer + format: int64 label: type: string Status: diff --git a/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_string_enum.yaml b/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_string_enum.yaml index 4d510192..7c2a594e 100644 --- a/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_string_enum.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_string_enum.yaml @@ -42,7 +42,8 @@ components: type: object properties: id: - type: string + type: integer + format: int64 label: type: string GoogleProtobufAny: @@ -90,7 +91,8 @@ components: type: object properties: id: - type: string + type: integer + format: int64 label: type: string Status: diff --git a/cmd/protoc-gen-openapi/examples/tests/noannotations/openapi.yaml b/cmd/protoc-gen-openapi/examples/tests/noannotations/openapi.yaml index d00cbb93..2ea9e80d 100644 --- a/cmd/protoc-gen-openapi/examples/tests/noannotations/openapi.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/noannotations/openapi.yaml @@ -50,7 +50,8 @@ components: type: object properties: id: - type: string + type: integer + format: int64 label: type: string Status: diff --git a/cmd/protoc-gen-openapi/examples/tests/noannotations/openapi_default_response.yaml b/cmd/protoc-gen-openapi/examples/tests/noannotations/openapi_default_response.yaml index d00cbb93..2ea9e80d 100644 --- a/cmd/protoc-gen-openapi/examples/tests/noannotations/openapi_default_response.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/noannotations/openapi_default_response.yaml @@ -50,7 +50,8 @@ components: type: object properties: id: - type: string + type: integer + format: int64 label: type: string Status: diff --git a/cmd/protoc-gen-openapi/examples/tests/noannotations/openapi_fq_schema_naming.yaml b/cmd/protoc-gen-openapi/examples/tests/noannotations/openapi_fq_schema_naming.yaml index 7f2e9e79..15ebb2f8 100644 --- a/cmd/protoc-gen-openapi/examples/tests/noannotations/openapi_fq_schema_naming.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/noannotations/openapi_fq_schema_naming.yaml @@ -66,7 +66,8 @@ components: type: object properties: id: - type: string + type: integer + format: int64 label: type: string tags: diff --git a/cmd/protoc-gen-openapi/examples/tests/noannotations/openapi_json.yaml b/cmd/protoc-gen-openapi/examples/tests/noannotations/openapi_json.yaml index d7d35208..f95d58e1 100644 --- a/cmd/protoc-gen-openapi/examples/tests/noannotations/openapi_json.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/noannotations/openapi_json.yaml @@ -50,7 +50,8 @@ components: type: object properties: id: - type: string + type: integer + format: int64 label: type: string Status: diff --git a/cmd/protoc-gen-openapi/examples/tests/noannotations/openapi_string_enum.yaml b/cmd/protoc-gen-openapi/examples/tests/noannotations/openapi_string_enum.yaml index d00cbb93..2ea9e80d 100644 --- a/cmd/protoc-gen-openapi/examples/tests/noannotations/openapi_string_enum.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/noannotations/openapi_string_enum.yaml @@ -50,7 +50,8 @@ components: type: object properties: id: - type: string + type: integer + format: int64 label: type: string Status: diff --git a/cmd/protoc-gen-openapi/examples/tests/openapiv3annotations/openapi.yaml b/cmd/protoc-gen-openapi/examples/tests/openapiv3annotations/openapi.yaml index b1e31f0f..c6bf264f 100644 --- a/cmd/protoc-gen-openapi/examples/tests/openapiv3annotations/openapi.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/openapiv3annotations/openapi.yaml @@ -61,7 +61,8 @@ components: type: object properties: id: - type: string + type: integer + format: int64 label: title: this is an overriden field schema title maxLength: 255 diff --git a/cmd/protoc-gen-openapi/examples/tests/openapiv3annotations/openapi_default_response.yaml b/cmd/protoc-gen-openapi/examples/tests/openapiv3annotations/openapi_default_response.yaml index b1e31f0f..c6bf264f 100644 --- a/cmd/protoc-gen-openapi/examples/tests/openapiv3annotations/openapi_default_response.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/openapiv3annotations/openapi_default_response.yaml @@ -61,7 +61,8 @@ components: type: object properties: id: - type: string + type: integer + format: int64 label: title: this is an overriden field schema title maxLength: 255 diff --git a/cmd/protoc-gen-openapi/examples/tests/openapiv3annotations/openapi_fq_schema_naming.yaml b/cmd/protoc-gen-openapi/examples/tests/openapiv3annotations/openapi_fq_schema_naming.yaml index 5dbbceca..8d643968 100644 --- a/cmd/protoc-gen-openapi/examples/tests/openapiv3annotations/openapi_fq_schema_naming.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/openapiv3annotations/openapi_fq_schema_naming.yaml @@ -77,7 +77,8 @@ components: type: object properties: id: - type: string + type: integer + format: int64 label: title: this is an overriden field schema title maxLength: 255 diff --git a/cmd/protoc-gen-openapi/examples/tests/openapiv3annotations/openapi_json.yaml b/cmd/protoc-gen-openapi/examples/tests/openapiv3annotations/openapi_json.yaml index b1e31f0f..c6bf264f 100644 --- a/cmd/protoc-gen-openapi/examples/tests/openapiv3annotations/openapi_json.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/openapiv3annotations/openapi_json.yaml @@ -61,7 +61,8 @@ components: type: object properties: id: - type: string + type: integer + format: int64 label: title: this is an overriden field schema title maxLength: 255 diff --git a/cmd/protoc-gen-openapi/examples/tests/openapiv3annotations/openapi_string_enum.yaml b/cmd/protoc-gen-openapi/examples/tests/openapiv3annotations/openapi_string_enum.yaml index b1e31f0f..c6bf264f 100644 --- a/cmd/protoc-gen-openapi/examples/tests/openapiv3annotations/openapi_string_enum.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/openapiv3annotations/openapi_string_enum.yaml @@ -61,7 +61,8 @@ components: type: object properties: id: - type: string + type: integer + format: int64 label: title: this is an overriden field schema title maxLength: 255 diff --git a/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi.yaml b/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi.yaml index f65b66d2..ac3eb30d 100644 --- a/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi.yaml @@ -20,7 +20,8 @@ paths: - name: user_id in: query schema: - type: string + type: integer + format: uint64 responses: "200": description: OK @@ -73,7 +74,8 @@ paths: in: path required: true schema: - type: string + type: integer + format: uint64 - name: message_id in: path required: true @@ -108,7 +110,8 @@ components: message_id: type: string user_id: - type: string + type: integer + format: uint64 content: type: string maybe: diff --git a/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_default_response.yaml b/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_default_response.yaml index 470bab61..e668a88b 100644 --- a/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_default_response.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_default_response.yaml @@ -20,7 +20,8 @@ paths: - name: userId in: query schema: - type: string + type: integer + format: uint64 responses: "200": description: OK @@ -73,7 +74,8 @@ paths: in: path required: true schema: - type: string + type: integer + format: uint64 - name: messageId in: path required: true @@ -108,7 +110,8 @@ components: messageId: type: string userId: - type: string + type: integer + format: uint64 content: type: string maybe: diff --git a/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_fq_schema_naming.yaml b/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_fq_schema_naming.yaml index f682585d..0c7fe385 100644 --- a/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_fq_schema_naming.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_fq_schema_naming.yaml @@ -20,7 +20,8 @@ paths: - name: userId in: query schema: - type: string + type: integer + format: uint64 responses: "200": description: OK @@ -73,7 +74,8 @@ paths: in: path required: true schema: - type: string + type: integer + format: uint64 - name: messageId in: path required: true @@ -124,7 +126,8 @@ components: messageId: type: string userId: - type: string + type: integer + format: uint64 content: type: string maybe: diff --git a/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_json.yaml b/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_json.yaml index ff7d0a3d..c1e9a697 100644 --- a/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_json.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_json.yaml @@ -20,7 +20,8 @@ paths: - name: userId in: query schema: - type: string + type: integer + format: uint64 responses: "200": description: OK @@ -73,7 +74,8 @@ paths: in: path required: true schema: - type: string + type: integer + format: uint64 - name: messageId in: path required: true @@ -108,7 +110,8 @@ components: messageId: type: string userId: - type: string + type: integer + format: uint64 content: type: string maybe: diff --git a/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_string_enum.yaml b/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_string_enum.yaml index 470bab61..e668a88b 100644 --- a/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_string_enum.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_string_enum.yaml @@ -20,7 +20,8 @@ paths: - name: userId in: query schema: - type: string + type: integer + format: uint64 responses: "200": description: OK @@ -73,7 +74,8 @@ paths: in: path required: true schema: - type: string + type: integer + format: uint64 - name: messageId in: path required: true @@ -108,7 +110,8 @@ components: messageId: type: string userId: - type: string + type: integer + format: uint64 content: type: string maybe: diff --git a/cmd/protoc-gen-openapi/generator/reflector.go b/cmd/protoc-gen-openapi/generator/reflector.go index 31a0f930..4016b31f 100644 --- a/cmd/protoc-gen-openapi/generator/reflector.go +++ b/cmd/protoc-gen-openapi/generator/reflector.go @@ -208,13 +208,11 @@ func (r *OpenAPIv3Reflector) schemaOrReferenceForField(field protoreflect.FieldD kindSchema = wk.NewStringSchema() case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Uint32Kind, - protoreflect.Sfixed32Kind, protoreflect.Fixed32Kind: + protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Uint64Kind, + protoreflect.Sfixed32Kind, protoreflect.Fixed32Kind, protoreflect.Sfixed64Kind, + protoreflect.Fixed64Kind: kindSchema = wk.NewIntegerSchema(kind.String()) - case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Uint64Kind, - protoreflect.Sfixed64Kind, protoreflect.Fixed64Kind: - kindSchema = wk.NewStringSchema() - case protoreflect.EnumKind: kindSchema = wk.NewEnumSchema(*&r.conf.EnumType, field)