Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[crd-generator] Remove deprecated support for NotNull #4597

Merged
merged 2 commits into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@
* Fix #3896: added dsl support for server side apply
* Fix #4582: updated [client.secrets] createOrReplace document

#### _**Note**_: Breaking changes in the API
#### _**Note**_: Breaking changes
* Fix #4515: files located at the root of jars named model.properties, e.g. core.properties, have been removed
* Fix #3923: removed KubernetesResourceMappingProvider - a META-INF/services/io.fabric8.kubernetes.api.model.KubernetesResource list of resources is used instead.
* Fix #4597: remove the deprecated support for `javax.validation.constraints.NotNull` in the `crd-generator`, to mark a property as `required` it needs to be annotated with `io.fabric8.generator.annotation.Required`

### 6.2.0 (2022-10-20)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ public abstract class AbstractJsonSchema<T, B> {
public static final String ANNOTATION_PATTERN = "io.fabric8.generator.annotation.Pattern";
public static final String ANNOTATION_NULLABLE = "io.fabric8.generator.annotation.Nullable";
public static final String ANNOTATION_REQUIRED = "io.fabric8.generator.annotation.Required";
public static final String ANNOTATION_NOT_NULL = "javax.validation.constraints.NotNull";
public static final String ANNOTATION_SCHEMA_FROM = "io.fabric8.crd.generator.annotation.SchemaFrom";
public static final String ANNOTATION_PERSERVE_UNKNOWN_FIELDS = "io.fabric8.crd.generator.annotation.PreserveUnknownFields";
public static final String ANNOTATION_SCHEMA_SWAP = "io.fabric8.crd.generator.annotation.SchemaSwap";
Expand Down Expand Up @@ -358,11 +357,6 @@ public void process() {
case ANNOTATION_PATTERN:
pattern = (String) a.getParameters().get(VALUE);
break;
case ANNOTATION_NOT_NULL:
LOGGER.warn("Annotation: {} on property: {} is deprecated. Please use: {} instead", ANNOTATION_NOT_NULL, name,
ANNOTATION_REQUIRED);
required = true;
break;
case ANNOTATION_REQUIRED:
required = true;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
import io.fabric8.generator.annotation.Pattern;
import io.fabric8.generator.annotation.Required;

import javax.validation.constraints.NotNull;

public class AnnotatedSpec {
@JsonProperty("from-field")
@JsonPropertyDescription("from-field-description")
Expand All @@ -37,7 +35,7 @@ public class AnnotatedSpec {
private int max;
private String singleDigit;
private String nullable;
@NotNull
@Required
private boolean emptySetter;
@Required
private boolean emptySetter2;
Expand All @@ -52,7 +50,7 @@ public class AnnotatedSpec {

@JsonProperty("from-getter")
@JsonPropertyDescription("from-getter-description")
@NotNull
@Required
public int getFoo() {
return foo;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@
package io.fabric8.crd.example.extraction;

import com.fasterxml.jackson.annotation.JsonProperty;

import javax.validation.constraints.NotNull;
import io.fabric8.generator.annotation.Required;

public class FooExtractor {

@JsonProperty("BAZ")
@NotNull
@Required
public int bar;

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@
*/
package io.fabric8.crd.generator.zookeeper.v1;

import io.fabric8.generator.annotation.Required;
import io.fabric8.kubernetes.model.annotation.SpecReplicas;

import javax.validation.constraints.NotNull;

public class ZookeeperSpec {

@SpecReplicas
private int size;
@NotNull
@Required
private String version;
private boolean ephemeral;
}
4 changes: 1 addition & 3 deletions doc/CRD-generator.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,11 @@ The field will have the `nullable` property in the generated CRD, such as:

### io.fabric8.generator.annotation.Required

__DEPRECATED:__ `javax.validation.constraints.NotNull`

If a field or one of its accessors is annotated with `io.fabric8.generator.annotation.Required`

```java
public class ExampleSpec {
@NotNull
@Required
int someValue;
}
```
Expand Down