config

package module
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: MIT Imports: 8 Imported by: 3

README

sdk-gen-config

Documentation

Index

Constants

View Source
const (
	Version               = "1.0.0"
	GithubWritePermission = "write"

	BaseServerURL                   = "baseServerUrl"
	SDKClassName                    = "sdkClassName"
	SingleTagPerOp                  = "singleTagPerOp"
	TagNamespacingDisabled          = "tagNamespacingDisabled"
	Languages                       = "languages"
	Mode                            = "mode"
	GithubAccessToken               = "github_access_token"
	SpeakeasyApiKey                 = "speakeasy_api_key"
	OpenAPIDocAuthHeader            = "openapi_doc_auth_header"
	OpenAPIDocAuthToken             = "openapi_doc_auth_token"
	OpenAPIDocs                     = "openapi_docs"
	OmitDescriptionIfSummaryPresent = "omitDescriptionIfSummaryPresent"
	DisableComments                 = "disableComments"
)

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 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 Force added in v0.4.2

type Force struct {
	Description string `yaml:"description"`
	Type        string `yaml:"type"`
	Default     bool   `yaml:"default"`
}

type GenerateOn added in v0.4.2

type GenerateOn struct {
	WorkflowDispatch WorkflowDispatch `yaml:"workflow_dispatch"`
	Schedule         []Schedule       `yaml:"schedule,omitempty"`
}

type GenerateWorkflow added in v0.4.2

type GenerateWorkflow struct {
	Name        string            `yaml:"name"`
	Env         map[string]string `yaml:"env,omitempty"`
	Permissions Permissions       `yaml:"permissions"`
	On          GenerateOn        `yaml:"on"`
	Jobs        Jobs              `yaml:"jobs"`
}

type Generation

type Generation struct {
	CommentFields map[string]bool `yaml:"comments,omitempty"`
	Fields        map[string]any  `yaml:",inline"`
}

type GetLanguageDefaultFunc

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

type Inputs added in v0.4.2

type Inputs struct {
	Force Force `yaml:"force"`
}

type Job added in v0.4.2

type Job struct {
	Uses    string            `yaml:"uses"`
	With    map[string]any    `yaml:"with"`
	Secrets map[string]string `yaml:"secrets"`
}

type Jobs added in v0.4.2

type Jobs struct {
	Generate Job `yaml:"generate,omitempty"`
	Publish  Job `yaml:"publish,omitempty"`
}

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"`
	GenerationVersion string `yaml:"generationVersion,omitempty"`
}

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 Permissions added in v0.4.2

type Permissions struct {
	Checks       string `yaml:"checks"`
	Contents     string `yaml:"contents,omitempty"`
	PullRequests string `yaml:"pull-requests,omitempty"`
	Statuses     string `yaml:"statuses"`
}

type PublishOn added in v0.4.2

type PublishOn struct {
	Push Push `yaml:"push"`
}

type PublishWorkflow added in v0.4.2

type PublishWorkflow struct {
	Name string            `yaml:"name"`
	Env  map[string]string `yaml:"env,omitempty"`
	On   PublishOn         `yaml:"on"`
	Jobs Jobs              `yaml:"jobs"`
}

type Push added in v0.4.2

type Push struct {
	Branches []string `yaml:"branches"`
	Paths    []string `yaml:"paths"`
}

type ReadFileFunc

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

type Schedule added in v0.4.2

type Schedule struct {
	Cron string `yaml:"cron"`
}

type SdkGenConfig added in v0.3.1

type SdkGenConfig struct {
	SdkGenLanguageConfig map[string][]SdkGenConfigField `json:"language_configs"`
	SdkGenCommonConfig   []SdkGenConfigField            `json:"common_config"`
}

type SdkGenConfigField added in v0.3.2

type SdkGenConfigField struct {
	Name                  string  `yaml:"name" json:"name"`
	Required              bool    `yaml:"required" json:"required"`
	RequiredForPublishing *bool   `yaml:"requiredForPublishing,omitempty" json:"required_for_publishing,omitempty"`
	DefaultValue          *any    `yaml:"defaultValue,omitempty" json:"default_value,omitempty"`
	Description           *string `yaml:"description,omitempty" json:"description,omitempty"`
	Language              *string `yaml:"language,omitempty" json:"language,omitempty"`
	SecretName            *string `yaml:"secretName,omitempty" json:"secret_name,omitempty"`
	ValidationRegex       *string `yaml:"validationRegex,omitempty" json:"validation_regex,omitempty"`
	ValidationMessage     *string `yaml:"validationMessage,omitempty" json:"validation_message,omitempty"`
}

type UpgradeFunc

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

type WorkflowDispatch added in v0.4.2

type WorkflowDispatch struct {
	Inputs Inputs `yaml:"inputs"`
}

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