Skip to content
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

Feature: Allow multiple types #74

Open
pke opened this issue Oct 10, 2018 · 6 comments
Open

Feature: Allow multiple types #74

pke opened this issue Oct 10, 2018 · 6 comments

Comments

@pke
Copy link
Contributor

pke commented Oct 10, 2018

It seems it would make sense to allow clients to request resources with either json, url encoded or form data. All three could be allowed by the API.
Currently the type argument in the validation is only accepting a string.
I could create a PR that would accept an array too.

@pke
Copy link
Contributor Author

pke commented Oct 17, 2018

Thinking about it, why is it even relevant in which format the clients sends the data? If this middleware can decode it and provide it as structured data in the body then the route should not dictate a singular format. What do you think?

@Saghen
Copy link

Saghen commented Apr 4, 2019

I went ahead and implemented this on my fork of the project: https://github.com/Saghen/joi-router

Please note though that this fork is currently a heavy wip.

@pke
Copy link
Contributor Author

pke commented Apr 4, 2019

👍 Which commit brought that feature into your fork?

@Saghen
Copy link

Saghen commented Apr 4, 2019

Here it is

@aheckmann
Copy link
Member

A goal of this module is to fail as fast as possible on invalid input. No guessing means less bugs in my APIs. Accepting multiple formats by using an array seems like a good idea.

@mlshv
Copy link

mlshv commented Aug 9, 2019

Any updates on the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants