models.dsl.constraints.PrimitivePropertyConstraints.rapid Maven / Gradle / Ivy
/* Example model to show constraints override for primitive properties. */
rapidModel PrimitivePropertyConstraints
dataModel DataModel
// simple length constraints
simpleType StringLenType defined as string
length from 0 to 50
// simple regex constraints
simpleType StringRegType defined as string
matching regex "([a-z0-9_\\.-]+)@([\\da-z\\.-]+)\\.([a-z\\.]{2,6})+"
// complex constraints with combination of length and regex
simpleType StringComplexType defined as string
length from 0 to 50
matching regex "[A-Z]+"
// type with range constraints
simpleType IntRangeType defined as integer
valueRange from '1' to maximum '10'
structure Structure
// constraints override for custom type
stringProp1: StringLenType
// length constraint overrides simpleType
length from 1 to 40
// regex constraint added
matching regex "[A-Za-z0-9\\w]*"
// Add length constraints to regex
stringProp2: StringRegType
length to 10
// add constraints for primitive type property
stringProp3: string
length from 10
// add precise length constraints
stringProp4: string
of length 10