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

Path params generated with expand_slashed_path_patterns=true have type number #4865

Closed
czabaj opened this issue Oct 23, 2024 · 2 comments · Fixed by #4866
Closed

Path params generated with expand_slashed_path_patterns=true have type number #4865

czabaj opened this issue Oct 23, 2024 · 2 comments · Fixed by #4866

Comments

@czabaj
Copy link
Contributor

czabaj commented Oct 23, 2024

🐛 Bug Report

This is a follow-up to the issue #4784 (closed PR #4813) - the path parameters generated with the expand_slashed_path_patterns=true compiler option have an OpenAPI type type: number with format: double.

To Reproduce

Have a protobuf definition with Google AIP style path parameters, e.g.

rpc GetBook(GetBookRequest) returns (Book) {
  option (google.api.http) = {
    get: "/v1/{name=publishers/*/books/*}"
  };
}

and enable the new expand_slashed_path_patterns=true compiler option (not yet released).

When you generate the OpenAPI file from this, it will generate

{
 "/v1/publishers/{publisher}/books/{book}": {
      "get": {
        "parameters": [
          {
            "name": "publisher",
            "in": "path",
            "required": true,
            "type": "number",
            "format": "double"
          },
 {
            "name": "book",
            "in": "path",
            "required": true,
            "type": "number",
            "format": "double"
          },
        ]
      }
    }
}

The path parameters publisher and book are inferred from the proto pattern, but their type is number - it should be a string.

Expected behavior

The path parameters generated when expanding the path pattern should have a type of string.

Actual Behavior

The path parameters generated when expanding the path pattern have a type number with format double.

@austingebauer
Copy link

Thanks. Also looking for this to land in a release soon!

@johanbrandhorst
Copy link
Collaborator

https://github.com/grpc-ecosystem/grpc-gateway/releases/tag/v2.23.0 has been released!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants