parser

package
v1.25.2 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExampleDef added in v1.23.48

type ExampleDef struct {
	Name    string
	Summary string
	Value   any
}

ExampleDef describes a request-body example attached to an OpenAPI operation.

type FieldDef

type FieldDef struct {
	APIName            string
	TerraformName      string
	GoName             string
	Type               string
	ElementType        string
	Description        string
	NestedModelName    string
	NestedAPIModelName string
	NestedAttrTypes    string
	Required           bool
	Optional           bool
	Computed           bool
	OptionalComputed   bool
	Sensitive          bool
	PreferState        bool
	SuppressDiff       bool
	ForceNew           bool
	Ignored            bool
	CustomType         string
	ElementCustomType  string
	ReadOnly           bool
	WriteOnly          bool
	PathParam          bool
	QueryParam         bool
	RequestField       bool
	UpdateField        bool
	ApplyStrategy      string
	PlanModifierHook   string
	UseStateForUnknown bool
	EmitEmpty          bool
	FixedValue         string
	Enum               []string
	Fields             []FieldDef
	ObjectAsJSON       bool
	NotNull            bool
	ValidJSON          bool
	PipelineFunctionID bool
}

FieldDef describes one Terraform model field.

type OneOfVariantDef

type OneOfVariantDef struct {
	APIName            string
	TerraformName      string
	GoName             string
	ModelName          string
	SchemaName         string
	DiscriminatorValue string
	Fields             []FieldDef
}

OneOfVariantDef describes one flattened oneOf variant model.

type OperationDef

type OperationDef struct {
	Method                   string
	Path                     string
	OperationID              string
	RequestSchema            string
	ResponseSchema           string
	PathParams               []FieldDef
	QueryParams              []FieldDef
	Examples                 []ExampleDef
	ReadAfterWrite           bool
	PreserveInputsAfterWrite bool
	ResetBody                any
	DeleteHook               string
}

OperationDef describes one annotated OpenAPI operation.

type OutputFile

type OutputFile struct {
	Path    string
	Kind    string
	Skipped bool
}

OutputFile describes a generated file decision.

type ResourceDef

type ResourceDef struct {
	Name           string
	FileStem       string
	TypeName       string
	StructName     string
	SchemaName     string
	Create         OperationDef
	Read           OperationDef
	Update         OperationDef
	Delete         OperationDef
	List           OperationDef
	ListName       string
	ListFileStem   string
	ListStructName string
	ListTypeName   string
	Fields         []FieldDef
	OneOfVariants  []OneOfVariantDef
	Outputs        []OutputFile
	Action         bool
	NoRead         bool
}

ResourceDef describes one Terraform resource discovered from OpenAPI annotations.

func Parse

func Parse(content []byte) ([]ResourceDef, error)

Parse reads an OpenAPI document and returns annotated Terraform resources.

func ParseFile

func ParseFile(filename string) ([]ResourceDef, error)

ParseFile reads an OpenAPI document and returns annotated Terraform resources.

Jump to

Keyboard shortcuts

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