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

[KUBE] Use Schemaless for Objects that can be Unmarshaled as string or struct #166

Closed
spolti opened this issue Mar 29, 2023 · 0 comments · Fixed by #167
Closed

[KUBE] Use Schemaless for Objects that can be Unmarshaled as string or struct #166

spolti opened this issue Mar 29, 2023 · 0 comments · Fixed by #167
Assignees
Labels
enhancement 🙏 New feature or request

Comments

@spolti
Copy link
Member

spolti commented Mar 29, 2023

What would you like to be added:

Kubernetes Kubebuilder code generator is not able to handle union tag which handles the oneOf definition that allows us to define which types a struct accepts two types, example, string and boolean.
More information on kubernetes-sigs/controller-tools#298

One option to overcome this problem is defining the affect struct as schemaless and delegate the workflow validation to the admission webhook.

E..g:

// +kubebuilder:validation:Schemaless
// +kubebuilder:pruning:PreserveUnknownFields
Object *CustomObj `json:"object,omitempty"`

This way, this field can be defined as Schemaless and will accept any value.

Why is this needed:
To be able to smoothly integrate the sdk with Kubernetes.

@spolti spolti added the enhancement 🙏 New feature or request label Mar 29, 2023
@spolti spolti self-assigned this Mar 29, 2023
@spolti spolti changed the title [KUBE] Use Schemaless for Objects that can be Unmarshaled as string or struct. [KUBE] Use Schemaless for Objects that can be Unmarshaled as string or struct Mar 29, 2023
spolti added a commit to spolti/sdk-go that referenced this issue Mar 30, 2023
…two different types

fixes serverlessworkflow#166

Signed-off-by: Spolti <filippespolti@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🙏 New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant