mirror of https://github.com/grpc/grpc-node.git
support both input and output
update readme update readme
This commit is contained in:
parent
e955c47bd5
commit
927c29de4a
|
@ -92,8 +92,12 @@ Options:
|
||||||
[string] [default: "%s"]
|
[string] [default: "%s"]
|
||||||
--outputTemplate Template for mapping output or "restricted" type names
|
--outputTemplate Template for mapping output or "restricted" type names
|
||||||
[string] [default: "%s__Output"]
|
[string] [default: "%s__Output"]
|
||||||
--branded Emit property for branded type whose value is fullName
|
--inputBranded Output property for branded type for "permissive"
|
||||||
of the Message [boolean] [default: false]
|
types with fullName of the Message as its value
|
||||||
|
[boolean]
|
||||||
|
--outputBranded Output property for branded type for "restricted"
|
||||||
|
types with fullName of the Message as its value
|
||||||
|
[boolean]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Example Usage
|
### Example Usage
|
||||||
|
|
|
@ -48,7 +48,8 @@ type GeneratorOptions = Protobuf.IParseOptions & Protobuf.IConversionOptions & {
|
||||||
includeComments?: boolean;
|
includeComments?: boolean;
|
||||||
inputTemplate: string;
|
inputTemplate: string;
|
||||||
outputTemplate: string;
|
outputTemplate: string;
|
||||||
outputBranded: boolean;
|
inputBranded?: boolean;
|
||||||
|
outputBranded?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
class TextFormatter {
|
class TextFormatter {
|
||||||
|
@ -272,9 +273,9 @@ function generatePermissiveMessageInterface(formatter: TextFormatter, messageTyp
|
||||||
}
|
}
|
||||||
formatter.writeLine(`'${oneof.name}'?: ${typeString};`);
|
formatter.writeLine(`'${oneof.name}'?: ${typeString};`);
|
||||||
}
|
}
|
||||||
// if (options.inputBranded) {
|
if (options.inputBranded) {
|
||||||
// formatTypeBrand(formatter, messageType);
|
formatTypeBrand(formatter, messageType);
|
||||||
// }
|
}
|
||||||
formatter.unindent();
|
formatter.unindent();
|
||||||
formatter.writeLine('}');
|
formatter.writeLine('}');
|
||||||
}
|
}
|
||||||
|
@ -830,7 +831,7 @@ async function runScript() {
|
||||||
.string(['includeDirs', 'grpcLib'])
|
.string(['includeDirs', 'grpcLib'])
|
||||||
.normalize(['includeDirs', 'outDir'])
|
.normalize(['includeDirs', 'outDir'])
|
||||||
.array('includeDirs')
|
.array('includeDirs')
|
||||||
.boolean(['keepCase', 'defaults', 'arrays', 'objects', 'oneofs', 'json', 'verbose', 'includeComments', 'outputBranded'])
|
.boolean(['keepCase', 'defaults', 'arrays', 'objects', 'oneofs', 'json', 'verbose', 'includeComments', 'inputBranded', 'outputBranded'])
|
||||||
.string(['longs', 'enums', 'bytes', 'inputTemplate', 'outputTemplate'])
|
.string(['longs', 'enums', 'bytes', 'inputTemplate', 'outputTemplate'])
|
||||||
.default('keepCase', false)
|
.default('keepCase', false)
|
||||||
.default('defaults', false)
|
.default('defaults', false)
|
||||||
|
@ -844,7 +845,6 @@ async function runScript() {
|
||||||
.default('bytes', 'Buffer')
|
.default('bytes', 'Buffer')
|
||||||
.default('inputTemplate', `${templateStr}`)
|
.default('inputTemplate', `${templateStr}`)
|
||||||
.default('outputTemplate', `${templateStr}__Output`)
|
.default('outputTemplate', `${templateStr}__Output`)
|
||||||
.default('outputBranded', false)
|
|
||||||
.coerce('longs', value => {
|
.coerce('longs', value => {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case 'String': return String;
|
case 'String': return String;
|
||||||
|
@ -884,6 +884,7 @@ async function runScript() {
|
||||||
grpcLib: 'The gRPC implementation library that these types will be used with',
|
grpcLib: 'The gRPC implementation library that these types will be used with',
|
||||||
inputTemplate: 'Template for mapping input or "permissive" type names',
|
inputTemplate: 'Template for mapping input or "permissive" type names',
|
||||||
outputTemplate: 'Template for mapping output or "restricted" type names',
|
outputTemplate: 'Template for mapping output or "restricted" type names',
|
||||||
|
inputBranded: 'Output property for branded type for "permissive" types with fullName of the Message as its value',
|
||||||
outputBranded: 'Output property for branded type for "restricted" types with fullName of the Message as its value',
|
outputBranded: 'Output property for branded type for "restricted" types with fullName of the Message as its value',
|
||||||
}).demandOption(['outDir', 'grpcLib'])
|
}).demandOption(['outDir', 'grpcLib'])
|
||||||
.demand(1)
|
.demand(1)
|
||||||
|
|
Loading…
Reference in New Issue