{"modulePath":"github.com/primelib/primecodegen","version":"v0.2.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package openapidocument\n\n## Functions\n\n```go\nfunc AllSchemasMatch(schemas []*base.SchemaProxy, f SchemaMatchFunc) bool\n```\nAllSchemasMatch returns true if the given function returns true for all input schemas\n\n```go\nfunc CollectOperations(doc *libopenapi.DocumentModel[v3.Document]) []*v3.Operation\n```\n\n```go\nfunc CollectSchemaProxies(doc *libopenapi.DocumentModel[v3.Document]) map[string]*base.SchemaProxy\n```\nCollectSchemaProxies collects all schema proxies from the OpenAPI document.\n\n```go\nfunc CollectSchemas(doc *libopenapi.DocumentModel[v3.Document]) map[string]*base.Schema\n```\nCollectSchemas collects all schemas from the OpenAPI document (doesn't follow recursion, flatten should be used first).\n\n```go\nfunc Compare(aProxy *base.SchemaProxy, bProxy *base.SchemaProxy) bool\n```\n\n```go\nfunc CompareWithVisited(aProxy, bProxy *base.SchemaProxy, visited map[schemaPair]bool) bool\n```\nCompareWithVisited compares schemas and avoids infinite loops\n\n```go\nfunc ConvertDocument(bytes []byte, format string) ([]byte, error)\n```\nConvertDocument converts an OpenAPI document byte array to the specified format (yaml or json)\n\n```go\nfunc EmptyDocument() libopenapi.DocumentModel[v3.Document]\n```\n\n```go\nfunc EnumToAllowedValues(s *base.Schema) (map[string]AllowedValue, error)\n```\nEnumToAllowedValues converts an enum schema to a list of allowed values\n\n```go\nfunc FetchSpec(format SourceType, url string) ([]byte, error)\n```\nFetchSpec will download the spec from the source\n\n```go\nfunc HashSchema(schema *base.SchemaProxy) string\n```\n\n```go\nfunc IsEmptySchema(schema *base.Schema) bool\n```\n\n```go\nfunc IsEnumSchema(s *base.Schema) bool\n```\nIsEnumSchema returns true if the schema is an enum schema\n\n```go\nfunc IsMutable(schema *base.Schema) (bool, error)\n```\n\n```go\nfunc IsPolymorphicSchema(s *base.Schema) bool\n```\nIsPolymorphicSchema returns true if the schema is a polymorphic schema (allOf, oneOf, anyOf)\n\n```go\nfunc MergeSchema(result *base.Schema, override *base.Schema) (*base.Schema, error)\n```\nMergeSchema merges the properties of the overwrite schema into the base schema (useful to process anyOf, oneOf, allOf)\n\n```go\nfunc MergeSchemaProxy(baseSP *base.SchemaProxy, overwriteSP *base.SchemaProxy) (*base.Schema, error)\n```\n\n```go\nfunc MergeSchemaProxySchema(baseSP *base.SchemaProxy, override *base.Schema) (*base.Schema, error)\n```\n\n```go\nfunc OpenDocument(input []byte) (libopenapi.Document, error)\n```\n\n```go\nfunc OpenDocumentFile(file string) (libopenapi.Document, error)\n```\n\n```go\nfunc OpenDocumentWithBaseDir(input []byte, baseDir string) (libopenapi.Document, error)\n```\n\n```go\nfunc OpenV3DocumentForTest(bytes []byte) *libopenapi.DocumentModel[v3.Document]\n```\nOpenV3DocumentForTest opens a document and builds a v3 model, asserting no errors (panics on error, for usage in tests only!)\n\n```go\nfunc RenderDocument(doc libopenapi.Document) ([]byte, error)\n```\nRenderDocument renders the document as bytes\n\n```go\nfunc RenderDocumentFile(doc libopenapi.Document, file string) error\n```\nRenderDocumentFile writes the document into a file\n\n```go\nfunc RenderV3ModelFormat(doc *libopenapi.DocumentModel[v3.Document], format string) ([]byte, error)\n```\n\n```go\nfunc SimplifyPolymorphism(schemaName string, schemaProxy *base.SchemaProxy, schemas *orderedmap.Map[string, *base.SchemaProxy], schemataMap map[string]string) (*base.SchemaProxy, error)\n```\n\n```go\nfunc SpecTitle(doc *libopenapi.DocumentModel[v3.Document], defaultTitle string) string\n```\n\n```go\nfunc VisitAllSchemas(\n\tdoc *libopenapi.DocumentModel[v3.Document],\n\tvisitor func(name string, schema *base.SchemaProxy) *base.SchemaProxy,\n)\n```\n\n## Types\n\n```go\ntype AllowedValue struct {\n\tValue       string `yaml:\"value\"`\n\tDescription string `yaml:\"description,omitempty\"`\n\tName        string `yaml:\"name,omitempty\"`\n}\n```\n\n```go\ntype SchemaMatchFunc func(schema *base.Schema) bool\n```\n\n```go\ntype SourceType string\n```\n\n```go\nconst (\n\tSourceTypeSpec      SourceType = \"spec\"\n\tSourceTypeSwaggerUI SourceType = \"swagger-ui\"\n\tSourceTypeRedoc     SourceType = \"redoc\"\n)\n```\n\n```go\ntype SpecType string\n```\n\n```go\nconst (\n\tSpecTypeOpenAPI3 SpecType = \"openapi3\"\n\tSpecTypeSwagger2 SpecType = \"swagger2\"\n)\n```\n\n```go\ntype WalkDocumentResult struct {\n\tSchemas []*base.Schema\n}\n```\n\n```go\nfunc WalkDocument(doc *libopenapi.DocumentModel[v3.Document]) WalkDocumentResult\n```\n\n","path":"github.com/primelib/primecodegen/pkg/openapi/openapidocument","name":"openapidocument","synopsis":"","isRedistributable":true}
