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

Make OpenAPIConverter class a class member of MarshmallowPlugin #493

Merged
merged 4 commits into from Sep 3, 2019

Conversation

@lafrech
Copy link
Member

commented Sep 2, 2019

Discussed in #488.

@sloria, I cherry-picked your docs revisions.

openapi and field_converter are private API, but I left their section in the docs when rebasing your doc revisions commit. In other words, this leaves the docs in the same state as on dev branch.

lafrech and others added 2 commits Sep 2, 2019
* Document inherited members of MarshmallowPlugin
* Undoc members of openapi and field_converter modules
* Minor copy edits
@@ -91,7 +93,7 @@ def init_spec(self, spec):
super().init_spec(spec)
self.spec = spec
self.openapi_version = spec.openapi_version
self.openapi = OpenAPIConverter(
self.openapi = self.Converter(

This comment has been minimized.

Copy link
@sloria

sloria Sep 2, 2019

Member

Maybe rename this to self.converter? No big deal, though.

This comment has been minimized.

Copy link
@lafrech

lafrech Sep 2, 2019

Author Member

I picked it from your comment here: #488 (comment)

I figured capitalized could make sense since it is a class.

Otherwise, you'd subclass it like this:

class MyMarshmallowPlugin(MarshmallowPlugin):
    class converter(MarshmallowPlugin.converter):  # <-- lowercase
        def property2parameter(self, ...):
            ...
@sloria
sloria approved these changes Sep 2, 2019
@@ -91,7 +92,7 @@ def init_spec(self, spec):
super().init_spec(spec)
self.spec = spec
self.openapi_version = spec.openapi_version
self.openapi = OpenAPIConverter(
self.openapi = self.Converter(

This comment has been minimized.

Copy link
@sloria

sloria Sep 2, 2019

Member

I meant the instance attribute:

Suggested change
self.openapi = self.Converter(
self.converter = self.Converter(

This comment has been minimized.

Copy link
@lafrech

lafrech Sep 2, 2019

Author Member

Oh, sure...

This comment has been minimized.

Copy link
@lafrech

lafrech Sep 2, 2019

Author Member

I don't care either way.

I pushed a new commit with this change.

This comment has been minimized.

Copy link
@sloria

sloria Sep 2, 2019

Member

Looks good. Go ahead and merge if you’re happy with this

@lafrech

This comment has been minimized.

Copy link
Member Author

commented Sep 3, 2019

Apparently I had screwed up with the openapi and field_converter docs when rebasing. I put them back. The section still has the "Private API" warning.

@lafrech lafrech merged commit 32b6c32 into dev Sep 3, 2019
10 checks passed
10 checks passed
marshmallow-code.apispec Build #20190903.2 succeeded
Details
marshmallow-code.apispec (tox_linux docs) tox_linux docs succeeded
Details
marshmallow-code.apispec (tox_linux lint) tox_linux lint succeeded
Details
marshmallow-code.apispec (tox_linux py35-marshmallow2) tox_linux py35-marshmallow2 succeeded
Details
marshmallow-code.apispec (tox_linux py35-marshmallow3) tox_linux py35-marshmallow3 succeeded
Details
marshmallow-code.apispec (tox_linux py36-marshmallow2) tox_linux py36-marshmallow2 succeeded
Details
marshmallow-code.apispec (tox_linux py36-marshmallow3) tox_linux py36-marshmallow3 succeeded
Details
marshmallow-code.apispec (tox_linux py37-marshmallow2) tox_linux py37-marshmallow2 succeeded
Details
marshmallow-code.apispec (tox_linux py37-marshmallow3) tox_linux py37-marshmallow3 succeeded
Details
marshmallow-code.apispec (tox_linux py37-marshmallowdev) tox_linux py37-marshmallowdev succeeded
Details
@lafrech lafrech deleted the openapi_class_member branch Sep 3, 2019
@sloria

This comment has been minimized.

Copy link
Member

commented Sep 3, 2019

I had removed :members: from the openapi and field_converter docs in your previous PR because it made more sense to document the methods on MarshmallowPlugin (which is why I added :inherited-members:. With the class member approach, it makes sense to keep :members: (as you did).

@lafrech

This comment has been minimized.

Copy link
Member Author

commented Sep 3, 2019

Yeah I noticed that, undid your changes purposely, then screwed up and removed them again by error.

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.