lyft / clutch

Extensible platform for infrastructure management

Home Page:https://clutch.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

api: validation for string field with list of valid values causes javascript build failure

sbansal7 opened this issue · comments

Description

Adding a field like the following causes javascript build failure:

 string db_type = 6 [ (validate.rules).string = {in: ["mysql", "postgres"]} ];

Expected Behavior
This should compile successfully

Actual Behavior

info: compiling javascript bundle
/Users/sbansal/go/src/github.com/maira-io/maira-gateway/build/bin/protobufjs-6.11.2/node_modules/protobufjs/cli/pbjs.js:246
            throw err;
            ^

Error: illegal value '[' (/Users/sbansal/go/src/github.com/maira-io/maira-gateway/api/config/service/rds/v1/rds.proto, line 20)
    at illegal (/Users/sbansal/go/src/github.com/maira-io/maira-gateway/build/bin/protobufjs-6.11.2/node_modules/protobufjs/src/parse.js:96:16)
    at readValue (/Users/sbansal/go/src/github.com/maira-io/maira-gateway/build/bin/protobufjs-6.11.2/node_modules/protobufjs/src/parse.js:135:19)
    at parseOptionValue (/Users/sbansal/go/src/github.com/maira-io/maira-gateway/build/bin/protobufjs-6.11.2/node_modules/protobufjs/src/parse.js:606:33)
    at parseOption (/Users/sbansal/go/src/github.com/maira-io/maira-gateway/build/bin/protobufjs-6.11.2/node_modules/protobufjs/src/parse.js:585:27)
    at parseInlineOptions (/Users/sbansal/go/src/github.com/maira-io/maira-gateway/build/bin/protobufjs-6.11.2/node_modules/protobufjs/src/parse.js:638:17)
    at parseField_line (/Users/sbansal/go/src/github.com/maira-io/maira-gateway/build/bin/protobufjs-6.11.2/node_modules/protobufjs/src/parse.js:388:13)
    at ifBlock (/Users/sbansal/go/src/github.com/maira-io/maira-gateway/build/bin/protobufjs-6.11.2/node_modules/protobufjs/src/parse.js:294:17)
    at parseField (/Users/sbansal/go/src/github.com/maira-io/maira-gateway/build/bin/protobufjs-6.11.2/node_modules/protobufjs/src/parse.js:378:9)
    at parseType_block (/Users/sbansal/go/src/github.com/maira-io/maira-gateway/build/bin/protobufjs-6.11.2/node_modules/protobufjs/src/parse.js:350:21)
    at ifBlock (/Users/sbansal/go/src/github.com/maira-io/maira-gateway/build/bin/protobufjs-6.11.2/node_modules/protobufjs/src/parse.js:290:17)

Node.js v18.7.0
make: *** [api] Error 1

Version

f9eb6f7
Other Context

I believe this is happening because of a protobufjs bug that is fixed in its version 7.0
This is the PR that I am referring to: protobufjs/protobuf.js#1574