Closed zboralski closed 5 years ago
It doesn't seem to put a basepath in the swagger file?
https://github.com/elliots/protoc-gen-twirp_swagger/blob/master/example/service.swagger.json
It might be an option in swagger-codegen-cli.
My workaround:
retool do protoc --go_out=. --twirp_out=. --twirp_swagger_out=. ./rpc/search/service.proto
perl -pi -e '$_ .= qq( "host": "XXX.appspot.com",\n) if /"swagger": "2.0",/' rpc/search/service.swagger.json
perl -pi -e '$_ = qq() if /^\s+"http",/' rpc/search/service.swagger.json
swagger-codegen generate -l swift4 -c swagger-codegen.config.json -i rpc/search/service.swagger.json -o $HOME/iOS/src/XXX/iOS/
@zboralski base_path works well for me. This is what my proto file looks like:
syntax = "proto3";
package x;
option go_package = "x";
import "protoc-gen-swagger/options/annotations.proto";
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = {
host: "<host-url>";
base_path: "<base-path>";
};
// rest of the file
I'm unfamiliar with the swagger-codegen generate
, but I do know that protoc-gen-twirp_swagger
does correctly put the basePath
in the created json
file.
I'll close the issue but feel free to re-open if I misinterpreted anything.
Thanks
Is there a way to specify basepath so that it is set to something else than localhost in the generated swagger file?