baldimir commented on issue #1019: URL: https://github.com/apache/incubator-kie-issues/issues/1019#issuecomment-2074714731
This is written in the spec: `An ItemDefinition element may restrict the values that are allowed from typeRef, using the allowedValues attribute.` So if typeref references a type that is constraining something, adding allowedValues (and similarly typeConstraint) on the child type using this typeref, will further constraint the already existing constraints. This is further there in the spec: `When an ItemDefinition has sibling itemComponents, their values are available in the evaluation context of the UnaryTests of the allowedValues.` - This is not clear to me, I asked for clarification. Then there is this: `An alternative way to define an instance of ItemDefinition is as a composition of ItemDefinition elements. An instance of ItemDefinition may contain zero or more itemComponent, which are themselves ItemDefinitions. Each itemComponent in turn may be defined by either a typeRef and allowedValues or a nested itemComponent. In this way, complex types may be defined within DMN.` In combination with the XSD, where there is a choice element, this implies to me, that there are these possible cases for using allowedValues and typeConstraint: 1. ItemDefinition with typeRef to base type like string. - Can use allowedValues and typeConstraint. Cannot use itemComponents. Restricts the string type. 2. ItemDefiniton with typeRef to another custom ItemDefinition. This custom ItemDefinition can also use allowedValues and typeConstraint or itemComponents freely. - Can use allowedValues and typeConstraint. Cannot use itemComponents. If the parent ItemDefinition referenced with typeRef is also using allowedValues, typeConstraint or itemComponents, all restrictions from such parent apply also in the child ItemDefinition. TLDR - If parent ItemDefinition has typeRestrictions, either from allowedValues, typeConstraint or its itemComponents, child ItemDefinition restricts the type further. See my first paragraph in this comment (`An ItemDefinition element may restrict the values that are allowed from typeRef, using the allowedValues attribute.`). 3. ItemDefinition with itemComponents. Cannot use allowedValues or typeConstraint. Each itemComponent can have typeRestrictions and if it references a parent type with typeRef, can inherit restrictions. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
