-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Produce helpful error messages when default data doesn't match the schema #101
Comments
Which version are you on? Check using: $ python -c "import django_jsonform; print(django_jsonform.__version__)" |
2.17.0 |
I was getting the following error:
What should I do? Edit: Got this in Firefox |
Try disabling your browser cache. If this is a production environment, you must also run the |
Got this in chrome:
I did clear the browser cache and reinstalled all the packages in a fresh project and got the same error. How do I disable the cache though? Its development environment. To be more precise I am using the following model: class UserFilter(models.Model):
filters = JSONField(
schema={
"$defs": {
"and": {
"type": "object",
"properties": {
"and": {
"type": "array",
"items": {
"oneOf": [
{"$ref": "#/$defs/and", "title": "and"},
{"$ref": "#/$defs/or", "title": "or"},
]
},
}
},
},
"or": {
"type": "object",
"properties": {
"or": {
"type": "array",
"items": {
"oneOf": [
{"$ref": "#/$defs/and", "title": "and"},
{"$ref": "#/$defs/or", "title": "or"},
]
},
}
},
},
},
"oneOf": [
{"$ref": "#/$defs/and", "title": "and"},
{"$ref": "#/$defs/or", "title": "or"},
],
},
default=dict,
)
name = models.CharField(max_length=512, unique=True) What are you using? |
The widget is receiving To fix it, you should:
Anyway, I'll mark this issue as a bug because the widget should handle this type of cases more gracefully and should produce helpful error messages. |
That worked. Thanks!! |
I'm running into a similar issue (at least the stacktrace is the same as mentioned in #101 (comment)) when adding a new A minimal version of my schema looks as follows: {
"type": "object",
"properties": {
"name": {
"type": "string"
},
}
} If I update the schema to the following value: {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"tags": {
"type": "array",
"items": {"type": "string"}
}
}
} ... for existing values in the database (eg. Interestingly, this only happens if the |
@sgocg Hi, I just tested the scenario you mentioned. It's working completely fine for me. I tested with the latest version (2.21.0). Which version are you using? |
Sample schema which works on https://bhch.github.io/react-json-form/playground/#8-recursion but doesn't work when using
django-jsonform
:The text was updated successfully, but these errors were encountered: