Skip to content

Commit 04b3075

Browse files
committed
More clarifications
1 parent 235dd66 commit 04b3075

File tree

1 file changed

+11
-5
lines changed
  • keps/sig-api-machinery/1929-built-in-default

1 file changed

+11
-5
lines changed

keps/sig-api-machinery/1929-built-in-default/README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,13 @@ Currently, null values trigger an error when nullable is false and don't
201201
get defaulted if a default is available. We propose to start defaulting
202202
fields with null values if a default is available, or the field will be
203203
removed if no default exists, but only when the openapi nullable flag is
204-
missing or false. We assume that existing APIs that use nullable are
205-
happy with null values. Also, people can remove the nullable attribute
206-
if they want null values to start being removed. This will help
207-
aligning CRDs and built-in types (there are no ways to set nullable to
208-
true for built-in types).
204+
missing or false. This means that will start accepting inputs that were
205+
rejected in the past (there is code that would work with a new server
206+
but not with an old server). We assume that existing APIs that use
207+
nullable are happy with null values. Also, people can remove the
208+
nullable attribute if they want null values to start being removed. This
209+
will help aligning CRDs and built-in types (there are no ways to set
210+
nullable to true for built-in types).
209211

210212
Note that we still consider `{}` (and 0, 0.0, "", false, []) to be
211213
different from `null`, so `{"foo": {}}` is different from `{}` or from
@@ -431,6 +433,10 @@ type Object struct {
431433
}
432434
```
433435

436+
Non-pointer fields that have a default must be omitEmpty. Kubebuilder
437+
and built-in defaulting generators should both prevent these from
438+
happening.
439+
434440
This would generate the following OpenAPI:
435441
```yaml
436442
Object:

0 commit comments

Comments
 (0)