Skip to content

Add definitions_path argument to __init__ for customization#179

Open
mrtedn21 wants to merge 1 commit intofuhrysteve:masterfrom
mrtedn21:add-definitions-path
Open

Add definitions_path argument to __init__ for customization#179
mrtedn21 wants to merge 1 commit intofuhrysteve:masterfrom
mrtedn21:add-definitions-path

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.

2 participants