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

Ignore "location" field metadata #526

Merged
merged 4 commits into from Aug 31, 2020
Merged

Conversation

lafrech
Copy link
Member

@lafrech lafrech commented Jan 1, 2020

Same rationale as marshmallow-code/webargs#420. Ignore "location" in field metadata.

TODO:

@lafrech lafrech added this to the 4.0 milestone Jan 1, 2020
@Bangertm
Copy link
Collaborator

Bangertm commented Jan 2, 2020

Should also consider making the ‘in’ parameter required. Now that fields do not contain location apispec always has to know what to put in that parameter and defaulting to ‘body’ doesn’t make much sense.

@lafrech lafrech force-pushed the ignore_field_location_metadata branch 2 times, most recently from d9fd5f8 to 6b25286 Compare January 3, 2020 14:46
@lafrech lafrech marked this pull request as ready for review January 3, 2020 14:48
@lafrech
Copy link
Member Author

lafrech commented Jan 3, 2020

Removal of potential dead code (see #500) can be done in another PR. But ideally before 4.0 if we decide to make some methods private.

@Bangertm
Copy link
Collaborator

Bangertm commented Apr 7, 2020

Just looking at this again. Once all the unneeded code is removed from fields2parameters the whole function can be simplified to a single list comprehension.

[
    self.field2parameter(
        field_obj,
        name=self._observed_name(field_obj, field_name),
        location=location,
    ) for field_name, field_obj in fields.item()
]

The conditional if field_obj.dump_only: continue isn't needed because that is already captured in the get_fields call above (not sure how there was so much duplication of logic).

Given this, instead of making the method private we could just remove it altogether and just do the list comprehension in schema2parameters

@lafrech lafrech force-pushed the ignore_field_location_metadata branch from 6b25286 to a22bb4e Compare July 10, 2020 21:34
@lafrech
Copy link
Member Author

lafrech commented Jul 10, 2020

The refactor is done in #581.

I think this is ready to merge.

@lafrech lafrech requested a review from Bangertm July 11, 2020 00:02
@lafrech lafrech merged commit e204fa0 into dev Aug 31, 2020
@lafrech lafrech deleted the ignore_field_location_metadata branch August 31, 2020 09:44
kam193 added a commit to kam193/flask-apispec that referenced this pull request Oct 11, 2020
1. Rename 'default_in'
(marshmallow-code/apispec#526)
2. Dict schema: convert it to object and handle special case 'body',
since prior used method no longer exists
(marshmallow-code/apispec#581)
sloria added a commit to jmcarp/flask-apispec that referenced this pull request Oct 25, 2020
* Compatibility with apispec 4

1. Rename 'default_in'
(marshmallow-code/apispec#526)
2. Dict schema: convert it to object and handle special case 'body',
since prior used method no longer exists
(marshmallow-code/apispec#581)

* Drop support for apispec < 4, Python < 3.6

Supporting different apispec version requires
different logic for each of them. New apispec
requires Python >= 3.6

* Remove unused imports

* Update tox.ini

* Update changelog

* Drop Python 3.5 support

apispec no longer supports 3.5

Co-authored-by: Steven Loria <sloria1@gmail.com>
jollysahil pushed a commit to levrofin/flask-apispec that referenced this pull request Sep 12, 2023
* Compatibility with apispec 4

1. Rename 'default_in'
(marshmallow-code/apispec#526)
2. Dict schema: convert it to object and handle special case 'body',
since prior used method no longer exists
(marshmallow-code/apispec#581)

* Drop support for apispec < 4, Python < 3.6

Supporting different apispec version requires
different logic for each of them. New apispec
requires Python >= 3.6

* Remove unused imports

* Update tox.ini

* Update changelog

* Drop Python 3.5 support

apispec no longer supports 3.5

Co-authored-by: Steven Loria <sloria1@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants