Documentation
¶
Index ¶
- Constants
- func ConvertFieldError(err error) error
- func ConvertOpenAPISchema2SwaggerObject(data []byte) (*openapi3.Schema, error)
- func Error(val cue.Value) error
- func FixOpenAPISchema(name string, schema *openapi3.Schema)
- type CUE
- func (c CUE) MergeValues(context interface{}, properties map[string]interface{}) (cue.Value, error)
- func (c CUE) ParsePropertiesToSchemaWithCueX(ctx context.Context, templateFieldPath string) (*openapi3.Schema, error)
- func (c CUE) ParseToTemplateValue() (cue.Value, error)
- func (c CUE) ParseToTemplateValueWithCueX(ctx context.Context) (cue.Value, error)
- func (c CUE) ParseToValue() (cue.Value, error)
- func (c CUE) ParseToValueWithCueX(ctx context.Context) (cue.Value, error)
- func (c CUE) RunAndOutput(context interface{}, properties map[string]interface{}, outputField ...string) (cue.Value, error)
- func (c CUE) RunAndOutputWithCueX(ctx context.Context, context interface{}, properties map[string]interface{}, ...) (cue.Value, error)
- func (c CUE) ValidateProperties(properties map[string]interface{}) error
- func (c CUE) ValidatePropertiesWithCueX(ctx context.Context, properties map[string]interface{}) error
- type ParameterError
Constants ¶
const BaseTemplate = `
context: {
name: string
config?: [...{
name: string
value: string
}]
...
}
`
BaseTemplate include base info provided by KubeVela for CUE template
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 Error ¶ added in v1.9.0
func Error(val cue.Value) error
Error return value's error information.
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{}) (cue.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) ParsePropertiesToSchemaWithCueX ¶ added in v1.9.0
func (c CUE) ParsePropertiesToSchemaWithCueX(ctx context.Context, templateFieldPath string) (*openapi3.Schema, error)
ParsePropertiesToSchemaWithCueX parse the properties in cue script to the openapi schema Read the template.parameter field
func (CUE) ParseToTemplateValue ¶
func (c CUE) ParseToTemplateValue() (cue.Value, error)
ParseToTemplateValue parse the cue script to cue.Value. It must include a valid template.
func (CUE) ParseToTemplateValueWithCueX ¶ added in v1.9.0
func (c CUE) ParseToTemplateValueWithCueX(ctx context.Context) (cue.Value, error)
ParseToTemplateValueWithCueX parse the cue script to cue.Value. It must include a valid template.
func (CUE) ParseToValue ¶
func (c CUE) ParseToValue() (cue.Value, error)
ParseToValue parse the cue script to cue.Value
func (CUE) ParseToValueWithCueX ¶ added in v1.9.0
func (c CUE) ParseToValueWithCueX(ctx context.Context) (cue.Value, error)
ParseToValueWithCueX parse the cue script to cue.Value
func (CUE) RunAndOutput ¶
func (c CUE) RunAndOutput(context interface{}, properties map[string]interface{}, outputField ...string) (cue.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) (cue.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 ¶
func (c CUE) ValidateProperties(properties map[string]interface{}) error
ValidateProperties validate the input properties by the template
func (CUE) ValidatePropertiesWithCueX ¶ added in v1.9.0
func (c CUE) ValidatePropertiesWithCueX(ctx context.Context, properties map[string]interface{}) error
ValidatePropertiesWithCueX 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