Skip to content

[feat] add openapi defaults handling for tests#106

Merged
ldmonster merged 1 commit into
mainfrom
feat/handle-openapi-defaults-in-tests
May 8, 2026
Merged

[feat] add openapi defaults handling for tests#106
ldmonster merged 1 commit into
mainfrom
feat/handle-openapi-defaults-in-tests

Conversation

@ldmonster
Copy link
Copy Markdown
Collaborator

@ldmonster ldmonster commented May 8, 2026

Adds OpenAPI schema support to the functional testing framework so hook tests start from the same values state addon-operator produces in production.

What's included:

  • LoadOpenAPISchema — reads an OpenAPI v3 YAML schema, resolves the x-extend parent chain (same semantics as addon-operator's ExtendTransformer)
  • SchemaDefaults — walks a loaded schema and extracts a values document with all default: values applied recursively (objects, arrays, nested sub-properties)
  • MergeValues — deep-merges two values maps with override-wins semantics (objects recursed, scalars/arrays replaced)
  • Three new Options for NewHookExecutionConfig:
    • WithOpenAPIDir(dir) — loads <dir>/values.yaml and <dir>/config-values.yaml if present, silently ignores absent files
    • WithValuesSchema(path) / WithConfigValuesSchema(path) — fail-fast targeted variants
  • Self-contained stub schemas in testing/framework/openapi_stub/ so framework tests don't depend on example-module files
  • Three new framework tests in examples/example-module/hooks/subfolder/openapi_framework_test.go covering defaults, user overrides, and composing with an existing hook handler

Signed-off-by: Pavel Okhlopkov <pavel.okhlopkov@flant.com>
@ldmonster ldmonster self-assigned this May 8, 2026
@ldmonster ldmonster added the enhancement New feature or request label May 8, 2026
@ldmonster ldmonster merged commit b1a3ad9 into main May 8, 2026
51 checks passed
@ldmonster ldmonster deleted the feat/handle-openapi-defaults-in-tests branch May 8, 2026 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant