-
Notifications
You must be signed in to change notification settings - Fork 134
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
Parameters of "type: string" reject numeric values as "malformed" #184
Comments
Yikes, yeah, that's not great; as a workaround, if you have a Circe decoder for |
The parameter is turned into a 🔢JSNumber by the J.decodeJson(json) and sends it into a decodeString: Decoder[String] circe thing. |
Is the advice here then to annotate every swagger string input parameter as |
@dsilvasc I honestly haven't had a chance to circle around and fix the underlying bug here. I'd rather this not be the case, but for now I can't offer a better solution. What needs to happen is the underlying types from swagger need to be reflected in akka-http's directives ( Right now, we're just taking everything as a string, attempting to parse it as JSON, then treating it as a string before proceeding. This creates an unfortunate situation where if a valid JSON symbol (numbers, boolean literals) are supplied, they'll get parsed as those literals, failing the string decoder. This has the additional unfortunate impact of removing surrounding double quotes from strings, as they're parsed as JSON string literals. |
💂♀️🚃We are sending query parameters that can be either a number or alpha-numeric input
In the latest version and earlier. The following simple fragment when generated as a route will only allow alpha-numeric values to be passed in the request.
For example: using a numeric value is rejected as "The query parameter 'a' was malformed: String"
🙉Hope that makes sense that we may expect the decoder to allow numerics to be converted to a string rather than be rejected.
The text was updated successfully, but these errors were encountered: