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

Add definitions_path argument to __init__ for customization #179

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mrtedn21
Copy link

of resulting json schema, where schemas are placed

of resulting json schema, where schemas are placed
@fuhrysteve
Copy link
Owner

fuhrysteve commented Oct 26, 2023

Thanks for the PR! I thought about it for a minute, and it seems that making a method that you can override for this would add less complexity. So I made & merged this PR #180

If you are working off of the latest master, you should now be able to override the _schema_base method:

from marshmallow_jsonschema import JSONSchema
class MyJSONSchema(JSONSchema):
    def _schema_base(self, name):
        return {"type": "object", "$ref": "#/anything_you_want_here/{}".format(name)}

Let me know if that works for you!

@mrtedn21
Copy link
Author

O thanx, it is good solution, but method "wrap" with "post_dump" decorator, that creates resulting json_schema dict, it anyway hardcode with '#/definitions/'

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

2 participants