Skip to content

[REQ] [Bash] Allow non-JSON request body payloads  #17634

@mHejlesen

Description

@mHejlesen

Is your feature request related to a problem? Please describe.

A generated bash client can only send JSON objects, not JSON arrays or ordinary string payloads.

Example:
Creating the following operation with a request body requiring a non-JSON string:

{
  "put": {
    "operationId": "bar",
    "parameters": [
    ],
    "requestBody": {
      "description": "String to be parsed",
      "content": {
        "application/json": {
          "schema": {
            "type": "string"
          }
        }
      },
      "required": true
    }
  }
}

On the server I would like to receive the raw string:

 @PUT
 public void bar(String body) {
    System.out.println("Request body: " + body);
  }

At the time of writing my only option is to write the payload to a file or send it as JSON:

./client.sh --host http://localhost:8080 bar body==hello

The above results in the JSON blob:
{"body": "hello world"}

Describe the solution you'd like

I would like to instead write:
./client.sh --host http://localhost:8080 bar --body=hello

And receive the string: hello

Describe alternatives you've considered

I have considered a file with the payload but it is very awkward and cumbersome to use.

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