Skip to content

Make agency id feed scoped - #3035

Merged
t2gran merged 7 commits into
opentripplanner:dev-2.xfrom
CGI-Move:agency-feed-id
Apr 23, 2020
Merged

t2gran merged 7 commits into
opentripplanner:dev-2.xfrom
CGI-Move:agency-feed-id

Conversation

@hannesj

@hannesj hannesj commented Apr 16, 2020 •

Copy link
Copy Markdown
Contributor

This pull request aims to make the agency id feed scoped, similar to how all the other transit entities are. The reason for the previous behaviour is due to the OBA GTFS models, which were previously used as the internal model for all transit entities in OTP, and for which the agency id was only a string. As we have copied over the models to internal models, we have the freedom to change them.

A comment in the code suggest that this is a temporary hack, and should be fixed. Another reason for fixing this, is that the HSLDevcom GraphQL API has the agencies as feed scoped, and when porting over the api to a sandbox feature, we need to somehow make the agencies feed aware. Another less invasive alternative, would be just writing the feed in a separate field in the agency object.

This is a breaking change, as the api responses for the agency will now include the feed id, as they do with all the other transit entities. Similarly for input parameter for banned and preferred agencies, the feed id is now required in similar format to how it is output.

To be completed by pull request submitter:

  • issue: This issue is described in the code as a todo
  • roadmap: Check the roadmap for this feature or bug. If it is not already on the roadmap, PLC will discuss as part of the review process.
  • tests: Have you added relevant test coverage? Are all the tests passing on the continuous integration service (Travis CI)?
  • formatting: Have you followed the suggested code style?
  • documentation: If you are adding a new configuration option, have you added an explanation to the configuration documentation tables and sections?
  • changelog: add a bullet point to the changelog file with description and link to the linked issue

To be completed by @opentripplanner/plc:

  • reviews and approvals by 2 members, ideally from different organizations
  • after merging: update the relevant card on the roadmap

@hannesj
hannesj requested a review from a team April 16, 2020 13:24
@t2gran

t2gran commented Apr 17, 2020 •

Copy link
Copy Markdown
Member

I think now is the time to make all ids feed scoped, so I support doing this breaking change. I already did some cleanup when refactoring the API. I can review this PR when you have integrated the changes in dev-2.x.

One comment on the code changes: All API types uses String as a id type. The internal type should use FeedScopedId and the FeedScopedIdMapper should be used to map. One goal here is to make the internal ID an interface so we can change the id generation and use different strategies per deployment/feed. In Norway all ids are uniq and we do not want the a feed-scoped id, because this make it harder for clients to integrate with other services.

@hannesj

hannesj commented Apr 17, 2020

Copy link
Copy Markdown
Contributor Author

Updated to newest dev-2.x.

The ApiAgency uses FeedScopedIdMapper here.

The ApiLeg uses FeedScopedId already for tripId, should both of these be changed to Strings?

@t2gran

t2gran commented Apr 20, 2020 •

Copy link
Copy Markdown
Member

The ApiLeg uses FeedScopedId already for tripId, should both of these be changed to Strings?

Yes.

@t2gran t2gran closed this Apr 20, 2020
@hannesj

hannesj commented Apr 20, 2020

Copy link
Copy Markdown
Contributor Author

@t2gran Those are now updated, along with a changelog entry and migration guide. Could you re-open this, as I don't seem to have permissions to do it.

@t2gran t2gran reopened this Apr 21, 2020
@t2gran

t2gran commented Apr 21, 2020

Copy link
Copy Markdown
Member

We can test this with NeTEx at Entur this week.

@hannesj hannesj removed their assignment Apr 21, 2020
@gmellemstrand

Copy link
Copy Markdown
Contributor

I tested this with Entur's NeTEx feed and found no problems.

@t2gran t2gran left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Overall this looks good, but I expect you to get some merge conflicts and there is this one comment on parsing a list of ids.

abyrd
abyrd previously approved these changes Apr 23, 2020
@t2gran
t2gran merged commit d332745 into opentripplanner:dev-2.x Apr 23, 2020
@hannesj
hannesj deleted the agency-feed-id branch April 23, 2020 10:30
@gmellemstrand gmellemstrand mentioned this pull request Apr 27, 2020
@abyrd abyrd added this to the 2.0 milestone Oct 13, 2020
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.

4 participants