Feat(idp): nested spec field support via path - #241
Merged
Conversation
idp.fields entries now support a field mapping a flat field name to a nested dot-notation path in the CRD spec. Callers submit flat fields; the gateway maps them to nested locations. Adds: - field - helper - validator (unique paths, format checks) - helper
NestedMap's loop returned the original object unchanged when keys was empty, trivially "succeeding" — inconsistent with its own doc comment and with its sibling NestedSlice, which falls through to (nil, false) for the same input by construction of its loop.
iAlexeze
force-pushed
the
feat/idp-nested-fields
branch
from
August 5, 2026 02:46
46298e4 to
d015fe9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
idp.fieldsentries now support apathfield mapping a flat field name to a nested dot-notation path in the CRDspec. Callers submit flat fields; the gateway maps them to nested locations.Previously,
idp.fieldsonly supported top-level spec paths:Now, nested paths are supported:
Callers stay flat — they submit
"cpu": "500m". The gateway handles the nesting.Implementation
IDPFieldConfig.Pathfieldconfig.SpecPath(name)— returnspathif set, otherwisenameconfig.HasSpecPath()— returns true ifpathis setutils.SetNestedPath()— sets a value at a dot-notation path, creates intermediate maps as neededutils.IsNestedPath()— returns true if a path contains a dotrouteFields()to handle nested paths viaSetNestedPathvalidateIDPFieldPaths()validator:k8s.io/apimachinery/pkg/util/validation.IsQualifiedNameExample
Katalog
Caller Request
{ "target": "smartapp", "repository": "myorg/payments-api", "cpu": "500m" }Generated CR
Backward Compatibility
path) continue to work unchangedpathis optional — when omitted, the field name is used as the spec pathTesting
go test ./...cleanpathpathapp.resources.cpu,networking.tls.enabled)ork validatecatches duplicate pathsork validatecatches invalid path format