Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bundle/internal/schema/annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func assignAnnotation(s *jsonschema.Schema, a annotation.Descriptor) {
}

if a.OutputOnly != nil && *a.OutputOnly {
s.DoNotSuggest = true
s.FieldBehaviors = []string{"OUTPUT_ONLY"}
}

s.MarkdownDescription = convertLinksToAbsoluteUrl(a.MarkdownDescription)
Expand Down
38 changes: 38 additions & 0 deletions bundle/internal/schema/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,43 @@ func makeVolumeTypeOptional(typ reflect.Type, s jsonschema.Schema) jsonschema.Sc
return s
}

func removeOutputOnlyFields(typ reflect.Type, s jsonschema.Schema) jsonschema.Schema {
// Only process object types with properties
if s.Type != jsonschema.ObjectType || s.Properties == nil {
return s
}

// Collect property names to remove
var toRemove []string
for name, prop := range s.Properties {
// Check if this property is marked as output-only via FieldBehaviors
if prop.FieldBehaviors != nil {
for _, behavior := range prop.FieldBehaviors {
if behavior == "OUTPUT_ONLY" {
toRemove = append(toRemove, name)
break
}
}
}
}

// Remove output-only properties
for _, name := range toRemove {
delete(s.Properties, name)

// Also remove from required list if present
var newRequired []string
for _, r := range s.Required {
if r != name {
newRequired = append(newRequired, r)
}
}
s.Required = newRequired
}

return s
}

func main() {
if len(os.Args) != 3 {
fmt.Println("Usage: go run main.go <work-dir> <output-file>")
Expand Down Expand Up @@ -189,6 +226,7 @@ func generateSchema(workdir, outputFile string) {
removePipelineFields,
makeVolumeTypeOptional,
a.addAnnotations,
removeOutputOnlyFields,
addInterpolationPatterns,
})

Expand Down
Loading