Skip to content

[BUG][Go] path parameter values should be urlencoded #3591

@kraney

Description

@kraney
Description

When .a path / method includes a path parameter, the generated Go client accepts the value and injects it into the path unchanged. If the value contains URL-significant characters, like a '/', this will cause unexpected behavior.

openapi-generator version

4.1.0-SNAPSHOT

OpenAPI declaration file content or url
  /filters/{filters_identifier}:
    delete:
      description: Remove a filter from the system.
      parameters:
      - in: path
        name: filters_identifier
        required: true
        schema:
          type: string
Command line used for generation

docker run --name oas --rm -v ${PWD}:/local openapi-generator generated -g go-experimental ...

Steps to reproduce

Call the path above with parameter filters_identifier = "foo/bar"

Suggest a fix

Always urlencode path parameters

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions