Skip to content

Array field comparison behavior differs based on schema-default filling #2188

Description

@VarunAthreya

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions