Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[+] support integer64 as string option #355

Merged
merged 2 commits into from
May 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ components:
type: object
properties:
id:
type: integer
format: int64
type: string
label:
type: string
GoogleProtobufAny:
Expand Down Expand Up @@ -91,8 +90,7 @@ components:
type: object
properties:
id:
type: integer
format: int64
type: string
label:
type: string
Status:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ components:
type: object
properties:
id:
type: integer
format: int64
type: string
label:
type: string
GoogleProtobufAny:
Expand Down Expand Up @@ -91,8 +90,7 @@ components:
type: object
properties:
id:
type: integer
format: int64
type: string
label:
type: string
Status:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ components:
type: object
properties:
id:
type: integer
format: int64
type: string
label:
type: string
tests.mapfields.message.v1.Message:
Expand Down Expand Up @@ -107,8 +106,7 @@ components:
type: object
properties:
id:
type: integer
format: int64
type: string
label:
type: string
tags:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ components:
type: object
properties:
id:
type: integer
format: int64
type: string
label:
type: string
GoogleProtobufAny:
Expand Down Expand Up @@ -91,8 +90,7 @@ components:
type: object
properties:
id:
type: integer
format: int64
type: string
label:
type: string
Status:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ components:
type: object
properties:
id:
type: integer
format: int64
type: string
label:
type: string
GoogleProtobufAny:
Expand Down Expand Up @@ -91,8 +90,7 @@ components:
type: object
properties:
id:
type: integer
format: int64
type: string
label:
type: string
Status:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ components:
type: object
properties:
id:
type: integer
format: int64
type: string
label:
type: string
Status:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ components:
type: object
properties:
id:
type: integer
format: int64
type: string
label:
type: string
Status:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ components:
type: object
properties:
id:
type: integer
format: int64
type: string
label:
type: string
tags:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ components:
type: object
properties:
id:
type: integer
format: int64
type: string
label:
type: string
Status:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ components:
type: object
properties:
id:
type: integer
format: int64
type: string
label:
type: string
Status:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ components:
type: object
properties:
id:
type: integer
format: int64
type: string
label:
title: this is an overriden field schema title
maxLength: 255
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ components:
type: object
properties:
id:
type: integer
format: int64
type: string
label:
title: this is an overriden field schema title
maxLength: 255
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ components:
type: object
properties:
id:
type: integer
format: int64
type: string
label:
title: this is an overriden field schema title
maxLength: 255
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ components:
type: object
properties:
id:
type: integer
format: int64
type: string
label:
title: this is an overriden field schema title
maxLength: 255
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ components:
type: object
properties:
id:
type: integer
format: int64
type: string
label:
title: this is an overriden field schema title
maxLength: 255
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ paths:
- name: user_id
in: query
schema:
type: integer
format: uint64
type: string
responses:
"200":
description: OK
Expand Down Expand Up @@ -74,8 +73,7 @@ paths:
in: path
required: true
schema:
type: integer
format: uint64
type: string
- name: message_id
in: path
required: true
Expand Down Expand Up @@ -110,8 +108,7 @@ components:
message_id:
type: string
user_id:
type: integer
format: uint64
type: string
content:
type: string
maybe:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ paths:
- name: userId
in: query
schema:
type: integer
format: uint64
type: string
responses:
"200":
description: OK
Expand Down Expand Up @@ -74,8 +73,7 @@ paths:
in: path
required: true
schema:
type: integer
format: uint64
type: string
- name: messageId
in: path
required: true
Expand Down Expand Up @@ -110,8 +108,7 @@ components:
messageId:
type: string
userId:
type: integer
format: uint64
type: string
content:
type: string
maybe:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ paths:
- name: userId
in: query
schema:
type: integer
format: uint64
type: string
responses:
"200":
description: OK
Expand Down Expand Up @@ -74,8 +73,7 @@ paths:
in: path
required: true
schema:
type: integer
format: uint64
type: string
- name: messageId
in: path
required: true
Expand Down Expand Up @@ -126,8 +124,7 @@ components:
messageId:
type: string
userId:
type: integer
format: uint64
type: string
content:
type: string
maybe:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ paths:
- name: userId
in: query
schema:
type: integer
format: uint64
type: string
responses:
"200":
description: OK
Expand Down Expand Up @@ -74,8 +73,7 @@ paths:
in: path
required: true
schema:
type: integer
format: uint64
type: string
- name: messageId
in: path
required: true
Expand Down Expand Up @@ -110,8 +108,7 @@ components:
messageId:
type: string
userId:
type: integer
format: uint64
type: string
content:
type: string
maybe:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ paths:
- name: userId
in: query
schema:
type: integer
format: uint64
type: string
responses:
"200":
description: OK
Expand Down Expand Up @@ -74,8 +73,7 @@ paths:
in: path
required: true
schema:
type: integer
format: uint64
type: string
- name: messageId
in: path
required: true
Expand Down Expand Up @@ -110,8 +108,7 @@ components:
messageId:
type: string
userId:
type: integer
format: uint64
type: string
content:
type: string
maybe:
Expand Down
8 changes: 5 additions & 3 deletions cmd/protoc-gen-openapi/generator/reflector.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,13 @@ func (r *OpenAPIv3Reflector) schemaOrReferenceForField(field protoreflect.FieldD
kindSchema = wk.NewStringSchema()

case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Uint32Kind,
protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Uint64Kind,
protoreflect.Sfixed32Kind, protoreflect.Fixed32Kind, protoreflect.Sfixed64Kind,
protoreflect.Fixed64Kind:
protoreflect.Sfixed32Kind, protoreflect.Fixed32Kind:
kindSchema = wk.NewIntegerSchema(kind.String())

case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Uint64Kind,
protoreflect.Sfixed64Kind, protoreflect.Fixed64Kind:
kindSchema = wk.NewStringSchema()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great - such a clear and simple change! Thanks!

case protoreflect.EnumKind:
kindSchema = wk.NewEnumSchema(*&r.conf.EnumType, field)

Expand Down