typespecgo

package
v0.0.0-...-615c734 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Go

func Go(dir string, args ...string) error

func GoFmt

func GoFmt(dir string, args ...string) error

func GoFumpt

func GoFumpt(dir string, args ...string) error

func SearchTSP

func SearchTSP(dir string) ([]string, error)

有tspconfig.yaml并且有readme.go.md的目录

func TSP

func TSP(dir string, args ...string) (string, error)

Types

type GoEmitterOptions

type GoEmitterOptions struct {
	AzcoreVersion         string `yaml:"azcore-version"`
	DisallowUnknownFields bool   `yaml:"disallow-unknown-fields"`
	FilePrefix            string `yaml:"file-prefix"`
	GenerateFake          bool   `yaml:"generate-fakes"`
	InjectSpanc           bool   `yaml:"inject-spans"`
	Module                string `yaml:"module"`
	ModuleVersion         string `yaml:"module-version"`
	RawJsonAsBytes        bool   `yaml:"rawjson-as-bytes"`
	SliceElementsByVal    bool   `yaml:"slice-elements-byval"`
	SingleClient          bool   `yaml:"single-client"`
}

https://github.com/Azure/autorest.go/blob/main/packages/typespec-go/src/lib.ts#GoEmitterOptions

@azure-tools/typespec-go option

type LinterConfig

type LinterConfig struct {
	Extends []RuleRef          `yaml:"extends,omitempty"`
	Enable  map[RuleRef]bool   `yaml:"enable,omitempty"`
	Disable map[RuleRef]string `yaml:"disable,omitempty"`
}

<library name>:<rule/ruleset name>

type RuleRef

type RuleRef string

func (RuleRef) Validate

func (r RuleRef) Validate() bool

type TSPConfig

type TSPConfig struct {
	Path string

	TypeSpecProjectSchema
}

func NewTSPConfig

func NewTSPConfig(tspconfigYaml string) (*TSPConfig, error)

func (*TSPConfig) EditEmit

func (tc *TSPConfig) EditEmit(emits []string)

func (*TSPConfig) EditOptions

func (tc *TSPConfig) EditOptions(emit string, option any, append bool)

func (*TSPConfig) OnlyEmit

func (tc *TSPConfig) OnlyEmit(emit string)

func (*TSPConfig) Write

func (tc *TSPConfig) Write() error

type TypeSpecAzureTools

type TypeSpecAzureTools string
const (
	TypeSpec_GO       TypeSpecAzureTools = "@azure-tools/typespec-go"
	TypeSpec_AUTOREST TypeSpecAzureTools = "@azure-tools/typespec-autorest"
	TypeSpec_CSHARP   TypeSpecAzureTools = "@azure-tools/typespec-csharp"
	TypeSpec_PYTHON   TypeSpecAzureTools = "@azure-tools/typespec-python"
	TypeSpec_TS       TypeSpecAzureTools = "@azure-tools/typespec-ts"
)

type TypeSpecProjectSchema

type TypeSpecProjectSchema struct {
	Extends              string         `yaml:"extends,omitempty"`
	Parameters           map[string]any `yaml:"parameters,omitempty"`
	EnvironmentVariables map[string]any `yaml:"environment-variables,omitempty"`
	WarnAsError          bool           `yaml:"warn-as-error,omitempty"`
	OutPutDir            string         `yaml:"output-dir,omitempty"` // 不应该是bool
	Trace                []string       `yaml:"trace,omitempty"`
	Imports              string         `yaml:"imports,omitempty"`
	Emit                 []string       `yaml:"emit,omitempty"`
	Options              map[string]any `yaml:"options,omitempty"`
	Linter               LinterConfig   `yaml:"linter,omitempty"`
}

https://typespec.io/docs/handbook/configuration#schema

Jump to

Keyboard shortcuts

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