Skip to content

[mirror] Flattener: keep unions excluded by flattenUnionTypesExcludeRegex - #3

Open
jdsika wants to merge 1 commit into
nextfrom
fix/flattener-keep-excluded-unions
Open

jdsika wants to merge 1 commit into
nextfrom
fix/flattener-keep-excluded-unions

Conversation

@jdsika

@jdsika jdsika commented Sep 26, 2026

Copy link
Copy Markdown

Mirror of upstream ShapeChange#798, for use on feature/asam-pipeline until it is merged upstream.

rule-trf-prop-flatten-types does not flatten a union whose name matches
flattenUnionTypesExcludeRegex (ShapeChange#724), so the properties that have it as
value type keep that type. At the end of the rule, however, every class of
category union was removed from the model, excluded or not. Removing the
class also removes the properties typed by it (GenericModel.remove), without
an error or a warning, so an excluded union and every property that
referenced it disappeared from the output.

The final removal now skips a union that matches the parameter, as it
already skips a union that represents a feature type set when
rule-trf-prop-flatten-types-ignoreUnionsRepresentingFeatureTypeSets is in
effect. Both places decide exclusion with the same method,
isExcludedUnionType(ClassInfo). A union that is not excluded is still
removed, whether or not a property used it. The parameter documentation in
Flattener.adoc now says that excluded unions are also not removed.

The new test test_flattenTypes_excludeUnionTypes runs
rule-trf-prop-flatten-types on the model of the 'basic' flattener test with
IntegerReason excluded, and with CI_CitationReason mapped to CharacterString
so that no property uses it. The reference keeps IntegerReason and the two
properties typed by it, SourceInfo.prop9 and IntegerMeta.valueOrReason
(flattened to prop11.valueOrReason), and does not contain CI_CitationReason.
The test fails without this change, and also when every union is kept once
the parameter is set. The SCXML-based configuration was created with
SCXMLTestResourceConverter from the EA configuration and reads the existing
testFlattening.zip, the SCXML already derived from testFlattening.qea.

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
@jdsika
jdsika force-pushed the fix/flattener-keep-excluded-unions branch from 6c191b8 to de29b1f Compare September 26, 2026 11:26
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

Successfully merging this pull request may close these issues.

1 participant