cosmos-sdk icon indicating copy to clipboard operation
cosmos-sdk copied to clipboard

Update usages of protoc-gen-swagger to protoc-gen-openapiv2

Open clevinson opened this issue 5 years ago • 5 comments

Summary

GRPC Gateway has renamed the protoc-gen-swagger package to protoc-gen-openapiv2 (see here). We need to update the go get references in ./contrib/devtools/proto-tools-installer.sh here. There are possibly other places where this rename has caused issues, so we should investigate what else may broken by this.

Note: This was originally reported as a bug, but in actuality, when running make proto-tools go-get will find the old version of grpc-gateway that has the protoc-gen-swagger subdirectory.

Despite this not actually breaking anything currently, I think it would be a good idea for us to update to use protoc-gen-openapiv2, as this will get built from the current version of grpc-gateway, which does not happen for the protoc-gen-swagger binary.

Steps to Reproduce

make proto-tools


For Admin Use

  • [ ] Not duplicate issue
  • [ ] Appropriate labels applied
  • [ ] Appropriate contributors tagged
  • [ ] Contributor assigned/self-assigned

clevinson avatar Oct 21 '20 21:10 clevinson

@anilCSE Any reason why we shouldn't update this? The latest version with protoc-gen-swagger is v1.15.2

clevinson avatar Oct 21 '20 22:10 clevinson

@anilCSE Any reason why we shouldn't update this? The latest version with protoc-gen-swagger is v1.15.2

No strong reasons, we can update. We need to investigate the changes before updating this may be. I can spend some time on this.

anilcse avatar Oct 22 '20 13:10 anilcse

Hi, Any updates on this?

I found that protoc-gen-swagger translate protobuf.Any to not correct structure, while protoc-gen-openapiv2 has no this issue.

The issue is that protobuf.Any generated by protoc-gen-swagger is the structure like:

google.protobuf.Any:
    type: object
    properties:
      type_url:
        type: string
      value:
        type: string
        format: byte
        description: >-
          Must be a valid serialized protocol buffer of the above specified
          type.

image

The expected structure is like the structure generated by protoc-gen-openapiv2

google.protobuf.Any:
    type: object
    properties:
      '@type':
        type: string
    additionalProperties: {}

image

dadamu avatar May 09 '24 10:05 dadamu

we want to upgrade, but haven't had the capacity to do so, we will look into it

tac0turtle avatar May 09 '24 11:05 tac0turtle

@tac0turtle I updated it to fulfill my needs. If you feels it is okay, I can submit a PR: https://github.com/dadamu/cosmos-sdk/commit/9cea181a3d1fce06ee02bc46e7afda1d133e48a0

dadamu avatar May 17 '24 06:05 dadamu