You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating a CRD entity, the Length attribute has -1 as default value for minimum and maximum length. These values are then converted to null when read from the property. But when serializing the constraint into a Kubernetes resource, not filled values are rendered as -1.
See below a sample of [Length(minLength: 1)] public string Name { get; set; } = string.Empty; gets rendered:
I suspect not filling minLength will render to something similarly wrong...
To reproduce
Generate a new empty operator
Create a new custom kubernetes entity having its spec something like public class EntitySpec { [Length(minLength: 1)] public string Name { get; set; } = string.Empty; }
Compile the project
Check the generated resource yaml
Expected behavior
The generated spec for the property should look like:
name:
minLength: 1nullable: falsetype: string
Screenshots
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered:
melchor629
changed the title
[bug]: Length attribute with maxLength not filled generates incorrect yaml
[bug]: Length attribute with maxLength not filled generates incorrect OpenApiSpec
Apr 3, 2024
Describe the bug
When creating a CRD entity, the
Length
attribute has-1
as default value for minimum and maximum length. These values are then converted tonull
when read from the property. But when serializing the constraint into a Kubernetes resource, not filled values are rendered as-1
.See below a sample of
[Length(minLength: 1)] public string Name { get; set; } = string.Empty;
gets rendered:I suspect not filling
minLength
will render to something similarly wrong...To reproduce
public class EntitySpec { [Length(minLength: 1)] public string Name { get; set; } = string.Empty; }
Expected behavior
The generated spec for the property should look like:
Screenshots
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: