Skip to content

Commit b65f154

Browse files
winewaymanusa
authored andcommitted
add changelog & fixed copyright
Signed-off-by: wineway <[email protected]>
1 parent 7a2e29b commit b65f154

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* Fix #4383: bump snakeyaml from 1.30 to 1.31
1919

2020
#### New Features
21+
* Feat: add annotation @PreserveUnknownFields for generation field
2122

2223
#### _**Note**_: Breaking changes in the API
2324
* Fix #4350: SchemaSwap's fieldName parameter now expects a field name only, not a method or a constructor.

crd-generator/api/src/main/java/io/fabric8/crd/generator/annotation/PreserveUnknownFields.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (C) 2022 Red Hat, Inc.
2+
* Copyright (C) 2015 Red Hat, Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

doc/CRD-generator.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,28 @@ Corresponding `x-kubernetes-preserve-unknown-fields: true` will be generated in
359359
x-kubernetes-preserve-unknown-fields: true
360360
```
361361

362+
You can also annotation a field with @PreserveUnknownFields:
363+
364+
```java
365+
interface ExampleInterface {}
366+
367+
public class ExampleSpec {
368+
@PreserveUnknownFields
369+
ExampleInterface someValue;
370+
}
371+
```
372+
373+
will be generated as:
374+
375+
```yaml
376+
spec:
377+
properties:
378+
someValue:
379+
type: object
380+
x-kubernetes-preserve-unknown-fields: true
381+
type: object
382+
```
383+
362384
## Features cheatsheet
363385

364386
| Annotation | Description |

0 commit comments

Comments
 (0)