Skip to content

Commit 620343e

Browse files
author
Salah Aldeen Al Saleh
authored
convert type BoolString to oneOf for api-schema (#193)
1 parent 994978c commit 620343e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cmd/schemagen/cli/root.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,12 @@ func generateSchemaFromCRD(crd []byte, outfile string) error {
119119
}
120120
}
121121

122-
err = ioutil.WriteFile(outfile, b, 0644)
122+
// whoa now
123+
// working around the fact that controller-gen doesn't have tags to generate oneOf schemas, so this is hacky.
124+
// going to work to add an issue there to support and if they accept, this terrible thing can go away
125+
boolStringed := strings.ReplaceAll(string(b), `"type": "BoolString"`, `"oneOf": [{"type": "string"},{"type": "boolean"}]`)
126+
127+
err = ioutil.WriteFile(outfile, []byte(boolStringed), 0644)
123128
if err != nil {
124129
return errors.Wrap(err, "failed to write file")
125130
}

0 commit comments

Comments
 (0)