Documentation
¶
Overview ¶
Package schema provides a simple way to register and lookup schemas.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Register ¶
func Register(base ID, objs ...interface{})
Register adds a new link between a schema ID and object to the global schema registry. This should be called for all GOBL models that will be included inside schema documents or included in an envelope document payload. The name of the object will be determined from the type of the object provided.
func RegisterIn ¶
func RegisterIn(base ID, objs ...interface{})
RegisterIn will determine the anchor and add it to the base schema before adding to the global registry.
func ToSnakeCase ¶
ToSnakeCase converts the provided string into snake case using dashes. This is useful for Schema IDs and definitions to be coherent with common JSON Schema examples.
Types ¶
type ID ¶
type ID string
ID contains the official schema URL.
const ( // UnknownID is provided when the schema has not been registered UnknownID ID = "" )
func Extract ¶ added in v0.26.1
Extract attempts to Unmarshal the provided JSON document in order to extract the payload's Schema ID.
func (ID) Add ¶
Add appends the provided path to the id, and removes any anchor data that might be there.