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

fix-square bracket : V1 #1408

Conversation

LeComptoirDesPharmacies
Copy link
Contributor

Fixes # .

Fix square bracket in query params. Example : orderBy[eq].

Its a quick fix to permit square bracket in query params, if they are define in the schema.

For query params who are not in the schema. Do default computation for deep object.

Changes proposed in this pull request:

  • Modify sanitized function to replace [ by _. Example : orderBy[eq] -> order_by_eq
  • Modify _make_deep_object function to use key with square bracket in the name as a dict key if its define in the schema

Envoyé depuis mon iPhone.
P.S. : Ce commit est certifié sans gluten
@LeComptoirDesPharmacies
Copy link
Contributor Author

Its resolving this issues : #1271

Envoyé depuis mon iPhone.
P.S. : Ce commit est certifié sans gluten
@coveralls
Copy link

coveralls commented Jul 28, 2021

Coverage Status

Coverage increased (+0.04%) to 97.057% when pulling 0b71009 on LeComptoirDesPharmacies:bugfix/fix-square-bracket-in-params into 2229831 on zalando:main.

@RobbeSneyders
Copy link
Member

Hi @LeComptoirDesPharmacies, thanks for the PR.
Could you add a test that shows the expected behavior?

Envoyé depuis mon iPhone.
P.S. : Ce commit est certifié sans gluten
@LeComptoirDesPharmacies
Copy link
Contributor Author

Sorry for the delay, the test is ok now

Copy link
Member

@RobbeSneyders RobbeSneyders left a comment

Choose a reason for hiding this comment

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

Thanks for adding the test @LeComptoirDesPharmacies. Two more small comments, but we should be able to merge once you address those.

tests/decorators/test_uri_parsing.py Outdated Show resolved Hide resolved
tests/decorators/test_uri_parsing.py Outdated Show resolved Hide resolved
Fix alphabetic order in import
Fix test parametrization

Envoyé depuis mon iPhone.
P.S. : Ce commit est certifié sans gluten
@LeComptoirDesPharmacies
Copy link
Contributor Author

Hi,

This PR is waiting for another review. Can someone do it please ?

Best regards,
Gery

Copy link
Member

@RobbeSneyders RobbeSneyders left a comment

Choose a reason for hiding this comment

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

Thanks Gery! I left some comments, could you clarify?

Swagger2URIParser)
from werkzeug.datastructures import MultiDict

QUERY1 = MultiDict([("letters", "a"), ("letters", "b,c"),
("letters", "d,e,f")])
QUERY2 = MultiDict([("letters", "a"), ("letters", "b|c"),
("letters", "d|e|f")])
QUERY3 = MultiDict([("letters[eq]", ["a"]), ("letters[eq]", ["b", "c"]),
Copy link
Member

Choose a reason for hiding this comment

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

What is the query string that leads to this MultiDict?

Copy link
Contributor Author

Choose a reason for hiding this comment

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



@pytest.mark.parametrize("parser_class, expected, query_in, collection_format", [
(OpenAPIURIParser, ['d', 'e', 'f'], QUERY3, DICT),
Copy link
Member

Choose a reason for hiding this comment

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

As far as I know, there is no dict collection format, is there?

Envoyé depuis mon iPhone.
P.S. : Ce commit est certifié sans gluten
@LeComptoirDesPharmacies
Copy link
Contributor Author

@RobbeSneyders, sorry for the delay, thanks for your review.

I took into account your comments.

Best regards,
Gery

@RobbeSneyders
Copy link
Member

Thanks @LeComptoirDesPharmacies!

@RobbeSneyders RobbeSneyders merged commit afd0500 into spec-first:main Feb 8, 2022
vbxx3 pushed a commit to Savannah-Group/connexion that referenced this pull request Apr 9, 2022
* fix-square bracket : V1

Envoyé depuis mon iPhone.
P.S. : Ce commit est certifié sans gluten

* Fix syntax

Envoyé depuis mon iPhone.
P.S. : Ce commit est certifié sans gluten

* Add OpenAPI test with square brackets

Envoyé depuis mon iPhone.
P.S. : Ce commit est certifié sans gluten

* Fix test

Fix alphabetic order in import
Fix test parametrization

Envoyé depuis mon iPhone.
P.S. : Ce commit est certifié sans gluten

* square bracket : Set collection format to None for OpenAPIURIParser

Envoyé depuis mon iPhone.
P.S. : Ce commit est certifié sans gluten

Co-authored-by: Géry THRASIBULE <g.thrasibule@lecomptoirdespharmacies.fr>
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

Successfully merging this pull request may close these issues.

None yet

5 participants