ifcJSON icon indicating copy to clipboard operation
ifcJSON copied to clipboard

Schema validation accepting wrong or random parameter names

Open fg55b opened this issue 1 year ago • 0 comments

Greetings!

When testing and validating an IfcJSON file that had already an expected error inside, the schema_validator.py actually pointed out that it was a valid ifcJSON.

The code with an expected error was the following, since IfcRelAssignsToProduct do not have the "relatingObject" parameter, but "relatingProduct" instead.

{ "type": "IfcRelAssignsToProduct", "globalId": "Rel_Id", "relatedObjects": [ { "type": "IfcBuildingElementProxy", "ref": "Element_Id" } ], "relatingObject": { "type": "IfcTask", "ref": "Task_Id" } }

I tried using random values in the parameters' names and they also worked fine. But, if "relatingObject" is changed by the correct value, "relatingProduct", then an error is raised, since IfcTask is not a Product. According to the schema:

"relatingProduct": { "$ref": "#/definitions/IfcProductSelect"}

I'm not sure if this issue can be addressed since the validation is based on the external jsonschema library, but since the validator can be used as a reference for implementations of the IfcJSON, would be very helpful if it was capable of checking this type of error that can often happen.

Thanks for the attention!

fg55b avatar Oct 03 '23 12:10 fg55b