proto2xsd

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert

func Convert(filename, xsdNamespace string, input io.Reader, output io.Writer) error

Convert reads a Proto definition from input and writes XSD Type definition and XSD Root elements to output.

Types

type XSDComplexType

type XSDComplexType struct {
	XMLName  xml.Name    `xml:"complexType"`
	Name     string      `xml:"name,attr"`
	Comment  string      `xml:",comment"`
	Sequence XSDSequence `xml:"sequence"`
}

XSDComplexType represents a complexType

func BuildXSDTypes

func BuildXSDTypes(def *proto.Proto) (list []XSDComplexType, err error)

BuildXSDTypes returns a list of XSD types from a Proto definition.

type XSDElement

type XSDElement struct {
	XMLName   xml.Name `xml:"element"`
	Name      string   `xml:"name,attr"`
	Comment   string   `xml:",comment"`
	Type      string   `xml:"type,attr"`
	MinOccurs string   `xml:"minOccurs,attr,omitempty"`
	MaxOccurs string   `xml:"maxOccurs,attr,omitempty"`
}

XSDElement represents an element as part of e.g. sequence

type XSDSchema

type XSDSchema struct {
	XMLName            xml.Name `xml:"schema"`
	StandardNamespace  string   `xml:"xmlns,attr"`
	TargetNamespace    string   `xml:"targetNamespace,attr"`
	TargetAlias        string   `xml:"xmlns:target,attr"`
	Version            string   `xml:"xmlns:version,attr"`
	ElementFormDefault string   `xml:"elementFormDefault,attr"`
	Types              []XSDComplexType
	Elements           []XSDElement
}

XSDSchema represents a schema

func BuildXSDSchema

func BuildXSDSchema(target string) XSDSchema

BuildXSDSchema returns an initial XSDSchema with defaults.

type XSDSequence

type XSDSequence struct {
	Elements []XSDElement `xml:"element"`
}

XSDSequence represents a sequence as part of e.g. complexType

Jump to

Keyboard shortcuts

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