Skip to content

Resolve conflicting element names in fares: StepLimitUnit, FulfilmentMethodTypes, NumberOfUnits#1043

Open
atibaut wants to merge 1 commit into
v2.1-wipfrom
fix/conflicting-element-names
Open

Resolve conflicting element names in fares: StepLimitUnit, FulfilmentMethodTypes, NumberOfUnits#1043
atibaut wants to merge 1 commit into
v2.1-wipfrom
fix/conflicting-element-names

Conversation

@atibaut

@atibaut atibaut commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Following my semantic wave... because better machine reasoning depends on humans describing semantics with precision and without ambiguity.

Several fares elements share a name with an element of a different type or meaning in another context, which misleads implementers and produces confusing generated bindings. This PR resolves the three genuine cases without breaking existing documents, using the same pattern as #1041: the correctly named element is added, the old one is deprecated, and both are wrapped in an xsd:choice so a document cannot state the same fact twice. New components are marked +v2.1, deprecations -v2.1.

Proposed changes

1. AdjustmentUnits / quantity vs unit kind

  • On RULE STEP RESULT (netex_farePrice_version.xsd) AdjustmentUnits is xsd:decimal (a step-calculation quantity); unchanged.
  • On STEP LIMIT (netex_usageParameterTravel_version.xsd) the same name AdjustmentUnits was an enumeration (StepLimitUnitEnumeration: stops, sections, zones, networks, …) defined as 'Geographical parameter limiting the access rights by counts of stops, sections or zones'. New element StepLimitUnit added (name follows the enumeration and the owning STEP LIMIT entity); AdjustmentUnits deprecated.

2. FulfilmentMethodType / singular name, list type

  • On FULFILMENT METHOD (netex_salesDistribution_version.xsd) it is a single enumeration value; unchanged (name matches type).
  • In DistributionParametersGroup (netex_accessRightParameter_version.xsd) the same name FulfilmentMethodType held a FulfilmentMethodListOfEnumerations. New element FulfilmentMethodTypes added; the singular-named list deprecated.

3. Amount on AMOUNT OF PRICE UNIT / not a monetary amount

  • On FARE PRICE (netex_farePrice_version.xsd) Amount is CurrencyAmountType (money); unchanged.
  • On AMOUNT OF PRICE UNIT PRODUCT (netex_fareProduct_version.xsd) Amount is xsd:decimal documented as "Number of units". New element NumberOfUnits added; Amount deprecated.

Framework

  • NameOfClass enumeration (netex_entity_support.xsd): values FulfilmentMethodTypes and StepLimitUnit added in alphabetical position (NumberOfUnits already present).

All four files have a <Modified> changelog entry added.

Related cases checked but not changed

  • PaymentMethod on REFUNDING (netex_usageParameterAfterSales_version.xsd) also carries a list type under a singular name, but it is already deprecated in the schema ("DEPRECATED - use PaymentMethods on RESELLING"), so no change is needed.
  • The single-valued PaymentMethod elements on DistributionParametersGroup and fare table cells are internally consistent (singular name, singular type); whether they should allow multiple values is a modelling question for the team, not a naming defect, so they were left as-is.

Backwards compatibility

  • Old element names remain valid; the xsd:choice wrapping only prevents using both the old and new name simultaneously. No example uses the affected elements in the changed contexts (checked: no <AmountOfPriceUnit>, <AdjustmentUnits> or <FulfilmentMethodType> instances in examples/), so no example changes are needed.
  • Generated bindings gain new members but lose none.

Verification (xmllint)

  • NeTEx_publication.xsd compiles (proves the new choice content models are UPA-valid).
  • Examples validate unchanged, including those with <Amount> in other (unaffected) contexts: ENTUR-SchoolTwiceADayTripCarnet_2020120.xml, Netex_101.21_TfL_GeographicFares_UnitZone_MultipleProduct.xml, rail/Netex_era_crossborder_de.xml.

@atibaut atibaut marked this pull request as ready for review July 10, 2026 21:38
Copilot AI review requested due to automatic review settings July 10, 2026 21:38
@atibaut atibaut added the enhancement non semantic enhacement: technical enhancement, etc. label Jul 10, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves schema clarity in the fares model by resolving three element-name collisions (same element name used with different meanings/types in different contexts). It follows the established compatibility pattern (add correctly named element, deprecate old name, wrap in xsd:choice) to avoid breaking existing instance documents while improving generated bindings and implementer understanding.

Changes:

  • Add StepLimitUnit to STEP LIMIT and deprecate AdjustmentUnits alias (choice-wrapped).
  • Add FulfilmentMethodTypes to DistributionParametersGroup and deprecate singular FulfilmentMethodType list alias (choice-wrapped).
  • Add NumberOfUnits to AMOUNT OF PRICE UNIT PRODUCT and deprecate misleading Amount alias (choice-wrapped); update NameOfClass for new names.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
xsd/netex_part_3/part3_fares/netex_usageParameterTravel_version.xsd Adds StepLimitUnit and deprecates AdjustmentUnits via an optional xsd:choice in StepLimitGroup.
xsd/netex_part_3/part3_fares/netex_fareProduct_version.xsd Adds NumberOfUnits and deprecates Amount via an optional xsd:choice in AmountOfPriceUnitProductGroup.
xsd/netex_part_3/part3_fares/netex_accessRightParameter_version.xsd Adds FulfilmentMethodTypes and deprecates FulfilmentMethodType (list) via an optional xsd:choice in DistributionParametersGroup.
xsd/netex_framework/netex_responsibility/netex_entity_support.xsd Extends NameOfClass enumeration with FulfilmentMethodTypes and StepLimitUnit values.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@skinkie

skinkie commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Are you sure you target the correct branch?

@atibaut

atibaut commented Jul 11, 2026

Copy link
Copy Markdown
Contributor Author

Are you sure you target the correct branch?

Yes, the PR #1043 (fix/conflicting-element-names) targets v2.0 — the main development branch.

@skinkie

skinkie commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Are you sure you target the correct branch?

Yes, the PR #1043 (fix/conflicting-element-names) targets v2.0 — the main development branch.

This begins to feel like 3.0 work.

@atibaut

atibaut commented Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

Are you sure you target the correct branch?

Yes, the PR #1043 (fix/conflicting-element-names) targets v2.0 — the main development branch.

This begins to feel like 3.0 work.

I would like to see such semantical inconsistencies to be fixed sooner, perhaps v2.1-wip or v2.1-efip-wip. What do you think?

@skinkie

skinkie commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

100% agreed on sooner. But this will break existing implementation. Since we have released 2.0 this cannot 'just be a fix'.

…dTypes and NumberOfUnits; deprecate misleadingly named forms
@atibaut atibaut changed the base branch from v2.0 to v2.1-wip July 12, 2026 12:09
@atibaut atibaut force-pushed the fix/conflicting-element-names branch from e3037cf to 901b812 Compare July 12, 2026 12:10
@atibaut

atibaut commented Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

@skinkie, base branch changed from v2.0 to v2.1-wip, for the same reason as #1041: v2.0 is stable and this PR adds new schema components, which is development content. The markers +v2.1 and -v2.1 in the annotations now agree with the target branch.

Core decisions:

  1. v2.1-wip rather than v2.1-wip-efip, because generic naming fixes belong at the common base that both the 2.1 release and the efip profile branch build on.
  2. v2.1-wip rather than v3.0-wip, because the change is backwards compatible: correctly named elements are added and the old names stay valid as deprecated alternatives inside an xsd:choice.
  3. The branch was rebuilt on the v2.1-wip tip. Note that v2.1-wip does not yet contain the documentation typo fixes merged to v2.0 in Fix spelling errors in part3_fares documentation and comments #1039, so two documentation strings in this PR restate the corrected wording. The schema content is otherwise identical to the previous version of this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement non semantic enhacement: technical enhancement, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants