Documentation
¶
Index ¶
- func CommandConvertToNDCSchema(args *ConvertCommandArguments, logger *slog.Logger) error
- func ConvertToNDCSchema(config *ConvertConfig, logger *slog.Logger) (*schema.NDCRestSchema, error)
- func Json2Yaml(args *Json2YamlCommandArguments, logger *slog.Logger) error
- func ResolveConvertConfigArguments(config *ConvertConfig, configDir string, args *ConvertCommandArguments)
- type ConvertCommandArguments
- type ConvertConfig
- type Json2YamlCommandArguments
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"`
Prefix string `help:"Add a prefix to the function and procedure names"`
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"`
AllowedContentTypes []string `help:"Allowed content types. All content types are allowed by default"`
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 path needs to be converted
File string `json:"file" yaml:"file" jsonschema:"required"`
// The API specification of the file, is one of oas3 (openapi3), oas2 (openapi2)
Spec schema.SchemaSpecType `json:"spec,omitempty" yaml:"spec" jsonschema:"default=oas3"`
// Alias names for HTTP method. Used for prefix renaming, e.g. getUsers, postUser
MethodAlias map[string]string `json:"methodAlias,omitempty" yaml:"methodAlias"`
// Add a prefix to the function and procedure names
Prefix string `json:"prefix,omitempty" yaml:"prefix"`
// Trim the prefix in URL, e.g. /v1
TrimPrefix string `json:"trimPrefix,omitempty" yaml:"trimPrefix"`
// The environment variable prefix for security values, e.g. PET_STORE
EnvPrefix string `json:"envPrefix,omitempty" yaml:"envPrefix"`
// Return the pure NDC schema only
Pure bool `json:"pure,omitempty" yaml:"pure"`
// Require strict validation
Strict bool `json:"strict,omitempty" yaml:"strict"`
// Patch files to be applied into the input file before converting
PatchBefore []utils.PatchConfig `json:"patchBefore,omitempty" yaml:"patchBefore"`
// Patch files to be applied into the input file after converting
PatchAfter []utils.PatchConfig `json:"patchAfter,omitempty" yaml:"patchAfter"`
// Allowed content types. All content types are allowed by default
AllowedContentTypes []string `json:"allowedContentTypes,omitempty" yaml:"allowedContentTypes"`
// The location where the ndc schema file will be generated. Print to stdout if not set
Output string `json:"output,omitempty" 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
Click to show internal directories.
Click to hide internal directories.