config

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: MIT Imports: 6 Imported by: 3

README

sdk-gen-config

Documentation

Index

Constants

View Source
const Version = "1.0.0"

Variables

View Source
var ErrFailedUpgrade = errors.New("failed to upgrade config")
View Source
var ErrNotFound = errors.New("could not find gen.yaml")

Functions

func Save added in v0.0.3

func Save(dir string, cfg *Config, opts ...Option) error

Types

type Comments

type Comments struct {
	Disabled                        bool `yaml:"disabled,omitempty"`
	OmitDescriptionIfSummaryPresent bool `yaml:"omitDescriptionIfSummaryPresent,omitempty"`
}

type Config

type Config struct {
	ConfigVersion string                    `yaml:"configVersion"`
	Management    *Management               `yaml:"management,omitempty"`
	Generation    Generation                `yaml:"generation"`
	Languages     map[string]LanguageConfig `yaml:",inline"`
}

func GetDefaultConfig

func GetDefaultConfig(getLangDefaultFunc GetLanguageDefaultFunc, langs ...string) (*Config, error)

func Load

func Load(dir string, opts ...Option) (*Config, error)

type Generation

type Generation struct {
	BaseServerURL          string    `yaml:"baseServerUrl,omitempty"`
	Comments               *Comments `yaml:"comments,omitempty"`
	TelemetryEnabled       bool      `yaml:"telemetryEnabled"`
	SDKClassName           string    `yaml:"sdkClassName"`
	TagNamespacingDisabled bool      `yaml:"tagNamespacingDisabled,omitempty"`
	SDKFlattening          bool      `yaml:"sdkFlattening"`
}

type GetLanguageDefaultFunc

type GetLanguageDefaultFunc func(string) (*LanguageConfig, error)

type LanguageConfig

type LanguageConfig struct {
	Version string         `yaml:"version"`
	Cfg     map[string]any `yaml:",inline"`
}

type Management

type Management struct {
	DocChecksum      string `yaml:"docChecksum"`
	DocVersion       string `yaml:"docVersion"`
	SpeakeasyVersion string `yaml:"speakeasyVersion"`
}

type Option

type Option func(*options)

func WithFileSystemFuncs

func WithFileSystemFuncs(rf ReadFileFunc, wf WriteFileFunc) Option

func WithLanguageDefaultFunc

func WithLanguageDefaultFunc(f GetLanguageDefaultFunc) Option

func WithLanguages added in v0.0.4

func WithLanguages(langs ...string) Option

func WithUpgradeFunc added in v0.0.2

func WithUpgradeFunc(f UpgradeFunc) Option

type ReadFileFunc

type ReadFileFunc func(filename string) ([]byte, error)

type UpgradeFunc

type UpgradeFunc func(lang, oldVersion, newVersion string, cfg map[string]any) (map[string]any, error)

type WriteFileFunc

type WriteFileFunc func(filename string, data []byte, perm os.FileMode) error

Jump to

Keyboard shortcuts

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