{"modulePath":"github.com/devfile/api/generator","version":"v0.0.0-20261120161048-79dde530bbb6","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package genutils\n\n## Constants\n\n```go\nconst (\n\n\t// MergePatchStrategy is the name of the Merge patch strategy\n\tMergePatchStrategy = \"merge\"\n\t// ReplacePatchStrategy is the name of the Replace patch strategy\n\tReplacePatchStrategy = \"replace\"\n)\n```\n\n## Variables\n\n```go\nvar (\n\t// UnionMarker is the definition of the union marker, as defined in https://github.com/kubernetes/enhancements/blob/master/keps/sig-api-machinery/20190325-unions.md#proposal\n\tUnionMarker = markers.Must(markers.MakeDefinition(\"union\", markers.DescribesType, struct{}{}))\n\t// UnionDiscriminatorMarker is the definition of the union discriminator marker, as defined in https://github.com/kubernetes/enhancements/blob/master/keps/sig-api-machinery/20190325-unions.md#proposal\n\tUnionDiscriminatorMarker = markers.Must(markers.MakeDefinition(\"unionDiscriminator\", markers.DescribesField, struct{}{}))\n)\n```\n\n## Functions\n\n```go\nfunc AddUnionOneOfConstraints(jsonSchema *apiext.JSONSchemaProps, unionDiscriminators []markers.FieldInfo, removeDiscriminators bool, fieldsToSkip ...string)\n```\nAddUnionOneOfConstraints adds oneOf constraints in the given Json schema for all the unions, based on the authorized values of the union members\n\n```go\nfunc ContainsPatchStrategy(field *markers.FieldInfo, strategy string) bool\n```\nContainsPatchStrategy reads the field tags to check whether the given patch strategy is defined\n\n```go\nfunc EditJSONSchema(jsonSchema *apiext.JSONSchemaProps, visitor Visitor)\n```\nEditJSONSchema allows editing a Json Schema by applying the visitor function to each level of the schema.\n\n```go\nfunc GetPatchMergeKey(field *markers.FieldInfo) string\n```\nGetPatchMergeKey reads the field tags to retrieve the patch merge key. It returns nil if no such key is defined\n\n```go\nfunc LatestKubeLikeVersion(versions []string) string\n```\nLatestKubeLikeVersion retrieves the latest version from the the provided versions, according to \"kube-like\" versioning order. \"Kube-like\" versions start with a \"v\", then are followed by a number (the major version), then optionally the string \"alpha\" or \"beta\" and another number (the minor version). These are sorted first by GA \u003e beta \u003e alpha (where GA is a version with no suffix such as beta or alpha), and then by comparing major version, then minor version. An example sorted list of versions: v10, v2, v1, v11beta2, v10beta3, v3beta1, v12alpha1, v11alpha2, foo1, foo10.\n\n```go\nfunc RegisterUnionMarkers(into *markers.Registry) error\n```\nRegisterUnionMarkers registers the \\`union\\` and \\`unionDiscriminator\\` markers\n\n```go\nfunc SortKubeLikeVersion(versions []string)\n```\nSortKubeLikeVersion sorts the provided versions according to \"kube-like\" versioning order. \"Kube-like\" versions start with a \"v\", then are followed by a number (the major version), then optionally the string \"alpha\" or \"beta\" and another number (the minor version). These are sorted first by GA \u003e beta \u003e alpha (where GA is a version with no suffix such as beta or alpha), and then by comparing major version, then minor version. An example sorted list of versions: v10, v2, v1, v11beta2, v10beta3, v3beta1, v12alpha1, v11alpha2, foo1, foo10.\n\n```go\nfunc WriteFormattedSourceFile(filename string, ctx *genall.GenerationContext, root *loader.Package, writeContents func(*bytes.Buffer))\n```\nWriteFormattedSourceFile creates a Go source file in a given package, dumps to it the content provided by the \\`writeContents\\` function and formats the result through go/fmt. If formatting cannot be applied (due to some syntax error probably), it returns an error.\n\n## Types\n\n```go\ntype Visitor func(schema *apiext.JSONSchemaProps) (newVisitor Visitor, stop bool)\n```\nVisitor is the type of a function that visits one level of Json schema\n\n","path":"github.com/devfile/api/generator/genutils","name":"genutils","synopsis":"","isRedistributable":true}
