Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add deepObject support#379

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

Yarn-e
Copy link
Contributor

@Yarn-eYarn-e commentedNov 16, 2021
edited
Loading

Problem statement

Currently deepObjects are not supported, this PR adds that support.

Description

Example spec

components:parameters:exampleParameter:name:paramObjin:queryrequired:trueexplode:truestyle:deepObjectschema:type:objectproperties:count:type:integername:type:string

Sadly it doesn't really fit in theParameterDeserializersFactory ideology as it would never reach that step asget_value() inparameters.py would always fail as it tries to find thename of theparam_or_header in the specific location. This is because how a deepObjects query param looks like (e.g.someurl.com/?paramObj[count]=1&paramObj[name]=John), the function would try to findparamObj in the location, which it would not find as the QueryParams will be split into a dict like this:{'paramObj[count]': 1, 'paramObj[name]': John}.

In my proposed solution it would split the location dict key into 2 parts, the actual key we want to findparamObj and then create a dict of the 2nd part of the key (whats inside the brackets) with its actual value:{'count': 1, 'name': 'John'}.
Afterwards this dict is checked via the schema of the object.

I highly doubt this solution will get accepted, so if you know a way to make this cleaner/better please lmk 🙏

Todos

  • Tests

Related issue

plambein and bramvandewalle reacted with thumbs up emoji
@p1c2up1c2uforce-pushed thefeature/deep-object-support branch 2 times, most recently fromd084df1 to23cc3e4CompareSeptember 23, 2022 13:56
@codecov
Copy link

codecovbot commentedSep 23, 2022
edited
Loading

Codecov Report

Merging#379 (cc42e15) intomaster (868c081) willdecrease coverage by0.08%.
The diff coverage is82.35%.

@@            Coverage Diff             @@##           master     #379      +/-   ##==========================================- Coverage   93.16%   93.08%   -0.09%==========================================  Files          94       94                Lines        2311     2327      +16       Branches      286      291       +5     ==========================================+ Hits         2153     2166      +13- Misses        123      124       +1- Partials       35       37       +2
Impacted FilesCoverage Δ
openapi_core/schema/parameters.py92.45% <81.25%> (-4.92%)⬇️
openapi_core/deserializing/parameters/factories.py100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell ushow you rate us. Have a feature suggestion?Share it here.

@p1c2up1c2uforce-pushed thefeature/deep-object-support branch from23cc3e4 tocc42e15CompareSeptember 23, 2022 13:59
Copy link
Collaborator

@p1c2up1c2u left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

We can add this as experimental support.

@p1c2up1c2u merged commite3da8d3 intopython-openapi:masterSep 23, 2022
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@p1c2up1c2up1c2u approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@Yarn-e@p1c2u

[8]ページ先頭

©2009-2025 Movatter.jp