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

Rework components interface #381

Merged
merged 10 commits into from Feb 5, 2019

Conversation

@lafrech
Copy link
Member

commented Feb 4, 2019

This addresses my comment here: #375 (comment).

I find it awkward to pass dicts as kwargs, and I think it would be clearer and more future-proof to pass the component dict as positional parameter, keeping kwargs only for plugin-specific parameters.

This is a totally breaking change. Tell me what you think.

I can try to fix the black issues. It would be easier if the changes were printed in the Travis log, as I wouldn't have to run it locally.

Docs would need an update.

@sloria
Copy link
Member

left a comment

I support this change. Just a minor suggestion re: naming.

For black formatting, I suggest using a Docker image, marshmallow-code/marshmallow#1104 (comment).

I can also fix this up for you if you don't have time.

extra_fields=None,
**kwargs
):
def schema(self, name, definition=None, **kwargs):

This comment has been minimized.

Copy link
@sloria

sloria Feb 4, 2019

Member

Rather than use an OAS 2 term, "definition", what if we use a consistent parameter name for all the component methods? "component", perhaps? "obj" could also work, since OAS calls these "Objects", but that could be conflated with Python's "object".

@lafrech

This comment has been minimized.

Copy link
Member Author

commented Feb 4, 2019

Good. Parameter renamed. Code blacked. And I did a bit of cleanup while I was at it.

@sloria
Copy link
Member

left a comment

Looks good. I'll fix up the docs and update the changelog.

ret["enum"] = enum
if description:
ret["description"] = description
if extra_fields:

This comment has been minimized.

Copy link
@sloria

sloria Feb 4, 2019

Member

Ah, nice. This cleans things up quite a bit.

special_topics.rst will need to be updated--we can probably just get rid of the "Adding Additional Fields To Schema Objects" section altogether.

Update: ended up modifying the section to show how to add additional properties to auto-generated properties.

sloria added some commits Feb 5, 2019

@sloria

sloria approved these changes Feb 5, 2019

@sloria sloria merged commit 164c35c into dev Feb 5, 2019

0 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
continuous-integration/travis-ci/push The Travis CI build is in progress
Details

@sloria sloria deleted the rework_components_interface branch Feb 5, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.