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
{{ message }}
Repository navigation
[bug]: Length attribute with maxLength not filled generates incorrect OpenApiSpec #741
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:
changed the title [-][bug]: Length attribute with maxLength not filled generates incorrect yaml[/-][+][bug]: Length attribute with maxLength not filled generates incorrect OpenApiSpec[/+]on Apr 3, 2024
Activity
[-][bug]: Length attribute with maxLength not filled generates incorrect yaml[/-][+][bug]: Length attribute with maxLength not filled generates incorrect OpenApiSpec[/+]fix(CRDS): Handle Optional Min/Max Length in LengthAttribute (#1051)