Skip to content

Commit

Permalink
fix: ref
Browse files Browse the repository at this point in the history
  • Loading branch information
franklinkim committed Oct 8, 2024
1 parent 81f1ee3 commit 2523e80
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
11 changes: 10 additions & 1 deletion internal/config/unit.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

type Unit struct {
Chart Chart `json:"chart,omitempty" yaml:"chart,omitempty" jsonschema:"anyof_type=string;Chart"`
Chart Chart `json:"chart,omitempty" yaml:"chart,omitempty" jsonschema:"anyof_type=string,anyof_ref=#/$defs/Chart"`
Kustomize string `json:"kustomize,omitempty" yaml:"kustomize,omitempty"`
Tags Tags `json:"tags,omitempty" yaml:"tags,omitempty"`
Builds map[string]Build `json:"builds,omitempty" yaml:"builds,omitempty"`
Expand All @@ -25,6 +25,15 @@ type Unit struct {
// ~ Public methods
// ------------------------------------------------------------------------------------------------

// JSONSchemaProperty type workaround
func (Unit) JSONSchemaProperty(prop string) any {
var x any
if prop == "chart" {
return x
}
return nil
}

func (u *Unit) ValuesYAML(global, vars map[string]any) ([]byte, error) {
values := u.Values
if values == nil {
Expand Down
3 changes: 1 addition & 2 deletions squadron.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,12 @@
"Unit": {
"properties": {
"chart": {
"$ref": "#/$defs/Chart",
"anyOf": [
{
"type": "string"
},
{
"type": "Chart"
"$ref": "#/$defs/Chart"
}
]
},
Expand Down

0 comments on commit 2523e80

Please sign in to comment.