opendpi

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package opendpi provides OpenDPI specification types.

Index

Constants

This section is empty.

Variables

View Source
var (
	// JSON parses OpenDPI specs from JSON.
	JSON = Parser{parseJSON}
	// YAML parses OpenDPI specs from YAML.
	YAML = Parser{parseYAML}
)
View Source
var (
	// JSONWriter writes OpenDPI specs as JSON.
	JSONWriter = Writer{writeJSON, ".json"}
	// YAMLWriter writes OpenDPI specs as YAML.
	YAMLWriter = Writer{writeYaml, ".yaml"}
)

Functions

func WriteEmptySchemaJSON added in v0.2.0

func WriteEmptySchemaJSON(dir, portName string) error

WriteEmptySchemaJSON writes an empty object schema as JSON.

func WriteEmptySchemaYAML added in v0.2.0

func WriteEmptySchemaYAML(dir, portName string) error

WriteEmptySchemaYAML writes an empty object schema as YAML.

func WriteSchemaFile added in v0.2.0

func WriteSchemaFile(dir, portName string, writeFunc func(string, any) error) error

WriteSchemaFile writes an empty object schema to the given path.

Types

type Connection

type Connection struct {
	Type        string
	Host        string
	Description string
	Variables   map[string]any
}

Connection represents an infrastructure endpoint where data resides.

type Info

type Info struct {
	Title       string
	Version     string
	Description string
}

Info contains metadata about the data product.

type Parser

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

Parser decodes an OpenDPI spec from an io.Reader.

func (Parser) Parse

func (p Parser) Parse(r io.Reader, fsys fs.FS) (*Spec, error)

Parse decodes an OpenDPI spec from r and resolves all $ref references. External file references are not supported; use ParseFS for that.

type Port

type Port struct {
	Description string
	Connections []PortConnection
	Schema      *jsonschema.Schema
	SchemaRef   string // original external $ref path (e.g. "schemas/user.yaml"), preserved for round-trip
}

Port represents a data output interface exposed by the data product.

type PortConnection

type PortConnection struct {
	Connection *Connection
	Location   string
}

PortConnection represents a connection-location pair for a port.

type Spec

type Spec struct {
	OpenDPI     string
	Info        Info
	Tags        []Tag
	Connections map[string]Connection
	Ports       map[string]Port
	Schemas     map[string]*jsonschema.Schema // all schemas unified, fully resolved
}

Spec represents the root structure of an OpenDPI specification file.

type Tag

type Tag struct {
	Name        string
	Description string
}

Tag is used for categorizing ports.

type Writer

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

Writer encodes an OpenDPI spec to a file.

func (Writer) Write

func (wr Writer) Write(spec *Spec, specDir string) error

Write encodes the spec to the given specDir as opendpi.<ext>.

Jump to

Keyboard shortcuts

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