protoc-gen-typescript-http icon indicating copy to clipboard operation
protoc-gen-typescript-http copied to clipboard

feat: add generate options

Open moecasts opened this issue 2 years ago • 0 comments

make generate configurable

// UseProtoNames controls the casing of generated field names.
// If set to true, fields will use proto names (typically snake_case).
// If omitted or set to false, fields will use JSON names (typically camelCase).
use_proto_names: bool

// UseEnumNumbers emits enum values as numbers.
use_enum_numbers: bool

// The method names of service methods naming case.
// Only work when `UseEnumNumbers=true`
// opt:
// camelcase: convert name to lower camel case like `camelCase`
// pascalcase: convert name to pascalcase like `PascalCase`
// default is pascalcase
enum_field_naming: string

// Generate comments as multiline comments.
// multiline comments: /** ... */
// single line comments: // ...
use_multi_line_comment: bool

// force add `undefined` to message field.
// default true
force_message_field_undefinable: bool

// If set to true, body will be JSON.stringify before send
// default true
use_body_stringify: bool

// The method names of service methods naming case.
// opt:
// camelcase: convert name to lower camel case like `camelCase`
// pascalcase: convert name to pascalcase like `PascalCase`
// default is pascalcase
service_method_naming: 'camelcase' | 'pascalcase'

// If set to true, field int64 and uint64 will convert to string
force_long_as_string: bool

Inspirit from:

  • https://github.com/einride/protoc-gen-typescript-http/pull/78
  • https://github.com/stephenh/ts-proto#supported-options

moecasts avatar Oct 14 '23 18:10 moecasts