Permalink
Browse files

Other: Fixed obvious issues with ext/descriptor, does not throw anymo…

…re when throwing descriptor.proto itself at it, see #757
  • Loading branch information...
dcodeIO committed Apr 13, 2017
1 parent b355115 commit 1fc911cef01e081c04fb82ead685f49dde1403bb
Showing with 330 additions and 126 deletions.
  1. +2 −2 cli/lib/tsd-jsdoc/publish.js
  2. +34 −18 ext/descriptor/index.d.ts
  3. +251 −96 ext/descriptor/index.js
  4. +40 −0 ext/descriptor/test.js
  5. +3 −10 scripts/gentests.js
@@ -242,7 +242,7 @@ function getTypeOf(element) {
// begins writing the definition of the specified element
function begin(element, is_interface) {
writeComment(element.comment, is_interface || isInterface(element) || isClassLike(element) || isNamespace(element) || element.isEnum);
if (element.scope !== "global" || options.module || is_interface || isInterface(element))
if (element.scope !== "global" || options.module)
return;
write("export ");
}
@@ -543,7 +543,7 @@ function handleTypeDef(element, parent) {
}
} else {
// see: https://github.com/dcodeIO/protobuf.js/issues/737
// begin(element, true);
// NO begin(element, true); - isn't exported
writeln();
write("type ", element.name);
if (element.templates && element.templates.length)
@@ -1,12 +1,10 @@
import * as $protobuf from "../..";
declare const descriptor: $protobuf.Namespace;
interface IFileDescriptorSet {
export interface IFileDescriptorSet {
file: IFileDescriptorProto[];
}
interface IFileDescriptorProto {
export interface IFileDescriptorProto {
name?: string;
package?: string;
dependency?: any;
@@ -21,7 +19,7 @@ interface IFileDescriptorProto {
syntax?: string;
}
interface IDescriptorProto {
export interface IDescriptorProto {
name?: string;
field?: IFieldDescriptorProto[];
extension?: IFieldDescriptorProto[];
@@ -34,25 +32,25 @@ interface IDescriptorProto {
reservedName?: string[];
}
interface IMessageOptions {
export interface IMessageOptions {
mapEntry?: boolean;
}
interface IExtensionRange {
export interface IExtensionRange {
start?: number;
end?: number;
}
interface IReservedRange {
export interface IReservedRange {
start?: number;
end?: number;
}
interface IFieldOptions {
export interface IFieldOptions {
packed?: boolean;
}
interface IFieldDescriptorProto {
export interface IFieldDescriptorProto {
name?: string;
number?: number;
label?: IFieldDescriptorProto_Label;
@@ -69,40 +67,58 @@ type IFieldDescriptorProto_Label = number;
type IFieldDescriptorProto_Type = number;
interface IEnumDescriptorProto {
export interface IEnumDescriptorProto {
name?: string;
value?: IEnumValueDescriptorProto[];
options?: IEnumOptions;
}
interface IEnumValueDescriptorProto {
export interface IEnumValueDescriptorProto {
name?: string;
number?: number;
options?: any;
}
interface IEnumOptions {
export interface IEnumOptions {
allowAlias?: boolean;
}
interface IOneofDescriptorProto {
export interface IOneofDescriptorProto {
name?: string;
options?: any;
}
interface IServiceDescriptorProto {
export interface IServiceDescriptorProto {
name?: string;
method?: IMethodDescriptorProto[];
options?: any;
}
interface IMethodDescriptorProto {
export interface IMethodDescriptorProto {
name?: string;
inputType?: string;
outputType?: string;
options?: any;
clientStreaming?: boolean;
serverStreaming?: boolean;
}
export = descriptor;
export const FileDescriptorSet: $protobuf.Type;
export const FileDescriptorProto: $protobuf.Type;
export const DescriptorProto: $protobuf.Type;
export const FieldDescriptorProto: $protobuf.Type;
export const OneofDescriptorProto: $protobuf.Type;
export const EnumDescriptorProto: $protobuf.Type;
export const ServiceDescriptorProto: $protobuf.Type;
export const EnumValueDescriptorProto: $protobuf.Type;
export const MethodDescriptorProto: $protobuf.Type;
export const FileOptions: $protobuf.Type;
export const MessageOptions: $protobuf.Type;
export const FieldOptions: $protobuf.Type;
export const OneofOptions: $protobuf.Type;
export const EnumOptions: $protobuf.Type;
export const EnumValueOptions: $protobuf.Type;
export const ServiceOptions: $protobuf.Type;
export const MethodOptions: $protobuf.Type;
export const UninterpretedOption: $protobuf.Type;
export const SourceCodeInfo: $protobuf.Type;
export const GeneratedCodeInfo: $protobuf.Type;
Oops, something went wrong.

0 comments on commit 1fc911c

Please sign in to comment.