I only found a workaround: instead of using parameters in the Operation map, I created a whole new schema(?) and use that in the requestBody field of the Operation map. So I have this new module:
defmodule MerlinWeb.LoginParameter do
require OpenApiSpex
OpenApiSpex.schema(%{
title: "LoginParameter",
description: "Input for login",
type: :object,
properties: %{
username: %OpenApiSpex.Schema{type: :string, description: "name of the user"},
some_number: %OpenApiSpex.Schema{type: :integer, description: "some number"}
},
required: [:username, :some_number],
example: %{
"username" => "some user",
"some_number" => "12"
}
})
end
and in the above example instead of the parameters: part I have this:
parameters: [],
requestBody: Operation.request_body("Login params description", "application/json",
MerlinWeb.LoginParameter,
required: true),
It means that on the Swagger UI I don’t have a separate text field for all parameters anymore (username, number in the above examples), but one single text area for the JSON input. Doesn’t look that good, but works.






















