generate

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Aliases map[string][]string = map[string][]string{
	"OscalCompleteSchema": {"OscalModels"},
}
View Source
var ComplexTypes map[string]string = map[string]string{
	"array": "[]",
}
View Source
var GoPrimitive map[string]bool = map[string]bool{
	"string":  true,
	"bool":    true,
	"float64": true,
	"int":     true,
}
View Source
var Imports []string = []string{"time"}
View Source
var KeysToIgnore map[string]bool = map[string]bool{
	"$schema": true,
}
View Source
var PrimitiveAndCustomTypes map[string]string = map[string]string{
	"string":    "string",
	"boolean":   "bool",
	"number":    "float64",
	"integer":   "int",
	"date-time": "time.Time",
}
View Source
var RefsToIgnore map[string]bool = map[string]bool{
	"#json-schema-directive": true,
}

Functions

func FmtFieldName

func FmtFieldName(s string) string
FmtFieldName formats a string as a struct key

Example:

FmtFieldName("foo_id")

Output: FooID

func Generate

func Generate(oscalSchema []byte, pkgName string, tags []string) (typeBytes []byte, err error)

Generate a struct definition given a JSON string representation of an object.

Types

type BaseFlags

type BaseFlags struct {
	InputFile  string // -f / --input-file
	OutputFile string // -o / --output-file
	Pkg        string // -p / --pkg
	Tags       string // -t / --tags
}

BaseFlags represents command-line flags for the base go-oscal command.

type GeneratorConfig

type GeneratorConfig struct {
	// contains filtered or unexported fields
}

func NewGeneratorConfig

func NewGeneratorConfig(tags []string, pkgName string) GeneratorConfig

type RefQueue

type RefQueue struct {
	// contains filtered or unexported fields
}

func NewRefQueue

func NewRefQueue() RefQueue

func (*RefQueue) Add

func (r *RefQueue) Add(ref string)

func (*RefQueue) History

func (r *RefQueue) History() []string

func (*RefQueue) Len

func (r *RefQueue) Len() int

func (*RefQueue) Pop

func (r *RefQueue) Pop() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL