Skip to content

Duplicated validation when validation is on the type declaration #1294

@mcbenjemaa

Description

@mcbenjemaa

I have a custom type called MTU,

// MTU is the network device Maximum Transmission Unit. MTUs below 1280 break IPv6.
// +optional
// +kubebuilder:validation:XValidation:rule="self == 1 || ( self >= 576 && self <= 65520)",message="invalid MTU value"
type MTU *uint16

this type is used twice in my spec, and when generating manifests
I got duplicated validation for the same field.

  mtu:
    description: |-
      MTU is the network device Maximum Transmission Unit.
      When set to 1, virtio devices inherit the MTU value from the underlying bridge.
    type: integer
    x-kubernetes-validations:
    - message: invalid MTU value
      rule: self == 1 || ( self >= 576 && self <= 65520)
    - message: invalid MTU value
      rule: self == 1 || ( self >= 576 && self <= 65520)

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions