Preserve defaulted prompt input inspection metadata

This commit is contained in:
2026-11-21 17:52:56 +00:00
parent 63e2968038
commit 79e23ecdba
4 changed files with 101 additions and 4 deletions

View File

@@ -176,6 +176,9 @@ func Capture(input *settings.Settings, view configkit.Inspection, diagnostics []
for i := range entry.Inputs {
path := resources.bases.prompts.Index(index).Key("inputs").Index(i)
presence[i] = promptInputPresence{required: finalFieldState(metadata, path.Key("required")), contentType: finalFieldState(metadata, path.Key("content_type")), description: finalFieldState(metadata, path.Key("description"))}
if entry.Inputs[i].Required {
presence[i].required = fieldValue
}
}
state.promptMetadata[indexedResourceID(resources.namespace, entry.ID)] = presence
}

View File

@@ -171,12 +171,11 @@ func (state *loaded) capturePromptInputs(id string, rawInputs []promptInputConfi
inputs = append(inputs, domain.PromptInput{
Name: input.Name, Required: input.Required, ContentType: contentType, Description: description,
})
presence := state.promptMetadata[id][index]
item := prompt.InputMetadata{Name: input.Name, Required: input.Required}
if presence.contentType == fieldValue {
if input.ContentType != nil {
item.ContentType = stringPointer(contentType)
}
if presence.description == fieldValue {
if input.Description != nil {
item.Description = stringPointer(description)
}
metadata = append(metadata, item)