-
Notifications
You must be signed in to change notification settings - Fork 9
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
feat: support for query parameter serialization style "deepObject" #78
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good except for some minor comments!
Will be awesome to have the client side implementation too and have an end-to-end test.
Added client support as well. I will add end to end tests |
I have added EOE test for deep object |
src/server.jl
Outdated
for param in params | ||
current = deserialized_dict | ||
for part in param.keylist[1:end-1] | ||
current = get!(current, part, Dict{String, Any}()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to get!(current, part) do
format? That would create the Dict
only if necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Co-authored-by: Tanmay Mohapatra <[email protected]>
Co-authored-by: Tanmay Mohapatra <[email protected]>
Co-authored-by: Tanmay Mohapatra <[email protected]>
Introduction
The
deepObject
style is used for complex object serialization in query parameters for OpenAPI 3.0 (https://swagger.io/docs/specification/serialization). This style enables the representation of nested objects particularly suitable for APIs that need to handle hierarchical data structures.Description
The deepObject format represents nested objects and arrays by encoding each level of nesting as a separate query parameter, using square brackets to denote the hierarchy. Each parameter consists of a base key followed by one or more nested keys.
Key Elements
Note: OpenAPI spec doesn't define array de-serialization for
deepObject
. So basically we have extended it for arraysExamples
a[b][c][d]=value1&a[b][c][e]=value2&a[f]=value3
would be intermediately deserialized asa[b][0]=value1&&a[b][1]=value2
would be intermediately deserialized as: