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

csdl validator dependency on swordfish schemas? #484

Open
luke-terry-vertiv opened this issue Sep 30, 2024 · 4 comments
Open

csdl validator dependency on swordfish schemas? #484

luke-terry-vertiv opened this issue Sep 30, 2024 · 4 comments

Comments

@luke-terry-vertiv
Copy link

I ran into an issue attempting to validate an edit to a single OEM schema file. After some investigation, I find that I cannot get the tool to pass validation for any file, including standard published schemas. Every time I get the same error.

python3 odata_validator.py --config redfish-rules.json https://redfish.dmtf.org/schemas/v1/Chassis_v1.xml
MetaData:http://redfish.dmtf.org/schemas/swordfish/v1/FeaturesRegistry_v1.xml->DataServices->Schema:FeaturesRegistry.v1_2_0->ComplexType:FeatureMap->NavigationProperty:Resources->Type must be EntityType in scope or abstract EntityType

I suppose this wouldn't be too big of an issue if the root cause is simply an error in a Swordfish schema, but the problem is this prevents the tool from actually detecting errors in the schema file I care about validating. I tried manually inserting some errors the tool would normally flag and found the tool bails out before finding any of them.

I don't understand why this dependency exists in the first place. How does a swordfish schema get into the critical path for this tool? I would expect the validation scope to be very narrow when the tool is run against a single schema file -- e.g. follow links to the References and that's it. Chassis is a large schema with a bunch of references, but I've seen the same on other schema files that have very few references (RedfishExtensions_v1.xml, Resource_v1.xml, Org.OData.Capabilities.V1.xml, Org.OData.Core.V1.xml).

@mraineri
Copy link
Contributor

mraineri commented Oct 1, 2024

This is actually a bug in the Swordfish schema; the current publication is incorrectly using a NavigationProperty to reference a primitive type instead of a resource. This has been pointed out to SNIA already on other workstreams.

@mraineri
Copy link
Contributor

mraineri commented Oct 1, 2024

And no, the tool's scope is inclusive of references to other schema files. The tool needs to unpack all definitions from externally referenced schemas to ensure any local definitions are consistent with their respective external references.

@luke-terry-vertiv
Copy link
Author

And no, the tool's scope is inclusive of references to other schema files. The tool needs to unpack all definitions from externally referenced schemas to ensure any local definitions are consistent with their respective external references.

Is this essentially recursively following all the Reference tags (like below)? Or is there more to it?

<edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/RedfishExtensions.xml">
     <edmx:Include Namespace="RedfishExtensions.1.0.0" Alias="Redfish"/>
</edmx:Reference>

That conceptually makes total sense to me. What I'm struggling to rectify is what the path is from a simple schema to that particular swordfish schema. Take SerialInterface for example, I get the same error against that one too.

python3 odata_validator.py --config redfish-rules.json http://redfish.dmtf.org/schemas/v1/SerialInterface_v1.xml
MetaData:http://redfish.dmtf.org/schemas/swordfish/v1/FeaturesRegistry_v1.xml->DataServices->Schema:FeaturesRegistry.v1_2_0->ComplexType:FeatureMap->NavigationProperty:Resources->Type must be EntityType in scope or abstract EntityType

Manually looking at the Reference tags, including following the references of other references, I see the following (plus a handful of odata links):

http://redfish.dmtf.org/schemas/v1/RedfishExtensions.xml
http://redfish.dmtf.org/schemas/v1/Settings.xml
http://redfish.dmtf.org/schemas/v1/Message.xml
http://redfish.dmtf.org/schemas/v1/RedfishExtensions.xml
http://redfish.dmtf.org/schemas/v1/Resource.xml

I don't see the path to anything swordfish related, unless it's buried in some odata references. Is there something I'm missing?

@mraineri
Copy link
Contributor

mraineri commented Oct 1, 2024

One path I've been following myself is taking the FeaturesRegistry file and including it in my test directory with the fix (or deleting the property completely). That's been the simplest workaround for me. If there is a local copy of the schema, the tool will use that instead of downloading it.

Unfortunately with the interconnections at play, there's a bit of a web of references being made. I know ServiceRoot and ComputeSystem will make references to Swordfish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants