forked from fabric8io/kubernetes-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for minLength and maxLength (fabric8io#5836)
- Loading branch information
Showing
5 changed files
with
74 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
generator-annotations/src/main/java/io/fabric8/generator/annotation/Size.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package io.fabric8.generator.annotation; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* Decorates the resulting property with size limits. | ||
* <p> | ||
* The annotation can be used on strings, list/arrays and maps and will result in an appropriate JSON Schema constraint: | ||
* <ul> | ||
* <li>{@code minLength} and/or {@code maxLength} for a String</li> | ||
* <li>{@code minItems} and/or {@code maxItems} for a list/array</li> | ||
* <li>{@code minProperties} and/or {@code maxProperties} for a map</li> | ||
* </ul> | ||
* </p> | ||
* | ||
* @see <a href= | ||
* "https://kubernetes.io/docs/reference/kubernetes-api/extend-resources/custom-resource-definition-v1/#JSONSchemaProps"> | ||
* Kubernetes Docs - API Reference - CRD v1 - JSONSchemaProps | ||
* </a> | ||
*/ | ||
@Target({ ElementType.ANNOTATION_TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.TYPE_USE }) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface Size { | ||
long min() default 0; | ||
|
||
long max() default Long.MAX_VALUE; | ||
} |