Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type A

type A struct {
	XMLName xml.Name `xml:"a"`
	Href    *Href    `xml:"href,attr"`

	CharData      string `xml:",chardata"`
	ProcessedLink string `xml:"-"`
}

func (*A) UnmarshalXML

func (a *A) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type AsType

type AsType string
const (
	AsTypeBoolean            AsType = "boolean"
	AsTypeEmpty              AsType = "empty"
	AsTypeString             AsType = "string"
	AsTypeMixed              AsType = "mixed"
	AsTypeMarkupLine         AsType = "markup-line"
	AsTypeMarkupMultiLine    AsType = "markup-multiline"
	AsTypeDate               AsType = "date"
	AsTypeDateTimeTZ         AsType = "dateTime-with-timezone"
	AsTypeNCName             AsType = "NCName"
	AsTypeEmail              AsType = "email"
	AsTypeURI                AsType = "uri"
	AsTypeBase64             AsType = "base64Binary"
	AsTypeIDRef              AsType = "IDREF"
	AsTypeNMToken            AsType = "NMTOKEN"
	AsTypeID                 AsType = "ID"
	AsTypeAnyURI             AsType = "anyURI"
	AsTypeURIRef             AsType = "uri-reference"
	AsTypeUUID               AsType = "uuid"
	AsTypeNonNegativeInteger AsType = "nonNegativeInteger"
)

type Assembly

type Assembly struct {
	Description string   `xml:"description"`
	Remarks     *Remarks `xml:"remarks"`
	Ref         string   `xml:"ref,attr"`
	GroupAs     *GroupAs `xml:"group-as"`
	Def         *DefineAssembly
	Metaschema  *Metaschema
}

func (*Assembly) GoComment

func (a *Assembly) GoComment() string

func (*Assembly) GoMemLayout

func (a *Assembly) GoMemLayout() string

func (*Assembly) GoName

func (a *Assembly) GoName() string

func (*Assembly) GoPackageName

func (a *Assembly) GoPackageName() string

func (*Assembly) GoTypeName

func (a *Assembly) GoTypeName() string

func (*Assembly) GoTypeNameMultiplexed

func (a *Assembly) GoTypeNameMultiplexed() string

func (*Assembly) IndexBy

func (a *Assembly) IndexBy() string

func (*Assembly) JsonAnnotation

func (a *Assembly) JsonAnnotation() string

func (*Assembly) JsonName

func (a *Assembly) JsonName() string

func (*Assembly) UnmarshalXML

func (a *Assembly) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

func (*Assembly) XmlAnnotation

func (a *Assembly) XmlAnnotation() string

func (*Assembly) XmlGroupping

func (a *Assembly) XmlGroupping() string

func (*Assembly) XmlName

func (a *Assembly) XmlName() string

type Choice

type Choice struct {
	Field    []Field    `xml:"field"`
	Assembly []Assembly `xml:"assembly"`
}

type DefineAssembly

type DefineAssembly struct {
	Name    string `xml:"name,attr"`
	Address string `xml:"address,attr"`

	JsonKey     *JsonKey  `xml:"json-key"`
	Flags       []Flag    `xml:"flag"`
	FormalName  string    `xml:"formal-name"`
	Description string    `xml:"description"`
	Remarks     *Remarks  `xml:"remarks"`
	Model       *Model    `xml:"model"`
	Examples    []Example `xml:"example"`
	Metaschema  *Metaschema
}

DefineAssembly is a definition for for an object or element that contains structured content

func (*DefineAssembly) GetMetaschema

func (a *DefineAssembly) GetMetaschema() *Metaschema

func (*DefineAssembly) GoComment

func (a *DefineAssembly) GoComment() string

func (*DefineAssembly) GoTypeName

func (da *DefineAssembly) GoTypeName() string

func (*DefineAssembly) RepresentsRootElement

func (da *DefineAssembly) RepresentsRootElement() bool

type DefineField

type DefineField struct {
	Name string `xml:"name,attr"`

	Flags        []Flag    `xml:"flag"`
	FormalName   string    `xml:"formal-name"`
	Description  string    `xml:"description"`
	Remarks      *Remarks  `xml:"remarks"`
	Examples     []Example `xml:"example"`
	AsType       AsType    `xml:"as-type,attr"`
	JsonKey      *JsonKey  `xml:"json-key"`
	JsonValueKey string    `xml:"json-value-key"`
	Metaschema   *Metaschema
}

func (*DefineField) Empty

func (df *DefineField) Empty() bool

func (*DefineField) GetMetaschema

func (df *DefineField) GetMetaschema() *Metaschema

