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
List restrictions are sometimes required to apply CEL validation rules. Those rules can't be used at the moment because we don't offer a way to configure the topology.
/** * Annotates a list or array to further describe its topology. * <p> * Emits {@code x-kubernetes-list-type} * </p> */@Target({ ElementType.FIELD, ElementType.METHOD, ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface ListType {
/** * @return the list type */Typevalue() defaultType.ATOMIC;
/** * @return the map keys. Only used if {@link Type} is {@link Type#MAP}. */String[] mapKeys() default {};
/** * The Kubernetes List Type */enumType {
/** * The list is treated as a single entity, like a scalar. * Atomic lists will be entirely replaced when updated. */ATOMIC,
/** * Sets are lists that must not have multiple items with the same value. Each * value must be a scalar, an object with x-kubernetes-map-type <code>atomic</code> * ({@link MapType.Type#ATOMIC}) or an array with x-kubernetes-list-type * <code>atomic</code> ({@link ListType.Type#ATOMIC}). */SET,
/** * These lists are like maps in that their elements have a non-index key * used to identify them. Order is preserved upon merge. The map tag * must only be used on a list with elements of type object. * * @see ListMapKey */MAP
}
}
/** * Marks a field as key. * Only considered if {@link ListType.Type#MAP} is used * on the parent container. * * @see ListType */@Target({ ElementType.FIELD, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface ListMapKey {
}
Is your enhancement related to a problem? Please describe
In Kubernetes the topology of lists/arrays can be described further:
https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#jsonschemaprops-v1-apiextensions-k8s-io
List restrictions are sometimes required to apply CEL validation rules. Those rules can't be used at the moment because we don't offer a way to configure the topology.
Relates to #5881
Describe the solution you'd like
Suggested Annotations:
Describe alternatives you've considered
No response
Additional context
Example:
https://github.com/baloo42/crd-generator-victools/blob/main/test/src/test/java/io/fabric8/crd/generator/victools/approvaltests/listtype/ListTypeSpec.java
https://github.com/baloo42/crd-generator-victools/blob/main/test/src/test/resources/io/fabric8/crd/generator/victools/approvaltests/CRDGeneratorVictoolsApprovalTest.approvalTest.listtypes.samples.fabric8.io.v1.approved.yml
The text was updated successfully, but these errors were encountered: