Skip to content

Write API: Implement support for multi-modal stop places #364

Description

@ialuy

Description

Implement support for multi-modal stop places through the write API. Use atomic, NeTEx-compatible payloads. Client must send full parent + children payloads, and Tiamat treats it as the exhaustive truth.

Endpoints

Operation Method Path Body
Create parent + children POST /write/multimodal XML: StopPlacesDto with parent (first) + children
Update parent + children PATCH /write/multimodal XML: StopPlacesDto with full parent + all children
Get parent + children GET /write/multimodal/{parentId} -
Delete parent DELETE /write/{stopPlaceId} - (existing endpoint)

Payload format

Use existing StopPlacesDto (XML wrapper). First element is the parent (no quays), remaining elements are the children (
with parentSiteRef + quays).

<stopPlaces>
    <StopPlace version="1" id="parent-id">
        <Name>Parent</Name>
    </StopPlace>
    <StopPlace version="1" id="child-id-1">
        <Name>Child 1</Name>
        <StopPlaceType>busStation</StopPlaceType>
        <ParentSiteRef ref="parent-id" version="1"/>
        <quays></quays>
    </StopPlace>
    <StopPlace version="1" id="child-id-2">
        <Name>Child 2</Name>
        <StopPlaceType>railStation</StopPlaceType>
        <ParentSiteRef ref="parent-id" version="1"/>
        <quays></quays>
    </StopPlace>
</stopPlaces>

Key points

  • Atomic payloads: Each request contains the "full truth" (no separate add/remove/update child endpoints.)
  • CREATE (POST): All children are present in payload. Minimum 2 children required.
  • UPDATE (PATCH): Payload is exhaustive. The parent must have an existing Tiamat ID.
    • Children with Tiamat IDs → matched to existing children and updated
    • Children without Tiamat IDs → created as new children
    • Existing children absent from the payload → removed from parent, become mono-modal stops (parentSiteRef cleared)
    • After the operation, minimum 2 children must remain (reject otherwise?)
  • GET: Returns the same StopPlacesDto format (parent first, then children)
  • DELETE: Reuses existing DELETE /write/{stopPlaceId} endpoint (already handles parent stop places via
    StopPlaceTerminator)

Requirements

  • Parent must NOT have quays
  • Children must have quays and parentSiteRef
  • Minimum 2 children on create and after any update
  • Children must not be parent stop places themselves
  • New children must not already have a parentSiteRef
  • On update, child Tiamat IDs in the payload must be children of the specified parent
  • Removed children become mono-modal (parentSiteRef cleared)

Acceptance criteria

  • Can create multi-modal parent with 2+ children defined in a single payload
  • Can update multi-modal parent; adding new children, removing existing children, and updating child properties
  • Payload is treated as exhaustive: Children absent from update payload are removed and become mono-modal
  • Minimum 2 children enforced on both create and update(?)
  • Can get parent stop place with children as XML (StopPlacesDto format)
  • Can delete parent via existing DELETE /write/{stopPlaceId} endpoint
  • Update rejects payloads where a child NSR ID doesn't belong to the specified parent

Note: An exhaustive list of validation rules still needs to be defined.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions