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

fix: extensions broke oneof #1789

Merged
merged 1 commit into from Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/namespace.js
Expand Up @@ -6,7 +6,8 @@ var ReflectionObject = require("./object");
((Namespace.prototype = Object.create(ReflectionObject.prototype)).constructor = Namespace).className = "Namespace";

var Field = require("./field"),
util = require("./util");
util = require("./util"),
OneOf = require("./oneof");

var Type, // cyclic
Service,
Expand Down Expand Up @@ -217,7 +218,7 @@ Namespace.prototype.getEnum = function getEnum(name) {
*/
Namespace.prototype.add = function add(object) {

if (!(object instanceof Field && object.extend !== undefined || object instanceof Type || object instanceof Enum || object instanceof Service || object instanceof Namespace))
if (!(object instanceof Field && object.extend !== undefined || object instanceof Type || object instanceof OneOf || object instanceof Enum || object instanceof Service || object instanceof Namespace))
throw TypeError("object must be a valid nested object");

if (!this.nested)
Expand Down
3 changes: 3 additions & 0 deletions tests/api_oneof.js
Expand Up @@ -8,6 +8,9 @@ var def = {
};

var proto = "syntax = \"proto3\";\
import \"google/protobuf/descriptor.proto\";\
extend google.protobuf.FileOptions { optional int32 ecs_component_id = 50000;}\
option (ecs_component_id) = 1020;\
message Test {\
oneof kind {\
uint32 a = 1;\
Expand Down