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

pbjs failed with erro "illegal value '['" #1289

Open
niros1 opened this issue Aug 30, 2019 · 1 comment
Open

pbjs failed with erro "illegal value '['" #1289

niros1 opened this issue Aug 30, 2019 · 1 comment

Comments

@niros1
Copy link

niros1 commented Aug 30, 2019

protobuf.js version: 6.8.8

pbjs failed to compile and produce the js file for proto with inner "["

pbjs commands + params:
pbjs -t static-module --keep-case -w commonjs -p . path/to/proto/xxx.proto > xxx.js

Stack trace:
Error: illegal value '[' (marketplace/public/types/v1/basic_types.proto, line 17)
at illegal (/usr/local/lib/node_modules/protobufjs/src/parse.js:94:16)
at readValue (/usr/local/lib/node_modules/protobufjs/src/parse.js:133:19)
at parseOptionValue (/usr/local/lib/node_modules/protobufjs/src/parse.js:568:63)
at parseOptionValue (/usr/local/lib/node_modules/protobufjs/src/parse.js:566:25)
at parseOption (/usr/local/lib/node_modules/protobufjs/src/parse.js:551:9)
at parseCommon (/usr/local/lib/node_modules/protobufjs/src/parse.js:254:17)
at parseType_block (/usr/local/lib/node_modules/protobufjs/src/parse.js:305:17)
at ifBlock (/usr/local/lib/node_modules/protobufjs/src/parse.js:286:17)
at parseType (/usr/local/lib/node_modules/protobufjs/src/parse.js:304:9)
at parseCommon (/usr/local/lib/node_modules/protobufjs/src/parse.js:259:17)

My proto looks like that:

syntax = "proto3";
package marketplace.types.v1;

option go_package = "gerrit.it.here.com/mobility/marketplace/proto.git/gen/go/marketplace/public/types/v1";
option objc_class_prefix = "MarketplaceTypesV1";
option java_multiple_files = true;
option java_package = "com.here.mobility.marketplace.types.v1";

import "protoc-gen-swagger/options/annotations.proto";

// A point in the world, expressed as a {latitude, longitude) pair.
message Point {
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_schema) = {
json_schema: {
title: "Point"
description: "Represents a point in the world, expressed as a {latitude, longitude) pair."
required: ["lat", "lng"]
};
};

// Latitude. Values range from -180 to 180.
double lat = 1;
// Longitude. Values range from -90 to 90.
double lng = 2;

}

@Musiqua
Copy link

Musiqua commented Oct 16, 2019

This is solved in #1256, which unfortunately hasn't been merged yet. You would need to do a slight change to the option syntax, though:
json_schema: { title: "Point" description: "Represents a point in the world, expressed as a {latitude, longitude) pair." required: "lat" required: "lng" };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants