Context
The diff logic has a subtle behavior difference depending on whether schema-default filling is enabled.
Behavior
When schema-default filling is enabled:
- Omitted array fields are filled with explicit
nil
- This compares equal to
[] that the gateway stores
- Diff reports no update needed
When schema-default filling is disabled:
- Omitted array fields remain absent from the config
- The distinction between absent and
[] is preserved
- Diff correctly reports an update is needed
Example
When kong.yaml is applied first and then kong-omitted.yaml is diffed, the behavior changes based on whether skip-filling defaults is enabled.
kong.yaml
_format_version: "3.0"
plugins:
- name: zipkin
enabled: true
instance_name: zipkin-empty-array
protocols:
- http
- https
config:
http_endpoint: http://localhost:9411/api/v2/spans
static_tags: []
kong-omitted.yaml
_format_version: "3.0"
plugins:
- name: zipkin
enabled: true
instance_name: zipkin-empty-array
protocols:
- http
- https
config:
http_endpoint: http://localhost:9411/api/v2/spans
Originally posted in #2184
Context
The diff logic has a subtle behavior difference depending on whether schema-default filling is enabled.
Behavior
When schema-default filling is enabled:
nil[]that the gateway storesWhen schema-default filling is disabled:
[]is preservedExample
When
kong.yamlis applied first and thenkong-omitted.yamlis diffed, the behavior changes based on whether skip-filling defaults is enabled.kong.yamlkong-omitted.yamlOriginally posted in #2184