func (*DefineField) GoComment

func (f *DefineField) GoComment() string

func (*DefineField) GoName

func (df *DefineField) GoName() string

func (*DefineField) GoTypeName

func (df *DefineField) GoTypeName() string

func (*DefineField) IsMarkup

func (df *DefineField) IsMarkup() bool

func (*DefineField) JsonAnnotation

func (df *DefineField) JsonAnnotation() string

func (*DefineField) JsonName

func (df *DefineField) JsonName() string

type DefineFlag

type DefineFlag struct {
	Name   string `xml:"name,attr"`
	AsType AsType `xml:"as-type,attr"`

	FormalName  string    `xml:"formal-name"`
	Description string    `xml:"description"`
	Remarks     *Remarks  `xml:"remarks"`
	Examples    []Example `xml:"example"`
	Metaschema  *Metaschema
}

func (*DefineFlag) GetMetaschema

func (df *DefineFlag) GetMetaschema() *Metaschema

func (*DefineFlag) GoTypeName

func (df *DefineFlag) GoTypeName() string

type Example

type Example struct {
	Href *Href  `xml:"href,attr"`
	Path string `xml:"path,attr"`

	Description string   `xml:"description"`
	Remarks     *Remarks `xml:"remarks"`

	InnerXML string `xml:",innerxml"`
}

type Field

type Field struct {
	Required string `xml:"required,attr"`

	Description string   `xml:"description"`
	Remarks     *Remarks `xml:"remarks"`
	Ref         string   `xml:"ref,attr"`
	GroupAs     *GroupAs `xml:"group-as"`
	InXml       string   `xml:"in-xml,attr"`
	Def         *DefineField
	Metaschema  *Metaschema
}

func (*Field) GoComment

func (f *Field) GoComment() string

func (*Field) GoMemLayout

func (f *Field) GoMemLayout() string

func (*Field) GoName

func (f *Field) GoName() string

func (*Field) GoPackageName

func (f *Field) GoPackageName() string

func (*Field) GoTypeName

func (f *Field) GoTypeName() string

func (*Field) GoTypeNameMultiplexed

func (f *Field) GoTypeNameMultiplexed() string

func (*Field) IndexBy

func (f *Field) IndexBy() string

func (*Field) JsonAnnotation

func (f *Field) JsonAnnotation() string

func (*Field) JsonName

func (f *Field) JsonName() string

func (*Field) UnmarshalXML

func (f *Field) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

func (*Field) XmlAnnotation

func (f *Field) XmlAnnotation() string

func (*Field) XmlName

func (f *Field) XmlName() string

type Flag

type Flag struct {
	Name     string `xml:"name,attr"`
	AsType   AsType `xml:"as-type,attr"`
	Required string `xml:"required,attr"`

	Description string   `xml:"description"`
	Remarks     *Remarks `xml:"remarks"`
	Values      []Value  `xml:"value"`
	Ref         string   `xml:"ref,attr"`
	Def         *DefineFlag
	Metaschema  *Metaschema
}

func (*Flag) GoComment

func (f *Flag) GoComment() string

func (*Flag) GoDatatype

func (f *Flag) GoDatatype() (string, error)

func (*Flag) GoName

func (f *Flag) GoName() string

func (*Flag) GoTypeName

func (f *Flag) GoTypeName() string

func (*Flag) JsonAnnotation

func (f *Flag) JsonAnnotation() string

func (*Flag) JsonName

func (f *Flag) JsonName() string

func (*Flag) XmlName

func (f *Flag) XmlName() string

type GoStructItem

type GoStructItem interface {
	GoComment() string
	GoMemLayout() string
	GoName() string
	GoTypeNameMultiplexed() string
	JsonName() string
	XmlAnnotation() string
	// contains filtered or unexported methods

}

type GoType

type GoType interface {
	GoTypeName() string
	GetMetaschema() *Metaschema
}

type GroupAs

type GroupAs struct {
	Name   string `xml:"name,attr"`
	InJson string `xml:"in-json,attr"`
	InXml  string `xml:"in-xml,attr"`
}

func (*GroupAs) ByKey

func (ga *GroupAs) ByKey() bool

func (*GroupAs) SingletonOrArray

func (ga *GroupAs) SingletonOrArray() bool

type Href

type Href struct {
	URL *url.URL
}

func (*Href) UnmarshalXMLAttr

func (h *Href) UnmarshalXMLAttr(attr xml.Attr) error

type Import

type Import struct {
	Href *Href `xml:"href,attr"`
}

type JsonKey

type JsonKey struct {
	FlagName string `xml:"flag-name,attr"`
}

type Metaschema

type Metaschema struct {
	XMLName xml.Name `xml:"http://csrc.nist.gov/ns/oscal/metaschema/1.0 METASCHEMA"`
	Top     string   `xml:"top,attr"`
	Root    string   `xml:"root,attr"`

	// SchemaName describes the scope of application of the data format. For
	// example "OSCAL Catalog"
	SchemaName *SchemaName `xml:"schema-name"`

	// ShortName is a coded version of the schema name for use when a string-safe
	// identifier is needed. For example "oscal-catalog"
	ShortName *ShortName `xml:"short-name"`

	// Remarks are paragraphs describing the metaschema
	Remarks *Remarks `xml:"remarks,omitempty"`

	// Import is a URI to an external metaschema
	Import []Import `xml:"import"`

	// DefineAssembly is one or more assembly definitions
	DefineAssembly []DefineAssembly `xml:"define-assembly"`

	// DefineField is one or more field definitions
	DefineField []DefineField `xml:"define-field"`

	// DefineFlag is one or more flag definitions
	DefineFlag []DefineFlag `xml:"define-flag"`

	ImportedMetaschema []Metaschema
	Dependencies       map[string]GoType
	Multiplexers       []Multiplexer
	GoMod              string
}

Metaschema is the root metaschema element

func (*Metaschema) Compile

func (metaschema *Metaschema) Compile() error

func (*Metaschema) ContainsRootElement

func (Metaschema *Metaschema) ContainsRootElement() bool

func (*Metaschema) GetDefineAssembly

func (metaschema *Metaschema) GetDefineAssembly(name string) (*DefineAssembly, error)

func (*Metaschema) GetDefineField

func (metaschema *Metaschema) GetDefineField(name string) (*DefineField, error)

func (*Metaschema) GetDefineFlag

func (metaschema *Metaschema) GetDefineFlag(name string) (*DefineFlag, error)

func (*Metaschema) GoPackageName

func (metaschema *Metaschema) GoPackageName() string

func (*Metaschema) ImportedDependencies

func (metaschema *Metaschema) ImportedDependencies() []*Metaschema

type Model

type Model struct {
	Assembly []Assembly `xml:"assembly"`
	Field    []Field    `xml:"field"`
	Choice   []Choice   `xml:"choice"`
	Prose    *struct{}  `xml:"prose"`
	// contains filtered or unexported fields

}

func (*Model) GoStructItems

func (m *Model) GoStructItems() []GoStructItem

func (*Model) RegisterChild

func (m *Model) RegisterChild(child GoStructItem)

func (*Model) UnmarshalXML

func (m *Model) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type MultiplexedModel

type MultiplexedModel interface {
	GoTypeName() string

	IndexBy() string // contains filtered or unexported methods

}

type Multiplexer

type Multiplexer struct {
	MultiplexedModel MultiplexedModel
	Metaschema       *Metaschema
}

Multiplexer represents model to be generated in go code that does not exists in the metaschema. Such model is only needed for serialization&deserialization as json and xml schemas differ materially in their structure.

func (*Multiplexer) GetMetaschema

func (mplex *Multiplexer) GetMetaschema() *Metaschema

func (*Multiplexer) GoTypeName

func (mplex *Multiplexer) GoTypeName() string

func (*Multiplexer) GoTypeNameOriginal

func (mplex *Multiplexer) GoTypeNameOriginal() string

func (*Multiplexer) InJsonMap

func (mplex *Multiplexer) InJsonMap() bool

func (*Multiplexer) JsonKey

func (mplex *Multiplexer) JsonKey() string

type P

type P struct {
	A      []A      `xml:"a"`
	Code   []string `xml:"code"`
	Q      []string `xml:"q"`
	EM     []string `xml:"em"`
	Strong []string `xml:"strong"`

	CharData string `xml:",chardata"`
}

type Remarks

type Remarks struct {
	P []P `xml:"p"`

	InnerXML string `xml:",innerxml"`
}

Remarks are descriptions for a particular metaschema, assembly, field, flag or example

type SchemaName

type SchemaName struct {
	Code []string `xml:"code"`
	Q    []string `xml:"q"`

	InnerXML string `xml:",innerxml"`
}

type ShortName

type ShortName struct {
	Code []string `xml:"code"`
	Q    []string `xml:"q"`

	InnerXML string `xml:",innerxml"`
}

type Title

type Title struct {
	Code []string `xml:"code"`
	Q    []string `xml:"q"`

	InnerXML string `xml:",innerxml"`
}

type Value

type Value struct {
	InnerXML string `xml:",innerxml"`
}