-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
Currently, if a noise module doesn't conform to a module schema, the reported error will be that it failed a oneOf
schema. This build has an example:
File "C:\Python36\lib\site-packages\jsonschema\validators.py", line 130, in validate
jsonschema.exceptions.ValidationError: {'type': 'Bitmap', 'Filename': 'zigzag.png', 'Region': [[-1, -1], [2, 2]], 'DefaultValue': 0} is not valid under any of the given schemas
Failed validating 'oneOf' in schema['properties']['modules']['additionalProperties']:
{'oneOf': [{'$ref': '#/definitions/abs'},
{'$ref': '#/definitions/add'},
{'$ref': '#/definitions/billow'},
{'$ref': '#/definitions/bitmap'},
{'$ref': '#/definitions/blend'},
{'$ref': '#/definitions/checkerboard'},
{'$ref': '#/definitions/clamp'},
{'$ref': '#/definitions/const'},
{'$ref': '#/definitions/corner_combiner_base'},
{'$ref': '#/definitions/curve'},
{'$ref': '#/definitions/cylinders'},
{'$ref': '#/definitions/displace'},
{'$ref': '#/definitions/exponent'},
{'$ref': '#/definitions/exp'},
{'$ref': '#/definitions/forward'},
{'$ref': '#/definitions/gradient_x'},
{'$ref': '#/definitions/gradient_y'},
{'$ref': '#/definitions/gradient_z'},
{'$ref': '#/definitions/invert'},
{'$ref': '#/definitions/max'},
{'$ref': '#/definitions/min'},
{'$ref': '#/definitions/multiply'},
{'$ref': '#/definitions/norm_lp_q'},
{'$ref': '#/definitions/perlin'},
{'$ref': '#/definitions/power'},
{'$ref': '#/definitions/pow'},
{'$ref': '#/definitions/quadrant_selector'},
{'$ref': '#/definitions/ridged_multi'},
{'$ref': '#/definitions/rotate_point'},
{'$ref': '#/definitions/scale_bias'},
{'$ref': '#/definitions/scale_point'},
{'$ref': '#/definitions/select'},
{'$ref': '#/definitions/spheres'},
{'$ref': '#/definitions/terrace'},
{'$ref': '#/definitions/translate_point'},
{'$ref': '#/definitions/turbulence'},
{'$ref': '#/definitions/voronoi'}]}
On instance['modules']['zigzag']:
{'DefaultValue': 0,
'Filename': 'zigzag.png',
'Region': [[-1, -1], [2, 2]],
'type': 'Bitmap'}
This error is not very helpful, because while it shows the part of the JSON document causing the error (a Bitmap
module, it doesn't show the Bitmap
module schema and the reason this module didn't conform to it. The user must look up the Bitmap
schema themself, and find that the problem is Wangscape/Wangscape#197.
This is an instance of python-jsonschema/jsonschema#169, and the recommended solution is to use jsonschema
's best_match
/context
features.