-
Notifications
You must be signed in to change notification settings - Fork 110
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
APP-6182 validate model triplets in meta.json #4369
Conversation
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.
Nice! Really like the UX of also validating that the API is valid.
if err := api.Validate(); err != nil { | ||
return errors.Wrap(err, "failed to validate API") | ||
} | ||
if !slices.Contains(rdkAPITypes, api.Type.Name) { |
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.
[opt not a priority at all] use api.IsComponent() || api.IsService()
like the other uses in rdk
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.
if the rdkAPITypes
slice lived in RDK instead of CLI, it would be a canonical place to store the check; it's self-updating in a way that the ||
expression isn't
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.
Or better yet, if it lived inside api.Validate()
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.
or like generally would be nice if go enums exposed the entire list of values at the language level
we sort of get this from the linter but only in switch statements
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.
if it lived inside api.Validate()
yes good point
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.
LGTM; thanks!
What changed
ParseAPI
fromAPI.UnmarshalJSON
inresource
package so it can be used in CLIWhy
Reviewer question
resource
package within RDK? my gut says no because it would require more research