Skip to content

Option value parsing is only supported partially #1743

@NikhilVerma

Description

@NikhilVerma

protobuf.js version: 6.11.3

Options parsing is not complete and it misses out on nested options and nested field options here is an example proto which fails

syntax = "proto3";

option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
  info: {
    title: "Some info"; // this fails
    version: "0";
  };
  host: "some.host";
};

message triggerRequest {
  actionType action = 1 [ (validate.rules).enum = {
    defined_only: true,
    not_in: [ 0 ] // this fails
  } ];
}
/protobufjs/src/parse.js:96
        return Error("illegal " + (name || "token") + " '" + token + "' (" + (filename ? filename + ", " : "") + "line " + tn.line + ")");
               ^
Error: illegal name ';' (my.proto, line 20)
    at illegal (/protobufjs/src/parse.js:96:16)
    at parseOptionValue (/protobufjs/src/parse.js:595:27)
    at parseOptionValue (/protobufjs/src/parse.js:604:33)
    at parseOption (/protobufjs/src/parse.js:585:27)
    at parse (/protobufjs/src/parse.js:783:17)
    at process (/protobufjs/src/root.js:127:30)
    at /protobufjs/src/root.js:194:17
    at fetchReadFileCallback (/@protobufjs/fetch/index.js:51:19)
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions