Documentation
¶
Overview ¶
Package commands provides CLI command handlers for oastools.
Index ¶
- Constants
- func HandleConvert(args []string) error
- func HandleDiff(args []string) error
- func HandleFix(args []string) error
- func HandleGenerate(args []string) error
- func HandleJoin(args []string) error
- func HandleParse(args []string) error
- func HandleValidate(args []string) error
- func MarshalDocument(doc any, format parser.SourceFormat) ([]byte, error)
- func OutputStructured(data any, format string) error
- func ValidateCollisionStrategy(strategyName, value string) error
- func ValidateOutputFormat(format string) error
- func ValidateOutputPath(outputPath string, inputPaths []string) error
- type ConvertFlags
- type DiffFlags
- type FixFlags
- type GenerateFlags
- type JoinFlags
- type ParseFlags
- type ValidateFlags
Constants ¶
const ( FormatText = "text" FormatJSON = "json" FormatYAML = "yaml" )
Output format constants
const (
StdinFilePath = "-"
)
Special file path constant
Variables ¶
This section is empty.
Functions ¶
func HandleConvert ¶
HandleConvert executes the convert command
func HandleGenerate ¶
HandleGenerate executes the generate command
func HandleValidate ¶
HandleValidate executes the validate command
func MarshalDocument ¶
func MarshalDocument(doc any, format parser.SourceFormat) ([]byte, error)
MarshalDocument marshals a document to bytes in the specified format
func OutputStructured ¶
OutputStructured outputs data in the specified format (json or yaml) to stdout. Returns an error if marshaling fails.
func ValidateCollisionStrategy ¶
ValidateCollisionStrategy validates a collision strategy name and returns an error if invalid. The strategyName parameter is used in the error message (e.g., "path-strategy").
func ValidateOutputFormat ¶
ValidateOutputFormat validates an output format and returns an error if invalid.
func ValidateOutputPath ¶
ValidateOutputPath checks if the output path is safe to write to
Types ¶
type ConvertFlags ¶
ConvertFlags contains flags for the convert command
func SetupConvertFlags ¶
func SetupConvertFlags() (*flag.FlagSet, *ConvertFlags)
SetupConvertFlags creates and configures a FlagSet for the convert command. Returns the FlagSet and a ConvertFlags struct with bound flag variables.
type DiffFlags ¶
DiffFlags contains flags for the diff command
func SetupDiffFlags ¶
SetupDiffFlags creates and configures a FlagSet for the diff command. Returns the FlagSet and a DiffFlags struct with bound flag variables.
type FixFlags ¶
FixFlags contains flags for the fix command
func SetupFixFlags ¶
SetupFixFlags creates and configures a FlagSet for the fix command. Returns the FlagSet and a FixFlags struct with bound flag variables.
type GenerateFlags ¶
type GenerateFlags struct {
Output string
PackageName string
Client bool
Server bool
Types bool
NoPointers bool
NoValidation bool
Strict bool
NoWarnings bool
}
GenerateFlags contains flags for the generate command
func SetupGenerateFlags ¶
func SetupGenerateFlags() (*flag.FlagSet, *GenerateFlags)
SetupGenerateFlags creates and configures a FlagSet for the generate command. Returns the FlagSet and a GenerateFlags struct with bound flag variables.
type JoinFlags ¶
type JoinFlags struct {
Output string
PathStrategy string
SchemaStrategy string
ComponentStrategy string
NoMergeArrays bool
NoDedupTags bool
Quiet bool
}
JoinFlags contains flags for the join command
func SetupJoinFlags ¶
SetupJoinFlags creates and configures a FlagSet for the join command. Returns the FlagSet and a JoinFlags struct with bound flag variables.
type ParseFlags ¶
type ParseFlags struct {
ResolveRefs bool
ResolveHTTPRefs bool
Insecure bool
ValidateStructure bool
Quiet bool
}
ParseFlags contains flags for the parse command
func SetupParseFlags ¶
func SetupParseFlags() (*flag.FlagSet, *ParseFlags)
SetupParseFlags creates and configures a FlagSet for the parse command. Returns the FlagSet and a ParseFlags struct with bound flag variables.
type ValidateFlags ¶
ValidateFlags contains flags for the validate command
func SetupValidateFlags ¶
func SetupValidateFlags() (*flag.FlagSet, *ValidateFlags)
SetupValidateFlags creates and configures a FlagSet for the validate command. Returns the FlagSet and a ValidateFlags struct with bound flag variables.