Skip to content
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

handle simple enum types #16

Closed
clux opened this issue Nov 28, 2021 · 2 comments · Fixed by #65
Closed

handle simple enum types #16

clux opened this issue Nov 28, 2021 · 2 comments · Fixed by #65
Assignees

Comments

@clux
Copy link
Member

clux commented Nov 28, 2021

Currently, I think we will error out, or omit enum parts of the schema.

It would be helpful to either find a good / official CRD from somewhere that relies on enums, or even better, a POC PR that showcases how to parse them.

@clux clux added the help wanted Extra attention is needed label Nov 28, 2021
@alex-hunt-materialize
Copy link
Contributor

Currently, I think we will error out, or omit enum parts of the schema.

Current behavior is to omit the enum part, and just treat it (in this example) as a simple String.

operator:
  enum:
  - In
  - NotIn
  - Exists
  - DoesNotExist
  type: string

becomes

pub operator: String,

A complete example can be found in the Linkerd 2.11 ServerAuthorization and Server CRDs (at least, as generated by their helm chart). I've saved the generated one in a gist, since I can't find an official download of a pre-generated CRD.
https://gist.github.com/alex-hunt-materialize/2743b1e2e58a49c4df0a11ecb39f46ab

These CRDs actually have several issues with the current generation, but I'll make separate issues for those.

@clux clux linked a pull request May 2, 2022 that will close this issue
@clux
Copy link
Member Author

clux commented May 2, 2022

Handling simple enum's like this turns out not to be particularly difficult. Provided there are no other cases that can set type to something else or leave it unset, this will be handled by #65. The more complex enums using oneOf is going to be more complicated (and will open some follow-ups), but will try to use the ServiceMonitor as acceptance criteria for this issue as it only has a simple enum.

@clux clux changed the title handle enum types handle simple enum types May 2, 2022
@clux clux removed the help wanted Extra attention is needed label May 2, 2022
@clux clux self-assigned this May 2, 2022
@clux clux closed this as completed in #65 May 2, 2022
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 a pull request may close this issue.

2 participants