INNER CODE UNIT · Go
main
ovn-kubernetes/ovn-kubernetes · go-controller/pkg/crd/clusternetworkconnect/v1/openapi/cmd/models-schema/main.go:19
func main() {
err := output()
if err != nil {
fmt.Fprintf(os.Stderr, "Failed: %v", err) // nolint:errcheck
os.Exit(1)
}
}
func output() error {
refFunc := func(name string) spec.Ref {
return spec.MustCreateRef(fmt.Sprintf("#/definitions/%s", name))
}
defs := openapi.GetOpenAPIDefinitions(refFunc)
schemaDefs := make(map[string]spec.Schema, len(defs))
for k, v := range defs {
// Replace top-level schema with v2 if a v2 schema is embedded
// so that the output of this program is always in OpenAPI v2.
// This is done by looking up an extension that marks the embedded v2