Skip to content

Commit

Permalink
add more explain for changelog & doc
Browse files Browse the repository at this point in the history
Signed-off-by: wineway <wangyuweihx@gmail.com>
  • Loading branch information
wineway authored and manusa committed Sep 16, 2022
1 parent b65f154 commit 666a139
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Fix #4383: bump snakeyaml from 1.30 to 1.31

#### New Features
* Feat: add annotation @PreserveUnknownFields for generation field
* Feat: add annotation @PreserveUnknownFields for marking generated field have `x-kubernetes-preserve-unknown-fields: true` defined

#### _**Note**_: Breaking changes in the API
* Fix #4350: SchemaSwap's fieldName parameter now expects a field name only, not a method or a constructor.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.lang.annotation.*;

/*
* Used to tweak the behavior of the crd-generator
* Used to emit 'x-kubernetes-preserve-unknown-fields'
*/
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
Expand Down
29 changes: 15 additions & 14 deletions doc/CRD-generator.md
Original file line number Diff line number Diff line change
Expand Up @@ -383,19 +383,20 @@ will be generated as:

## Features cheatsheet

| Annotation | Description |
|-----------------------------------------------------------|---------------------------------------------------------------------------------------|
| `com.fasterxml.jackson.annotation.JsonProperty` | The field is named after the provided value instead of looking up the java field name |
| `com.fasterxml.jackson.annotation.JsonPropertyDescription`| The provided text is be embedded in the `description` of the field |
| `com.fasterxml.jackson.annotation.JsonIgnore` | The field is ignored |
| `com.fasterxml.jackson.annotation.JsonAnyGetter` | The corresponding object have `x-kubernetes-preserve-unknown-fields: true` defined |
| `com.fasterxml.jackson.annotation.JsonAnySetter` | The corresponding object have `x-kubernetes-preserve-unknown-fields: true` defined |
| `io.fabric8.generator.annotation.Min` | The field defines a validation `min` |
| `io.fabric8.generator.annotation.Max` | The field defines a validation `max` |
| `io.fabric8.generator.annotation.Pattern` | The field defines a validation `pattern` |
| `io.fabric8.generator.annotation.Nullable` | The field is marked as `nullable` |
| `io.fabric8.generator.annotation.Required` | The field is marked as `required` |
| `io.fabric8.crd.generator.annotation.SchemaFrom` | The field type for the generation is the one coming from the annotation |
| `io.fabric8.crd.generator.annotation.SchemaSwap` | Same as SchemaFrom, but can be applied at any point in the class hierarchy |
| Annotation | Description |
|--------------------------------------------------------------|---------------------------------------------------------------------------------------|
| `com.fasterxml.jackson.annotation.JsonProperty` | The field is named after the provided value instead of looking up the java field name |
| `com.fasterxml.jackson.annotation.JsonPropertyDescription` | The provided text is be embedded in the `description` of the field |
| `com.fasterxml.jackson.annotation.JsonIgnore` | The field is ignored |
| `io.fabric8.crd.generator.annotation.PreserveUnknownFields` | The field have `x-kubernetes-preserve-unknown-fields: true` defined |
| `com.fasterxml.jackson.annotation.JsonAnyGetter` | The corresponding object have `x-kubernetes-preserve-unknown-fields: true` defined |
| `com.fasterxml.jackson.annotation.JsonAnySetter` | The corresponding object have `x-kubernetes-preserve-unknown-fields: true` defined |
| `io.fabric8.generator.annotation.Min` | The field defines a validation `min` |
| `io.fabric8.generator.annotation.Max` | The field defines a validation `max` |
| `io.fabric8.generator.annotation.Pattern` | The field defines a validation `pattern` |
| `io.fabric8.generator.annotation.Nullable` | The field is marked as `nullable` |
| `io.fabric8.generator.annotation.Required` | The field is marked as `required` |
| `io.fabric8.crd.generator.annotation.SchemaFrom` | The field type for the generation is the one coming from the annotation |
| `io.fabric8.crd.generator.annotation.SchemaSwap` | Same as SchemaFrom, but can be applied at any point in the class hierarchy |

A field of type `com.fasterxml.jackson.databind.JsonNode` is encoded as an empty object with `x-kubernetes-preserve-unknown-fields: true` defined.

0 comments on commit 666a139

Please sign in to comment.