FIXTradingCommunity / fix-orchestra

Machine readable rules of engagement
Apache License 2.0
71 stars 34 forks source link

[repository schema] Group reference overriding upper limit #203

Open mkudukin opened 3 months ago

mkudukin commented 3 months ago

In Orchestra XSD version 1.1-RC2, we identified a problem with how repeating group references behave. According to the specification, a group reference should inherit the minimum (implMinOccurs) and maximum (implMaxOccurs) occurrences specified in the group definition:

Limits of the size of a particular instance of a repeating group may be overridden by setting implMinOccurs and implMaxOccurs attributes on the <groupRef> element.

However, the current version seems to always override the upper limit with the value set in the reference itself, contradicting the specification. The problem appears to be the default value defined in the implMaxOccurs attribute of groupRefType:

<xs:attribute name="implMaxOccurs" type="fixr:unboundedIntType" default="unbounded"/>

This behavior prevents users from defining the maximum occurrences (implMaxOccurs) only in the group definition. They must specify it in all references as well.

patricklucas commented 3 days ago

It seems to me that the documented behavior, allowing the default to flow from the group definition rather than the ref, exists at a higher level than the XSD, in which case the default value should simply be removed from the implMaxOccurs attribute. @mkudukin do you concur?

kleihan commented 3 hours ago

@patricklucas I agree that there should be no default on the group reference level. The absence of information about the cardinality on the group reference level should cause the information from the group definition level to become valid. The attribute implMaxOccursis defined with the same default on the group definition level. It seems that it was forgotten to remove the default on the group reference level.