ddexgen

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2025 License: MIT Imports: 8 Imported by: 0

README

pkg/ddexgen

DDEX code generation library for protobuf-generated Go files.

Purpose

This package provides programmatic access to DDEX-specific code generation. It's used by the ddex-gen and protoc-gen-ddex CLI tools, but can also be imported directly.

What It Generates

  1. enum_strings.go - String conversion methods for enums
  2. *.xml.go - XML marshaling/unmarshaling with namespace support
  3. registry.go - Dynamic message type registry

Usage

import "github.com/OpenAudio/ddex-proto/pkg/ddexgen"

func main() {
    // Generate DDEX extensions for all .pb.go files in ./gen
    err := ddexgen.Generate("./gen", true) // directory, verbose
    if err != nil {
        log.Fatal(err)
    }
}

Features

  • Automatic detection - Scans for .pb.go files and processes them
  • Enum string methods - Generates XMLString() and Parse*String() functions
  • XML marshaling - Adds proper namespace handling for DDEX compliance
  • Registry - Dynamic message type detection from XML

See Also

  • cmd/ddex-gen - CLI wrapper for this package
  • pkg/injecttag - XML tag injection (run this first)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(targetDir string, verbose bool) error

generateExtensions generates enum_strings.go, *.xml.go, and registry.go files

Types

type EnumInfo

type EnumInfo struct {
	Name      string
	Constants []string
}

type MessageInfo

type MessageInfo struct {
	Name string
}

type NamespaceInfo

type NamespaceInfo struct {
	Namespace       string
	NamespacePrefix string
	SchemaFile      string
	ImportsAVS      bool // true if this schema imports AVS namespace
}

NamespaceInfo holds namespace configuration for a package

type PackageInfo

type PackageInfo struct {
	Dir         string
	PackageName string
	ImportPath  string
	Messages    []MessageInfo
	Namespace   *NamespaceInfo
}

Jump to

Keyboard shortcuts

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