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 ¶
ConvertFieldError convert the cue error to the field error
func ConvertOpenAPISchema2SwaggerObject ¶
ConvertOpenAPISchema2SwaggerObject converts OpenAPI v2 JSON schema to Swagger Object
func FixOpenAPISchema ¶
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 ¶
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 ¶
ParsePropertiesToSchema parse the properties in cue script to the openapi schema Read the template.parameter field
func (CUE) ParseToTemplateValue ¶
ParseToTemplateValue parse the cue script to cue.Value. It must include a valid template.
func (CUE) ParseToValue ¶
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 ¶
ValidateProperties validate the input properties by the template
type ParameterError ¶
ParameterError the error report of the parameter field validation
func (*ParameterError) Error ¶
func (e *ParameterError) Error() string
Error return the error message