-
-
Notifications
You must be signed in to change notification settings - Fork 590
oneOf array of simple types bug - propose fix #476
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
Comments
Hi. Not sure you have the right repo here. If you do, can you update your description to be runnable? Thanks! |
Hi, |
That is 3.0.0a3, and the title ' handle basic types above' in the proposed solution is of course a comment mangled by the wiki |
Thanks. What bug is being reported? And what's |
I am deeply sorry - you are quite right, I am using 3.0.0a3 in conjunction with python jsonschema object and the bug is in their library. Many thanks for your prompt reply, and thank you for the high quality of your library ! |
No worries, and thank you!
…On Mon, Oct 8, 2018, 19:35 GrahamJB1 ***@***.***> wrote:
Closed #476 <#476>.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#476 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAUIXqaXeeggOJGKoIYigirAN3XmDwZ-ks5ui-FOgaJpZM4XNJy5>
.
|
09fd353f Merge pull request #481 from kylef/kylef/time 0ed2e79b Fix negative time test to only fail on a single rule 2edc74b1 Add valid time with different second fractions 7bde0bf7 Add valid time with leap second including offset ee83f464 Stricter time format constraints 5732904a Merge pull request #480 from json-schema-org/ether/better-test-names c2994271 better test names for schema-items + additionalItems 6bc53e60 Merge pull request #479 from json-schema-org/fix-non-id-in-enum-for-drafts-6-and-7 3f783d9c fixing draft 6 & 7 non-id tests 5768c68d Merge pull request #476 from json-schema-org/ether/readme-updates 0c8bfc06 add mention of JSON::Schema::Tiny e4c10c6b fix markdown for underscores in package names eeb4db18 mention draft2020-12 in readme dff69dcb Merge pull request #474 from marksparkza/unevaluatedItems-depends-on-contains 51b4977c Merge pull request #478 from sorinsarca/patch-1 dfcd4a19 fix bad comma 4cb100a5 Merge pull request #465 from json-schema-org/ether/more-naive-ref 31dc86bc add another test of naive $ref replacement f858c613 Merge pull request #477 from json-schema-org/ether/more-items-tests 4e266c34 test that array-items/prefixItems adjusts the starting position for schema-items/additionalItems b7fced33 Merge pull request #473 from json-schema-org/ether/more-default-tests eadb9be7 test that a missing property is not populated by the default in the actual instance data 839b95d8 Added opis/json-schema 7cf78800 Add missing comma 3390c871 Update tests/draft2020-12/unevaluatedItems.json d3b88001 Update tests/draft2020-12/unevaluatedItems.json 84e1d5a9 Add another test case for unevaluatedItems-contains interaction f400802c Add tests for unevaluatedItems interaction with contains git-subtree-dir: json git-subtree-split: 09fd353fc44ab22e7e8998d096b3d6d83287e5e6
basicSchemaDefn = """{
'$schema':'http://json-schema.org/draft-04/schema#',
'title':'Test',
'properties':{
'SimpleArrayOfNumberOrString':{
'$ref':'#/definitions/simparray'
}
},
'required':[
'SimpleArrayOfNumberOrString'
],
'type':'object',
'definitions':{
'simparray':{
'oneOf':[
{
'type':'array',
'items':{
'type':'number'
}
},
{
'type':'array',
'items':{
'type':'string'
}
}
]
}
}
}"""
basicSchema = json.loads(basicSchemaDefn.replace(''', '"'))
builder = pjs.ObjectBuilder(basicSchema)
ns = builder.build_classes(no_extra_parameters = True)
ns.Test().from_json('{"SimpleArrayOfNumberOrString" : [0, 1]}')
Proposed fix in classbuilder.py validate:
elif isinstance(val, list):
if len(val) and hasattr(val[0], "validate"):
for subval in val:
subval.validate()
else:
handle basic types
setattr(self, prop, val)
The text was updated successfully, but these errors were encountered: