Redfish-Tools icon indicating copy to clipboard operation
Redfish-Tools copied to clipboard

Error validating a PropertyRef defined in BaseType

Open fera2k opened this issue 7 years ago • 5 comments

Hello there.

I'm getting this issue when validating Redfish CSDL in my metadata response DataServices->Schema:Resource.v1_0_0->EntityType:ReferenceableMember->Key->PropertyRef:MemberId->segment MemberId in path Resource.v1_0_0.ReferenceableMember/MemberId not found

In the namespace "Resource.v1_0_0" there is the EntityType "ReferenceableMember". It defines a Key, with a PropertyRef poiting to a Property defined in the baseType "Resource.ReferenceableMember".

Isn´t it suppose to consider also the properties on the base type ?

please, consider this metadata gist: (line 46561) https://gist.github.com/fera2k/c3a6b30cf6917bd73f9452f53aa0abf8

fera2k avatar Jul 05 '18 14:07 fera2k

I think there's a bit of ambiguity in the OData CSDL spec about whether or not you can reference an inherited property when defining a key. I'll dig more into that...

However, at least with how we define ReferenceableMember in Resource_v1.xml, we don't make that inheritance jump with the key. We define both the "MemberId" property and key definition within the ReferenceableMember definition found in Resource.v1_0_0.

mraineri avatar Jul 05 '18 14:07 mraineri

The wording that's a little suggestive that it's for the property in the entity being defined (and not the base type) is this statement found in section 8.3.1 of the OData CSDL spec:

a path expression resolving to a primitive property of the entity type itself or to a primitive property of a complex property (recursively) of the entity type

It is rather vague, and I can see it being interpreted the way you're trying to use it; I'll keep digging...

mraineri avatar Jul 05 '18 14:07 mraineri

There is also this statement in section 6.5 of the OData CSDL spec (version 4.01) that seems to be a bit stronger:

A key property MUST be a non-nullable primitive property of the entity type itself

The wording makes it sound like the property must be within the given entity type (and not from a base type).

mraineri avatar Jul 05 '18 15:07 mraineri

I reached out to some OData folks to help clarify; what you're doing is perfectly legal, and we will need to adjust the tool to allow for it.

mraineri avatar Jul 06 '18 19:07 mraineri

Thanks @mraineri I found out that our PoC is kind of patching the Schemas and copying the defined types, properties and annotations from the subsequent versions to the root version (ie: Resource.v1_0_0 => Resource). It was the reason that caused the issue. But anyway, if the validator would allow this approach, it will be ok for us.

fera2k avatar Jul 09 '18 18:07 fera2k