Skip to content

Use Docker to generate swagger files #7933

Closed
@amaury1093

Description

Summary

To not install binaries on the user's local machine, use Docker for proto swagger generation.

Problem Definition

In protoc-swagger-gen.sh, we rely on a globally installed swagger-combine binary to combine all the generated swagger files into one. This may lead to incompatible versions used by different devs on the cosmos-sdk, leading to unwanted file diff in generated files.

# combine swagger files
# uses nodejs package `swagger-combine`.
# all the individual swagger files need to be configured in `config.json` for merging
swagger-combine ./client/docs/config.json -o ./client/docs/swagger-ui/swagger.yaml -f yaml --continueOnConflictingPaths true --includeDefinitions true

Proposal

Following #7332, we should containerize swagger-combine (maybe in the same Dockerfile as buf/protoc?), and update the following Makefile target to use Docker:

cosmos-sdk/Makefile

Lines 380 to 381 in 4b529a4

proto-swagger-gen:
@./scripts/protoc-swagger-gen.sh


For Admin Use

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

Metadata

Assignees

No one assigned

    Labels

    T: Dev UXUX for SDK developers (i.e. how to call our code)

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions