Closed andrewemeryanz closed 3 years ago
The bytes type does not currently support the length constraint as the string type does currently.
bytes
length
string
For example, the following string.sysl:
string.sysl
App: !table T: s <: string(0..1024)
Produces the following in the generated proto structure (trimmed for brevity): sysl pb string.sysl
sysl pb string.sysl
key: "s" value: { primitive: STRING constraint: { length: { max: 1024 } } }
However, the following bytes.sysl:
bytes.sysl
App: !table T: b <: bytes(0..1024)
Produces an error while parsing.
The bytes type should support the length constraint: sysl pb bytes.sysl
sysl pb bytes.sysl
key: "b" value: { primitive: BYTES constraint: { length: { max: 1024 } } }
$ sysl info Build: Version : v0.170.0 Git Commit : cb1ad4b5d238c3a7c78694b04466b15ec9de75ee Date : 2020-07-31T07:22:34Z Go Version : go1.13.14 linux/amd64 OS : darwin/amd64
Upon inspection, this may be a simple as adding sysl.Type_BYTES to makeTypeConstraint in listener_impl.go.
sysl.Type_BYTES
makeTypeConstraint
listener_impl.go
Description
The
bytes
type does not currently support thelength
constraint as thestring
type does currently.For example, the following
string.sysl
:Produces the following in the generated proto structure (trimmed for brevity):
sysl pb string.sysl
However, the following
bytes.sysl
:Produces an error while parsing.
Expected behavior
The
bytes
type should support thelength
constraint:sysl pb bytes.sysl
Your Environment