command

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommandConvertToNDCSchema added in v0.2.0

func CommandConvertToNDCSchema(args *ConvertCommandArguments, logger *slog.Logger) error

ConvertToNDCSchema converts to NDC REST schema from file

func ConvertToNDCSchema

func ConvertToNDCSchema(config *ConvertConfig, logger *slog.Logger) (*schema.NDCRestSchema, error)

ConvertToNDCSchema converts to NDC REST schema from config

func Json2Yaml

func Json2Yaml(args *Json2YamlCommandArguments, logger *slog.Logger) error

Json2Yaml converts a JSON file to YAML

func ResolveConvertConfigArguments added in v0.2.0

func ResolveConvertConfigArguments(config *ConvertConfig, configDir string, args *ConvertCommandArguments)

ResolveConvertConfigArguments resolves convert config arguments

Types

type ConvertCommandArguments

type ConvertCommandArguments struct {
	File        string            `help:"File path needs to be converted." short:"f"`
	Config      string            `help:"Path of the config file." short:"c"`
	Output      string            `help:"The location where the ndc schema file will be generated. Print to stdout if not set" short:"o"`
	Spec        string            `help:"The API specification of the file, is one of oas3 (openapi3), oas2 (openapi2)"`
	Format      string            `` /* 145-byte string literal not displayed */
	Strict      bool              `help:"Require strict validation" default:"false"`
	Pure        bool              `help:"Return the pure NDC schema only" default:"false"`
	TrimPrefix  string            `help:"Trim the prefix in URL, e.g. /v1"`
	EnvPrefix   string            `help:"The environment variable prefix for security values, e.g. PET_STORE"`
	MethodAlias map[string]string `help:"Alias names for HTTP method. Used for prefix renaming, e.g. getUsers, postUser"`
	PatchBefore []string          `help:"Patch files to be applied into the input file before converting"`
	PatchAfter  []string          `help:"Patch files to be applied into the input file after converting"`
}

ConvertCommandArguments represent available command arguments for the convert command

type ConvertConfig added in v0.2.0

type ConvertConfig struct {
	File        string                `json:"file" yaml:"file"`
	Spec        schema.SchemaSpecType `json:"spec" yaml:"spec"`
	MethodAlias map[string]string     `json:"methodAlias" yaml:"methodAlias"`
	TrimPrefix  string                `json:"trimPrefix" yaml:"trimPrefix"`
	EnvPrefix   string                `json:"envPrefix" yaml:"envPrefix"`
	Pure        bool                  `json:"pure" yaml:"pure"`
	Strict      bool                  `json:"strict" yaml:"strict"`
	PatchBefore []utils.PatchConfig   `json:"patchBefore" yaml:"patchBefore"`
	PatchAfter  []utils.PatchConfig   `json:"patchAfter" yaml:"patchAfter"`
	Output      string                `json:"output" yaml:"output"`
}

ConvertConfig represents the content of convert config file

type Json2YamlCommandArguments

type Json2YamlCommandArguments struct {
	File   string `help:"File path needs to be converted. Print to stdout if not set" short:"f" required:""`
	Output string `help:"The location where the ndc schema file will be generated" short:"o"`
}

Json2YamlCommandArguments represent available command arguments for the json2yaml command

Jump to

Keyboard shortcuts

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