aas-specs icon indicating copy to clipboard operation
aas-specs copied to clipboard

Validate submodel reference in JSON Schema

Open mhrimaz opened this issue 1 year ago • 3 comments

Check submodel references to be only ModelReference<SubmodelReference>

mhrimaz avatar Dec 12 '23 14:12 mhrimaz

@mhrimaz Thanks for the PR!

@sebbader-sap @s-heppner maybe we should collect all these patches and re-write them as Python code so that they can be re-applied to new versions as well?

mristin avatar Dec 12 '23 15:12 mristin

It definitely makes sense to locate them in the python file. The ModelReference constraint is not JSON-specific AND will be valid also for future versions. My main question is, can you actually model this constraint in core-works? Probably, I just wouldn't know how.

sebbader-sap avatar Dec 12 '23 15:12 sebbader-sap

@sebbader-sap the constraint has been in aas-core-meta since forever, but we can not transpile it to JSON schema. At least, I don't know how.

mristin avatar Dec 12 '23 15:12 mristin

We truly thank you for your input, @mhrimaz!

However, we sadly cannot allow changing the schema files by hand, since they are generated using aas-core-works. That particular constraint is implemented in aas-core-meta (meaning it appears for example in the generated SDKs), however cannot be transpiled into the JSON schema with reasonable effort, so that we decided not to implement that particular generation function. If you're willing to, you're more than welcome to contribute to the schema generation functionality at aas-core-codegen.

@mristin We decided against the semantic patching approach you mentioned due to not wanting to introduce another layer of code that needs to be maintained.

s-heppner avatar May 06 '24 09:05 s-heppner

I'll close the pull request for now, but feel free to re-open it in the future.

mristin avatar May 06 '24 11:05 mristin