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

Introduce ability to modify JSON schema property name #88

Merged
merged 2 commits into from
Oct 24, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions marshmallow_jsonschema/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def get_properties(self, obj):

for field_name, field in sorted(obj.fields.items()):
schema = self._get_schema_for_field(obj, field)
properties[field.name] = schema
properties[field.metadata.get("name") or field.name] = schema

return properties

Expand Down Expand Up @@ -140,7 +140,7 @@ def _from_python_type(self, obj, field, pytype):
metadata.update(field.metadata)

for md_key, md_val in metadata.items():
if md_key == "metadata":
if md_key in ("metadata", "name"):
continue
json_schema[md_key] = md_val

Expand Down Expand Up @@ -219,7 +219,7 @@ def _from_nested_schema(self, obj, field):
metadata.update(field.metadata)

for md_key, md_val in metadata.items():
if md_key == "metadata":
if md_key in ("metadata", "name"):
continue
schema[md_key] = md_val

Expand Down