Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api: railjson V3 #1933

Merged
merged 13 commits into from
Oct 4, 2022
Merged

api: railjson V3 #1933

merged 13 commits into from
Oct 4, 2022

Conversation

Tguisnet
Copy link
Contributor

@Tguisnet Tguisnet commented Sep 20, 2022

close #1909

Changelog in railjson v3

In a nutshell :

Appart from the errors, ObjectRef dissappeared from all objects to become a String.
(or a Waypoint for route entry/exit point)
Cosmetic fields are put in a struct for their scope (SncfExtension, or IdentifierExtension for example).
Those structs are put in an other struct containing all different scope of extension (TrackSectionExtension, or OperationalPointExtension for example) and they are optional.

Tracksection :

  • navigability : suppressed
  • extensions : new field containing TrackSectionExtensions struct
  • TrackSectionExtensions : new struct containing optional TrackSectionSncfExtension struct
  • fields line_code, line_name, track_number, track_name are moved in TrackSectionSncfExtension

Detector :

  • track : type changed from ObjectRef to String (of the track's id)

BufferStop :

  • track : type changed from ObjectRef to String (of the track's id)

Waypoint (new) :

  • this is a polymorphic reference on BufferStop or Detector, This is used for the entry and exit point of the routes.

ApplicableDirectionsTrackRange :

  • track : type changed from ObjectRef to String (of the track's id)

DirectionalTrackRange :

  • track : type changed from ObjectRef to String (of the track's id)

TrackEndpoint :

  • track : type changed from ObjectRef to String (of the track's id)

OperationalPoint :

  • extensions : new field containing OperationalPointExtensions structure
  • OperationalPointExtensions : new struct containing OperationalPointSncfExtension and OperationalPointIdentifierExtension structures both optional
  • fields name and uic are moved in OperationalPointIdentifierExtension
  • fields ch_short_label, ch_long_label, ci, ch, trigram are moved in OperationalPointSncfExtension
  • OperationalPointPart : track type changed from ObjectRef to String (of the track's id)

Route :

entry_point : type changed from ObjectRef to Waypoint
exit_point : type changed from ObjectRef to Waypoint
release_detectors : type change from List<ObjectRef> to List<String>

Signal :

  • track : type changed from ObjectRef to String (of the track's id)
  • linked_detector : type changed from Optional<ObjectRef> an optional Optional<String>
  • extensions : new field containing SignalExtensions struct
  • SignalExtensions : new struct containing optional SignalSncfExtension
  • fields default_aspect, installation_type, is_in_service, is_lightable, is_operational, label, physical_organization_group, responsible_group, side, support_type, type_code, value are moved in SignalSncfExtension

Switch :

  • switch_type : type changed from ObjectRef to String

SwitchType :

  • bidirectional : suppressed

TrackSectionLink :

  • navigabilty : suppressed

@multun
Copy link
Contributor

multun commented Sep 21, 2022

is it what you had in mind?

{
    "id": "track.42",
    "extensions": {
        "sncf": {"foo": "bar"}
    }
}

If so, metaprogramming feels overkill

@flomonster
Copy link
Contributor

It's exactly what we want to achieve here. Metaprog kind of simplified a lot the code.

Copy link
Contributor

@flomonster flomonster left a comment

Choose a reason for hiding this comment

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

  • Remove applicable_train_type (not used in core)
  • API could adapt its endpoint to download railjson without extensions
  • Rework refs. Could be less flexible.
  • Rework signals cosmetic fields
  • Remove bidirectional from the SwitchPortConnection
    • The navigability is manged only with routes (needed to be documented)

@flomonster
Copy link
Contributor

flomonster commented Sep 21, 2022

New route schema suggestion:

class Route(BaseObjectTrait):
    """
    This class is used to describe routes on the infrastructure.
    """

    entry_point: ObjectReference = Field(description="Identifier and type used to define an entry point for the route")
    entry_point_direction: ObjectReference = Field(description="Identifier and type used to define an entry point for the route")
    exit_point: ObjectReference = Field(description="Identifier and type used to define an exit point for the route")
    release_detectors: List[ObjectReference] = Field(
        description="Detector allowing the release of resources reserved from the beginning of the route until this one"
    )
    switches_directions: List[Tuple[ObjectReference, str]] = ...

@flomonster flomonster changed the title api: idea of a railjson V3 api: railjson V3 Sep 26, 2022
@flomonster flomonster force-pushed the tgu/railjson-v3 branch 3 times, most recently from 2eabb99 to 9e62dad Compare September 27, 2022 13:10
@codecov
Copy link

codecov bot commented Sep 27, 2022

Codecov Report

Merging #1933 (9827427) into dev (7e0711c) will increase coverage by 0.02%.
The diff coverage is 84.56%.

❗ Current head 9827427 differs from pull request most recent head 7f1a6a3. Consider uploading reports for the commit 7f1a6a3 to get more accurate results

@@             Coverage Diff              @@
##                dev    #1933      +/-   ##
============================================
+ Coverage     80.12%   80.15%   +0.02%     
+ Complexity     1636     1631       -5     
============================================
  Files           261      261              
  Lines          8448     8354      -94     
  Branches        939      941       +2     
============================================
- Hits           6769     6696      -73     
+ Misses         1284     1261      -23     
- Partials        395      397       +2     
Flag Coverage Δ
core 80.79% <90.00%> (-0.05%) ⬇️
editoast 78.65% <83.62%> (+0.15%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...a/fr/sncf/osrd/railjson/schema/infra/RJSRoute.java 50.00% <ø> (ø)
.../fr/sncf/osrd/railjson/schema/infra/RJSSwitch.java 0.00% <ø> (ø)
...sncf/osrd/railjson/schema/infra/RJSSwitchType.java 93.33% <ø> (+5.09%) ⬆️
...cf/osrd/railjson/schema/infra/RJSTrackSection.java 100.00% <ø> (+28.57%) ⬆️
...srd/railjson/schema/infra/RJSTrackSectionLink.java 83.33% <ø> (-2.39%) ⬇️
...ljson/schema/infra/trackobjects/RJSBufferStop.java 100.00% <ø> (ø)
.../railjson/schema/infra/trackobjects/RJSSignal.java 85.71% <ø> (ø)
...json/schema/infra/trackobjects/RJSTrackObject.java 100.00% <ø> (ø)
...on/schema/infra/trackobjects/RJSTrainDetector.java 100.00% <ø> (ø)
...trackranges/RJSApplicableDirectionsTrackRange.java 85.71% <ø> (ø)
... and 51 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@flomonster flomonster force-pushed the tgu/railjson-v3 branch 6 times, most recently from ea3dbbd to 7e0cecc Compare October 3, 2022 16:18
multun
multun previously approved these changes Oct 4, 2022
@flomonster flomonster force-pushed the tgu/railjson-v3 branch 2 times, most recently from 9827427 to f169206 Compare October 4, 2022 10:27
@flomonster flomonster marked this pull request as ready for review October 4, 2022 10:27
@flomonster flomonster requested a review from a team October 4, 2022 10:27
@flomonster flomonster requested a review from eckter as a code owner October 4, 2022 10:27
@flomonster flomonster requested a review from a team October 4, 2022 10:27
flomonster
flomonster previously approved these changes Oct 4, 2022
flomonster
flomonster previously approved these changes Oct 4, 2022
@flomonster flomonster merged commit 2898eae into dev Oct 4, 2022
@flomonster flomonster deleted the tgu/railjson-v3 branch October 4, 2022 14:00
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.

Find a new design to split functional and cosmetic fields
5 participants