-
Notifications
You must be signed in to change notification settings - Fork 63
[MGS] Implement component details endpoint #2285
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
Conversation
andrewjstone
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code looks good, and is indeed much smaller than its apparent size.
However, unlike in my last review for #2284, the From impls here are mostly identical type translations to what's in gateway_messages. Doing this type of translation repeatedly seems unfortunate. Is the translation only because of the way we are using progenitor here, or is there a more substantial reason for using different types on the MGS interface and the SP interface? If it's only because of progenitor, maybe we should consider how we can reuse most types if we want to.
None of the above is anywhere near urgent, and the code is quite clean. I'm just curious if we can make our lives easier with fewer conversions, or if this actually provides a benefit from translation that I'm not seeing.
|
There are some subtle differences in the way some of the types are structured due to OpenAPI restrictions; e.g., pub enum PortMode {
Sfi,
BaseKr,
Sgmii(Speed),
Qsgmii(Speed),
}but here it's defined as pub enum PortMode {
Sfi,
BaseKr,
Sgmii { speed: Speed },
Qsgmii { speed: Speed },
}because the variant-with-one-tuple-value isn't allowed by OpenAPI (at least where we use Stepping back a second - in order to use |
e38069d to
bd08cf8
Compare
|
(Happy to continue the conversation about duplicated types even though this is merged!) |
|
Thanks for the details @jgallagher. I think you are probably right here, and the differences and subtle nuances will keep arising such that we'd always have some weird mix of "gateway-messages" types and MGS api types.
I believe this is precisely the reason progenitor doesn't automatically re-use types. I think @ahl was more worried about this with regard to public APIs, but I think your concern here is also valid. In short, let's keep things how they are and I'll stop looking at them as "duplicates" . |
|
I don't want to weigh in on whether it makes sense in this case, but Adam recently added support for "replacement" types in |
This allows us to fetch things like monorail port status information:
and current sensor readings for any devices that have them:
This builds on #2284 and should be merged after it. It's not nearly as large as the diff implies: the vast majority of that is changes to the OpenAPI spec, and the majority of what's left after that is
Fromimpls.