-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to customize formatting of payloads #32
Comments
How about using the |
Yeah, I think selecting based on the |
i think it's done? |
Slightly tangential - had issue when trying to document a file upload endpoint. The swagger library can be used normally for file uploads and the resulting swagger file is correct. However, various writers in
defimpl Jason.Encoder, for: Plug.Upload do
def encode(value, opts) do
Jason.Encode.map(Map.from_struct(value), opts)
end
end |
nice tip, thanks! |
Currently in the default and swagger writers, the request and response bodies are just assumed to be JSON and passed through the
Poison.encode/1
with thepretty: true
option.In order to support other use cases (e.g., XML, other JSON libs) or just more control of the formatting, it would be great if it were possible to configure this without re-implementing the entire writer.
This could be done via options to the writer:
Along with a default implementation based on the current strategy.
Also open to other suggestions. I can work on a PR if that's something you'd be willing to include.
The text was updated successfully, but these errors were encountered: