Skip to content

Slice type marshal error #1575

Closed
Closed

Description

@mhsbz

When generating client code defined through swagger 3.0, the runtime.MarshalForm method will marshal the values of type slice in the form structure into field_name[index], but the server cannot handle such fields(such as user_codes[0],user_codes[1]), It only supports the user_codes field

device_approve_bulk_requestBody:
   type: object
   properties:
     user_codes:
       type: array
       items:
         type: string

Activity

  1. mromaszewicz commented on Jul 16, 2026

    @mromaszewicz
    Member

    This is an old issue that I'm revisiting, but what you describe seems like you're trying to do something invalid with your server description.

    You've described that your request body is a JSON object that looks like:

    {
        "user_codes": ["str1", "str2"]
    }
    

    The server expects valid json, and the form encoding is the wrong way to serialize that.

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

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions