FIXTradingCommunity / fix-orchestra

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

[repository schema] allow empty collection elements #128

Closed donmendelson closed 3 months ago

donmendelson commented 3 years ago

Message from Hanno Klein:

The validate produces an error for empty sections although they are present in the XML file. Just using codesets as an example here:

<fixr:codeSets/>

ERROR io.fixprotocol.orchestra.repository.BasicRepositoryValidator - RepositoryValidator: XML error at line Unk col Unk cvc-complex-type.2.4.b: Content des Elements 'fixr:codeSets' ist nicht vollständig. '{"http://fixprotocol.io/2020/orchestra/repository":codeSet}' wird erwartet.

Apologies for the German. It simply states that 'fixr:codeSets' is incomplete and that '{"http://fixprotocol.io/2020/orchestra/repository":codeSet}' was expected.

Currently, <codeSets> is optional, but if supplied it must contain at least one instance of <codeSet>. We can allow it to be empty by adding minOccurs="0" to the <codeSet> element.

patricklucas commented 2 years ago

I believe that codeSets is actually required in the current version of the XSD: https://github.com/FIXTradingCommunity/fix-orchestra/blob/956343eb9f4bf561db04f84f8aa272065b6b9885/repository/src/main/resources/xsd/repository.xsd#L200

The element lacks minOccurs="0", so my IDE believes it is a required element in <repository/>.

I think that both should be optional—<codeSets/> should be optional within <repository/> and an empty <codeSets/> element should be allowed.

kleihan commented 3 months ago

Implemented in RC1