Help us shape the future of Go! Take the 2026 Go Developer Survey

jsonprovider

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package jsonprovider contains types and functions to marshal OpenTofu provider schemas into a json formatted output.

Index

Constants

View Source
const FormatVersion = "1.0"

FormatVersion represents the version of the json format and will be incremented for any change to this format that requires changes to a consuming parser.

Variables

This section is empty.

Functions

func Marshal

func Marshal(s *tofu.Schemas) ([]byte, error)

func MarshalForRenderer

func MarshalForRenderer(s *tofu.Schemas) map[string]*Provider

MarshalForRenderer converts the provided internal representation of the schema into the public structured JSON versions.

This is a format that can be read by the structured plan renderer.

Types

type Attribute

type Attribute struct {
	AttributeType       json.RawMessage `json:"type,omitempty"`
	AttributeNestedType *NestedType     `json:"nested_type,omitempty"`
	Description         string          `json:"description,omitempty"`
	DescriptionKind     string          `json:"description_kind,omitempty"`
	Deprecated          bool            `json:"deprecated,omitempty"`
	DeprecationMessage  string          `json:"deprecation_message,omitempty"`
	Required            bool            `json:"required,omitempty"`
	Optional            bool            `json:"optional,omitempty"`
	Computed            bool            `json:"computed,omitempty"`
	Sensitive           bool            `json:"sensitive,omitempty"`
	WriteOnly           bool            `json:"write_only,omitempty"`
}

type Block

type Block struct {
	Attributes         map[string]*Attribute `json:"attributes,omitempty"`
	BlockTypes         map[string]*BlockType `json:"block_types,omitempty"`
	Description        string                `json:"description,omitempty"`
	DescriptionKind    string                `json:"description_kind,omitempty"`
	Deprecated         bool                  `json:"deprecated,omitempty"`
	DeprecationMessage string                `json:"deprecation_message,omitempty"`
}

type BlockType

type BlockType struct {
	NestingMode string `json:"nesting_mode,omitempty"`
	Block       *Block `json:"block,omitempty"`
	MinItems    uint64 `json:"min_items,omitempty"`
	MaxItems    uint64 `json:"max_items,omitempty"`
}

type Function

type Function struct {
	Description       string           `json:"description"`
	Summary           string           `json:"summary"`
	ReturnType        any              `json:"return_type"`
	Parameters        []*FunctionParam `json:"parameters,omitempty"`
	VariadicParameter *FunctionParam   `json:"variadic_parameter,omitempty"`
}

Function is the top-level object returned when exporting function schemas

type FunctionParam

type FunctionParam struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Type        any    `json:"type"`
	IsNullable  *bool  `json:"is_nullable,omitempty"`
}

FunctionParam is the object for wrapping the functions parameters and return types

type IdentityAttribute

type IdentityAttribute struct {
	IdentityType      json.RawMessage `json:"type,omitempty"`
	Description       string          `json:"description,omitempty"`
	RequiredForImport bool            `json:"required_for_import,omitempty"`
	OptionalForImport bool            `json:"optional_for_import,omitempty"`
}

type NestedType

type NestedType struct {
	Attributes  map[string]*Attribute `json:"attributes,omitempty"`
	NestingMode string                `json:"nesting_mode,omitempty"`
}

type Provider

type Provider struct {
	Provider                 *Schema                            `json:"provider,omitempty"`
	ResourceSchemas          map[string]*Schema                 `json:"resource_schemas,omitempty"`
	DataSourceSchemas        map[string]*Schema                 `json:"data_source_schemas,omitempty"`
	EphemeralResourceSchemas map[string]*Schema                 `json:"ephemeral_resource_schemas,omitempty"`
	Functions                map[string]*Function               `json:"functions,omitempty"`
	ResourceIdentitySchemas  map[string]*ResourceIdentitySchema `json:"resource_identity_schemas,omitempty"`
}

type Providers

type Providers struct {
	FormatVersion string               `json:"format_version"`
	Schemas       map[string]*Provider `json:"provider_schemas,omitempty"`
}

Providers is the top-level object returned when exporting provider schemas

type ResourceIdentitySchema

type ResourceIdentitySchema struct {
	Version    uint64                        `json:"version"`
	Attributes map[string]*IdentityAttribute `json:"attributes,omitempty"`
}

type Schema

type Schema struct {
	Version uint64 `json:"version"`
	Block   *Block `json:"block,omitempty"`
}

Jump to

Keyboard shortcuts

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