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

fix: JsonBone validate object and list too #1329

Merged

Conversation

ArneGudermann
Copy link
Contributor

This PR fix the Bug that only str is validated by the JsonBone.

Example :

testjson = JsonBone(schema={
		"type": "object",
		"properties": {
			"price": {"type": "number"},
			"name": {"type": "string"},
		},
	})
print(skel.setBoneValue("testjson",{"name" : "Eggs", "price" : "invalid"}))
print(skel["testjson"])
True
{'name': 'Eggs', 'price': 'invalid'}

print(skel.setBoneValue("testjson",json.dumps({"name" : "Eggs", "price" : "invalid"})))
print(skel["testjson"])
False
{'name': 'Eggs', 'price': 1}

@ArneGudermann ArneGudermann added the Priority: Medium This issue may be useful, and needs some attention. label Nov 20, 2024
@ArneGudermann ArneGudermann added this to the ViUR-core v3.6 milestone Nov 20, 2024
@ArneGudermann ArneGudermann added the bug(fix) Something isn't working or address a specific issue or vulnerability label Nov 20, 2024
@phorward phorward merged commit 1068b97 into viur-framework:3.6 Nov 21, 2024
4 checks passed
@ArneGudermann ArneGudermann deleted the fix/JsonBone_schema_validate branch November 21, 2024 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug(fix) Something isn't working or address a specific issue or vulnerability Priority: Medium This issue may be useful, and needs some attention.
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

3 participants