ts-proto 1.177.0 → 1.178.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.markdown +1 -1
- package/build/options.d.ts +1 -1
- package/build/schema.js +4 -4
- package/package.json +1 -1
package/README.markdown
CHANGED
|
@@ -434,7 +434,7 @@ Generated code will be placed in the Gradle build directory.
|
|
|
434
434
|
|
|
435
435
|
- With `--ts_proto_opt=annotateFilesWithVersion=false`, the generated files will not contain the versions of `protoc` and `ts-proto` used to generate the file. This option is normally set to `true`, such that files list the versions used.
|
|
436
436
|
|
|
437
|
-
- With `--ts_proto_opt=outputSchema=true`, meta typings will be generated that can later be used in other code generators.
|
|
437
|
+
- With `--ts_proto_opt=outputSchema=true`, meta typings will be generated that can later be used in other code generators. If outputSchema is instead specified to be `no-file-descriptor` then we do not include the file descriptor in the generated schema. This is useful if you are trying to minimize the size of the generated schema.
|
|
438
438
|
|
|
439
439
|
- With `--ts_proto_opt=outputTypeAnnotations=true`, each message will be given a `$type` field containing its fully-qualified name. You can use `--ts_proto_opt=outputTypeAnnotations=static-only` to omit it from the `interface` declaration, or `--ts_proto_opt=outputTypeAnnotations=optional` to make it an optional property on the `interface` definition. The latter option may be useful if you want to use the `$type` field for runtime type checking on responses from a server.
|
|
440
440
|
|
package/build/options.d.ts
CHANGED
|
@@ -68,7 +68,7 @@ export type Options = {
|
|
|
68
68
|
unrecognizedEnumName: string;
|
|
69
69
|
unrecognizedEnumValue: number;
|
|
70
70
|
exportCommonSymbols: boolean;
|
|
71
|
-
outputSchema: boolean;
|
|
71
|
+
outputSchema: boolean | "no-file-descriptor";
|
|
72
72
|
onlyTypes: boolean;
|
|
73
73
|
emitImportedFiles: boolean;
|
|
74
74
|
useAbortSignal: boolean;
|
package/build/schema.js
CHANGED
|
@@ -28,8 +28,7 @@ function generateSchema(ctx, fileDesc, sourceInfo) {
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
export interface ProtoMetadata {
|
|
31
|
-
fileDescriptor: ${fileDescriptorProto};
|
|
32
|
-
references: { [key: string]: any };
|
|
31
|
+
${ctx.options.outputSchema !== "no-file-descriptor" ? (0, ts_poet_1.code) `fileDescriptor: ${fileDescriptorProto};\n` : ""}references: { [key: string]: any };
|
|
33
32
|
dependencies?: ProtoMetadata[];
|
|
34
33
|
options?: {
|
|
35
34
|
options?: { [key: string]: any };
|
|
@@ -142,8 +141,9 @@ function generateSchema(ctx, fileDesc, sourceInfo) {
|
|
|
142
141
|
});
|
|
143
142
|
chunks.push((0, ts_poet_1.code) `
|
|
144
143
|
export const ${(0, ts_poet_1.def)("protoMetadata")}: ProtoMetadata = {
|
|
145
|
-
|
|
146
|
-
|
|
144
|
+
${ctx.options.outputSchema !== "no-file-descriptor"
|
|
145
|
+
? (0, ts_poet_1.code) `fileDescriptor: ${fileDescriptorProto}.fromPartial(${descriptor}),\n`
|
|
146
|
+
: ""}references: { ${(0, ts_poet_1.joinCode)(references, { on: "," })} },
|
|
147
147
|
dependencies: [${(0, ts_poet_1.joinCode)(dependencies, { on: "," })}],
|
|
148
148
|
${fileOptions || messagesOptions.length > 0 || servicesOptions.length > 0 || enumsOptions.length > 0
|
|
149
149
|
? (0, ts_poet_1.code) `options: {
|