Documentation
¶
Index ¶
- func ConvertFieldError(err error) error
- func ConvertOpenAPISchema2SwaggerObject(data []byte) (*openapi3.Schema, error)
- func FixOpenAPISchema(name string, schema *openapi3.Schema)
- type CUE
- func (c CUE) MergeValues(context interface{}, properties map[string]interface{}) (*value.Value, error)
- func (c CUE) ParsePropertiesToSchema(templateFieldPath ...string) (*openapi3.Schema, error)
- func (c CUE) ParseToTemplateValue() (*value.Value, error)
- func (c CUE) ParseToValue() (*value.Value, error)
- func (c CUE) RunAndOutput(context interface{}, properties map[string]interface{}, outputField ...string) (*value.Value, error)
- func (c CUE) ValidateProperties(properties map[string]interface{}) error
- type ParameterError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertFieldError ¶
func ConvertFieldError(err error) error
ConvertFieldError convert the cue error to the field error
func ConvertOpenAPISchema2SwaggerObject ¶
func ConvertOpenAPISchema2SwaggerObject(data []byte) (*openapi3.Schema, error)
ConvertOpenAPISchema2SwaggerObject converts OpenAPI v2 JSON schema to Swagger Object
func FixOpenAPISchema ¶
func FixOpenAPISchema(name string, schema *openapi3.Schema)
FixOpenAPISchema fixes tainted `description` filed, missing of title `field`.
Types ¶
type CUE ¶
type CUE string
CUE the cue script with the template format Like this: ------------ metadata: {}
template: { parameter: {} output: {} }
------------
func BuildCUEScriptWithDefaultContext ¶
func BuildCUEScriptWithDefaultContext(defaultContext []byte, content []byte) CUE
BuildCUEScriptWithDefaultContext build a cue script instance from a byte array.
func (CUE) MergeValues ¶
func (c CUE) MergeValues(context interface{}, properties map[string]interface{}) (*value.Value, error)
MergeValues merge the input values to the cue script The context variables could be referenced in all fields. The parameter only could be referenced in the template area.
func (CUE) ParsePropertiesToSchema ¶
func (c CUE) ParsePropertiesToSchema(templateFieldPath ...string) (*openapi3.Schema, error)
ParsePropertiesToSchema parse the properties in cue script to the openapi schema Read the template.parameter field
func (CUE) ParseToTemplateValue ¶
func (c CUE) ParseToTemplateValue() (*value.Value, error)
ParseToTemplateValue parse the cue script to cue.Value. It must include a valid template.
func (CUE) ParseToValue ¶
func (c CUE) ParseToValue() (*value.Value, error)
ParseToValue parse the cue script to cue.Value
func (CUE) RunAndOutput ¶
func (c CUE) RunAndOutput(context interface{}, properties map[string]interface{}, outputField ...string) (*value.Value, error)
RunAndOutput run the cue script and return the values of the specified field. The output field must be under the template field.
func (CUE) ValidateProperties ¶
func (c CUE) ValidateProperties(properties map[string]interface{}) error
ValidateProperties validate the input properties by the template
type ParameterError ¶
type ParameterError struct {
Name string
Message string
}
ParameterError the error report of the parameter field validation