DefinitelyTyped/types/protocol-buffers-schema/types.d.ts
Claas Ahlrichs 25e3419e81 new package: protocol-buffers-schema (#33745)
* bootstraped folder structure for "protocol-buffers-schema"

* npx prettier --write .\types\protocol-buffers-schema\**

* drafted types for protocol-buffers-schema

* moved types into dedicated file

* added "strictFunctionTypes"-flag

* drafted index.d.ts

* added missing files to tsconfig

* npx prettier --write .\types\protocol-buffers-schema\**

* added "node" to types in tsconfig

* removed redundant "export" keywords

* added reference to node type(s)

* added test case
2019-03-11 11:06:05 -07:00

82 lines
1.4 KiB
TypeScript

export interface Option {
[key: string]: string | boolean;
}
export interface Options {
[key: string]: string | boolean | Option | Option[];
}
export interface Enum {
name: string;
values: {
[key: string]: {
value: number;
options: Options;
};
};
options: Options;
}
export interface FieldOptions {
[key: string]: string;
}
export interface Field {
name: string;
type: string;
tag: number;
map: {
from: string;
to: string;
};
oneof: null | string;
required: boolean;
repeated: boolean;
options: FieldOptions;
}
export interface Message {
name: string;
enums: Enum[];
extends: Extend[];
extensions: Extension[];
messages: Message[];
fields: Field[];
}
export interface Extend {
name: string;
message: Message;
}
export interface Extension {
from: number;
to: number;
}
export interface Service {
name: string;
methods: Method[];
options: Options;
}
export interface Method {
name: string;
input_type: string;
output_type: string;
client_streaming: boolean;
server_streaming: boolean;
options: Options;
}
export interface Schema {
syntax: number;
package: null | string;
imports: string[];
enums: Enum[];
messages: Message[];
options: Options;
extends: Extend[];
service?: Service[];
}