Skip to content

Make route colors optional#176

Merged
antoine-de merged 3 commits intorust-transit:mainfrom
jbruechert:optional-route-colors
Aug 20, 2025
Merged

Make route colors optional#176
antoine-de merged 3 commits intorust-transit:mainfrom
jbruechert:optional-route-colors

Conversation

@jbruechert
Copy link
Contributor

When generating feeds using the structures from gtfs_structures, it is
desirable to be able to serialize an empty column.

I suspect it is also relevant to know on the comsumer side wether black
is a brand color or a fallback.

This change is a an API break.

@jbruechert jbruechert force-pushed the optional-route-colors branch 2 times, most recently from a725b22 to 36a3ec6 Compare August 2, 2025 01:56
@antoine-de
Copy link
Collaborator

Seems a bit more difficult to use, but I agree with you that this is better for serialization.

if someone needs it, maybe we can add getter like

fn route_color(&self) -> RGB8 { self.route_color.unwrap_or(DEFAULT_ROUTE_COLOR) }

@antoine-de
Copy link
Collaborator

If you want it to be released right away, can you update the version (to 0.45.0 since it's a breaking change)?

@jbruechert
Copy link
Contributor Author

Seems a bit more difficult to use, but I agree with you that this is better for serialization.

if someone needs it, maybe we can add getter like

fn route_color(&self) -> RGB8 { self.route_color.unwrap_or(DEFAULT_ROUTE_COLOR) }

Makes sense! I'll add that and update the tests.

@jbruechert jbruechert force-pushed the optional-route-colors branch from 36a3ec6 to a60b5d9 Compare August 7, 2025 15:36
Copy link
Collaborator

@antoine-de antoine-de left a comment

Choose a reason for hiding this comment

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

thanks!

When generating feeds using the structures from gtfs_structures, it is
desirable to be able to serialize an empty column.

I suspect it is also relevant to know on the comsumer side wether black
is a brand color or a fallback.

This change is a an API break.
@jbruechert jbruechert force-pushed the optional-route-colors branch from bd873aa to e4e43a1 Compare August 7, 2025 16:21
@antoine-de
Copy link
Collaborator

oups clippy seems unhappy with the string format (I don't really agree with it here, but it's nice to keep the lints).

can you make the change ? else I'll do it.

@jbruechert
Copy link
Contributor Author

oups clippy seems unhappy with the string format (I don't really agree with it here, but it's nice to keep the lints).

can you make the change ? else I'll do it.

done

@jbruechert
Copy link
Contributor Author

Is there anything else I need to do?

@antoine-de antoine-de merged commit 4884a9f into rust-transit:main Aug 20, 2025
2 checks passed
@antoine-de
Copy link
Collaborator

oups, no sorry, I was in holiday without a connection.

thanks for the contribution!

@jbruechert
Copy link
Contributor Author

Ah no problem, I hope you enjoyed your holidays :)

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.

2 participants