Skip to content

Server cannot decode binary parameter #97

Description

@winder

I'm having trouble using binary parameters, I'm not sure what I'm doing wrong.

I have a parameter defined with:

    "note-prefix": {
      "type": "string",
      "format": "byte",
      "description": "Specifies a prefix which must be contained in the note field.",
      "name": "note-prefix",
      "in": "query"
    },

This generates a parameter object as expected with:

    NotePrefix *[]byte `json:"note-prefix,omitempty"`

Now I try to use the parameter by getting a base64 string echo "test" |base64, and url encoding it to get dGVzdAo%3D.

But the parameter isn't properly parsed:

$ curl -s "localhost:8980/transactions?note-prefix=dGVzdAo%3D" | json_pp
{
   "message" : "Invalid format for parameter note-prefix: error setting array element: error binding string parameter: can not bind to destination of type: uint8"
}

I'm hoping that this is user error, but it looks like an entry is missing from this:
https://github.com/deepmap/oapi-codegen/blob/88bfbcf8cc7a4c8bfa82c3f0a6cfd0eb1db34d63/pkg/runtime/bindstring.go#L50

Hoping that someone can confirm.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions