Documentation ¶
Index ¶
- func ConvertFieldError(err error) error
- func ConvertOpenAPISchema2SwaggerObject(data []byte) (*openapi3.Schema, error)
- func Error(val cuelang.Value) 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) ParsePropertiesToSchemaWithCueX(templateFieldPath string) (*openapi3.Schema, error)
- func (c CUE) ParseToTemplateValue() (*value.Value, error)
- func (c CUE) ParseToTemplateValueWithCueX() (cuelang.Value, error)
- func (c CUE) ParseToValue() (*value.Value, error)
- func (c CUE) ParseToValueWithCueX() (cuelang.Value, error)
- func (c CUE) RunAndOutput(context interface{}, properties map[string]interface{}, outputField ...string) (*value.Value, error)
- func (c CUE) RunAndOutputWithCueX(ctx context.Context, context interface{}, properties map[string]interface{}, ...) (cuelang.Value, error)
- func (c CUE) ValidateProperties(properties map[string]interface{}) error
- func (c CUE) ValidatePropertiesWithCueX(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) ParsePropertiesToSchemaWithCueX ¶ added in v1.9.0
ParsePropertiesToSchemaWithCueX 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) ParseToTemplateValueWithCueX ¶ added in v1.9.0
ParseToTemplateValueWithCueX 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) ParseToValueWithCueX ¶ added in v1.9.0
ParseToValueWithCueX 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) RunAndOutputWithCueX ¶ added in v1.9.0
func (c CUE) RunAndOutputWithCueX(ctx context.Context, context interface{}, properties map[string]interface{}, outputField ...string) (cuelang.Value, error)
RunAndOutputWithCueX 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
func (CUE) ValidatePropertiesWithCueX ¶ added in v1.9.0
ValidatePropertiesWithCueX 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