Documentation
¶
Overview ¶
Package goschema reads a Go library's source to learn the output schema of each registered resource, data source, and action. The dev CLI feeds the result into the reference checker so trailing field names in references like `resource.app.id` can be validated at compile time.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Read ¶
func Read(dir string, extra ...ModuleRoot) (*runtime.LibrarySchema, []string, error)
Read parses the Go library rooted at dir and returns its schema plus any warnings: registered types whose sibling Output struct could not be located, and constraints whose pieces could not be extracted from source. Returns an error when no `Library()` function is found in dir's root package, or when the directory cannot be read. extra lists further module roots the walker may read source from when a referenced type lives outside the library's own module.
Types ¶
type ModuleRoot ¶ added in v0.7.0
ModuleRoot names a module's source on disk: Path is the module's import path and Dir is the directory holding its source. The walker resolves a selector into any root whose Path contains the selector's import path.