Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sbansal7 opened this issue Sep 12, 2022 · 0 comments
Labels
type: bug Something isn't working

Comments

@sbansal7
Copy link
Contributor

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

@sbansal7 sbansal7 added the type: bug Something isn't working label Sep 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant