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

various types of parameter serialization and types #8

Open
karenetheridge opened this issue Nov 18, 2021 · 1 comment
Open

various types of parameter serialization and types #8

karenetheridge opened this issue Nov 18, 2021 · 1 comment
Labels
2024 Things I intend to do in 2024 spec support something that the spec says should be supported

Comments

@karenetheridge
Copy link
Owner

https://spec.openapis.org/oas/v3.1.0#parameter-object
https://swagger.io/docs/specification/describing-parameters/
https://swagger.io/docs/specification/serialization/

If there is a type: string at the top level of the schema, single parameters get sent as strings and multiple parameters of the same name get sent as arrays (which will cause the validation to fail against a type: string). e.g. use @values = $uri->query_form($param_obj->{name}); $missing = !@values; $values = (@values > 1 ? \@values : $values[0];

If there is a type: integer or type: number at the top level of the schema, consider also converting string values to numbers (if possible) so numeric valiation keywords can be used e.g. minimum, multipleOf.

if there is a type: array at the top level of the schema, send single values as an arrayref, e.g. @values = $uri->query_form($param_obj->{name}); $missing = !@values; $values = \@values;

when explode=false, parse style=form parameters foo=1,2,3 as the array [ 1, 2, 3 ].

@karenetheridge
Copy link
Owner Author

karenetheridge commented Nov 18, 2021

see also
https://metacpan.org/pod/URI::Template
OAI/OpenAPI-Specification#1508

Welcome to the challenge of 6570. It works pretty well for serialization. It sucks royally for deserialization. It wasn't intended to work for deserialization. We are at the mercy of URL designers to create URLs that don't suck.

@karenetheridge karenetheridge transferred this issue from another repository Nov 24, 2021
@karenetheridge karenetheridge pinned this issue Nov 26, 2021
@karenetheridge karenetheridge added the spec support something that the spec says should be supported label Oct 2, 2022
@karenetheridge karenetheridge added the 2024 Things I intend to do in 2024 label Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2024 Things I intend to do in 2024 spec support something that the spec says should be supported
Projects
None yet
Development

No branches or pull requests

1 participant