-
Notifications
You must be signed in to change notification settings - Fork 416
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
❇️ pkg/internal/codegen/parse: "Title" CRD validation annotation #182
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: estroz If they are not already assigned, you can assign the PR to them by writing The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
no general objections, but the string parsing logic is a bit wonky
title := strings.TrimSpace(strings.Join(parts[1:], " ")) | ||
if len(title) > 2 { | ||
// Remove beginning and ending quote from non-empty strings. | ||
if title[0] == '"' { |
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 accepts Title=foo"
, which doesn't seem to be valid. Also, Title=f
should probably be valid. I think we may need to hold on here a bit and define more format parsing semantics for our markers (I've got some stuff in the works that I'll post soon).
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.
We could simply require string fields be wrapped in ""
and anything inside will be interpreted literally.
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.
I've got parsing logic written. We should be consistent across our different annotations.
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.
Has it been merged?
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.
not yet, it's part of a broader overhaul being tracked on the crdgenerator feature branch
@estroz: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
this is integrated into v0.2.0, so it should be all set now. |
This PR implements the
SchemaProps.Title
field as an annotation:+kubebuilder:validation:Title="some title"
, where the quoted string following=
is stripped of surrounding quotes and interpreted literally as a field's title. This validation is not inherited by child props.Reference: #156 (comment)
/cc @mengqiy @DirectXMan12 @droot