All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
No changes yet.
1.32.0 - 2024-04-23
- Redacted annotation provides a mechanism to redact certain struct fields from errors messages and log objects.
1.31.0 - 2023-06-09
- StreamReader ReadString() and WriteString() performance improvements.
1.30.0 - 2023-04-06
- AddTemplate template option.
- thriftbreak: support for changed types, new files, and optional JSON output.
- String() performance improvements for string type definitions.
1.29.2 - 2021-09-09
- Streaming now handles unrecongized fields and non-matching field types when deserializing Thrift structs.
1.29.1 - 2021-08-31
- Streaming encodes now handle
nil
items properly in containers.
1.29.0 - 2021-08-30
This release includes support for (de)serializing Thrift structs directly
to/from IO streams without converting them to the intermediate wire.Value
representation. This method of (de)serialization is significantly faster and
less memory intensive.
protocol/stream
andenvelope/stream
packages defining the core types needed to implement support for streaming serialization.protocol
:BinaryStreamer
that exports the Binary protocol as astream.Protocol
.protocol/binary
: The newDefault
variable is the default value of*binary.Protocol
that most users should use. This variable retains the struct type so that it can be used for any new interfaces declared in the future without anotherprotocol.Binary*
export.- All generated types now include
Encode
andDecode
methods that can serialize or deserialize those types usingstream.Writer
andstream.Reader
objects. ast
: All nodes now track the column numbers they're defined on in addition to the line numbers.ast
: AddAnnotations(Node)
function that reports the annotations for AST nodes that record annotations.
protocol
:- Deprecate
Binary
andEnvelopeAgnosticBinary
in favor ofprotocol/binary.Default
. - Deprecate
NoEnvelopeResponder
,EnvelopeV0Responder
, andEnvelopeV1Responder
in favor of versions declared in theprotocol/binary
package.
- Deprecate
Thanks to @witriew, @dianale31, @usmyth, and @jparise for their contributions to this release.
1.28.0 - 2021-07-26
idl.Parse
now returns structuredParseError
on parse failures.idl.Config
provides a new means of parsing Thrift IDLs. This is the recommended API going forward.
- ThriftRW now tracks positional information about constant values in the
Thrift IDL. These were previously ignored. To access this information, see
the documentation for
idl.Config
.
- Support parsing
struct
fields without field identifiers. This is legacy syntax still supported by Apache Thrift. Note that this is a parser-level change only; ThriftRW will refuse to generate Go code from these.
Thanks to @jparise for their contributions to this release.
1.27.0 - 2021-05-20
- ThriftRW is now able to parse Thrift files with
cpp_include
statements.
double
constants with exponents but without decimal components are now supported.- Fix handling of escaped quotes inside string literals.
1.26.0 - 2021-02-18
- Codegeneration for typedefs now uses use generated
MarshalLog...
functions where appropriate to avoid casting to a root go type from go packages of transitive thrift dependencies. - Rewrote internal wire's unsafeStringToBytes to adhere to 1.16 vet check.
1.25.1 - 2021-01-04
- Boolean fields with default value
false
now are sent over the wire.
1.25.0 - 2020-09-09
- Add RootModules field to api.GenerateServiceRequest.
1.24.0 - 2020-06-18
- Generate
Default_*
methods that construct Thrift structs with defined default values pre-populated.
- gen: Redefine Options.Plugin as a struct usable outside go.uber.org/thriftrw.
- Serializing generated Thrift objects no longer mutates them with default values for unspecified fields.
1.23.0 - 2020-03-31
- Support opting out of the
omitempty
JSON option by adding!omitempty
to the JSON struct tag.
- Drop library dependency in tools.go. This includes:
github.com/golang/mock/mockgen
,golang.org/x/lint
,golang.org/x/tools
,honnef.co/go/tools/cmd/staticcheck
.
1.22.0 - 2020-01-22
- Arguments now include Annotations as defined in the Thrift file.
1.21.0 - 2020-01-02
- Generated exceptions now include an
ErrorName()
method that returns the name of the exception as defined in the Thrift file. - gen: Templates now have access to
enumItemName
to determine the Go-level name of the enum item.
nil
slices are now treated as empty lists for fields oflist
type. This relaxes the previous requirement of accepting only non-nil
slices for requiredlist
fields. Note: this does not affectmap
andset
types with unhashable keys slices are accepted.- Migrated to Go modules.
1.20.2 - 2019-10-17
- Added canonical import path directive to avoid checking out ThriftRW at the wrong import path.
- Package names are now normalized before Go files are generated.
1.20.1 - 2019-07-30
- Fixed field compilation to allow fields with similar looking names and different casing.
1.20.0 - 2019-06-12
- ThriftRW now generates non-plugin code into a single file.
- Module data is now provided to ThriftRW plugins when the Module does not contain a service.
1.19.1 - 2019-05-16
- Fixed a bug that caused invalid code to be generated if two slices of the
same type with different
go.type
annotations were encountered in the same Thrift file.
1.19.0 - 2019-04-26
- Sets now support a
(go.type = "slice")
annotation to be generated as slices rather than maps.
1.18.0 - 2019-03-28
Ptr
methods for primititve typedefs.
1.17.0 - 2019-03-15
- Imports in generated code are now always named imports.
1.16.1 - 2019-01-23
- Bump API Version for ThriftRW plugins because the previous release contained a significant change to the ThriftRW Plugin API.
1.16.0 - 2019-01-22
- Expose Thrift file names, package prefix, and Thrift root directory to plugins.
- plugin: Library version matching was dropped.
1.15.0 - 2019-01-14
- Generated
Get*
andIsSet*
methods on structs are now nil-safe.
1.14.0 - 2018-10-18
- Structs now include
IsSet*
methods for fields that can be nil.
1.13.1 - 2018-10-04
- gen/plugin: Fixed a bug where typedefs of structs were mishandled; while they
should have been pointers, they were generated without
*
and failed to compile. - gen/zap: Fixed a bug where logging nil structs would panic.
1.13.0 - 2018-09-10
- gen: Added support for a
go.label
annotation that allows overriding the user-readable string names of enum items and struct fields. This has no effect on the names of the generated Go entities. - Generated types now implement
zapcore.ObjectMarshaler
orzapcore.ArrayMarshaler
where appropriate. This should lead to much faster logging of these objects. - Added
go.nolog
annotation for struct fields: Those with this annotation will not be included in Zap logging. - gen/enum:
MarshalText
andUnmarshalText
now round-trips, even if the enum value is unrecognized.
- ThriftRW now does a bounds-check on field identifiers rather than silently truncating them.
- gen: Equals methods on generated structs no longer panic if either value is nil.
- gen: Fixed a bug where
*_Values
functions for empty enums would not be generated. - gen: Fixed infinite loop in generated
Equals
methods of specific typedefs.
1.12.0 - 2018-06-25
- gen: Added
ThriftPackageImporter
to control import path resolution Thrift files. - Structs now include getter functions for all fields. This improves Apache Thrift compatibility.
- Enums now implement encoding.TextMarshaler.
- gen:
NewGenerator
is now usable from other packages.
1.11.0 - 2018-03-27
- Plugins now have access to service and function annotations.
1.10.0 - 2018-01-11
- Removed version check. Version checks would force code regeneration after installing backward-compatible versions of ThriftRW. This change relaxes that requirement.
1.9.0 - 2017-12-12
- Adds support for EnvelopeAgnosticProtocol. This upcast for protocol.Binary can decode both enveloped or not-enveloped requests and respond in kind, by exploiting the non-overlapping grammars of these message types.
- Generated enum types now include a
Ptr()
method.
1.8.0 - 2017-09-29
- Plugins: Annotations declared on user-defined types are now exposed on
TypeReference
.
- Optional fields of generated structs now enable the
omitempty
JSON option if the field holds a list, set, or map.
1.7.0 - 2017-09-12
- AST: Parts of the AST now support parsing docstrings in the
/** ... */
style. - Docstrings on types in the Thrift file are now included in the generated code.
1.6.0 - 2017-08-28
- Structs now include getter functions for primitive types.
- Fields of generated struct types are now tagged with easyjson-compatible
required
tags.
- Fixed code generation bug for default values of fields with a
typedef
type.
1.5.0 - 2017-08-03
- Code generated by ThriftRW now conforms to https://golang.org/s/generatedcode.
- Removed gomock and testify from Glide imports to test imports.
1.4.0 - 2017-07-21
- Added support for
go.tag
annotations on struct fields. Corresponding fields of the generated Go structs will be tagged with these values. - AST: Added a
LineNumber
function to get the line on which an AST Node was defined.
1.3.0 - 2017-07-05
- Plugins: Added support for overriding the communication channels used by plugins.
- Enums now implement the
encoding.TextUnmarshaler
interface. This allows retrieving enum values by name and integrates better with other encoding formats. - Enums now have a
<EnumName>_Values()
function which returns all known values for that enum.
- Plugins: Template output is now compliant with gofmt.
1.2.0 - 2017-04-17
- The Thrift IDL is now embedded withing the generated package. It is accessible via the package global ThriftModule.
1.1.0 - 2017-03-23
Equals()
methods are now generated for all custom types.- Added flags
--no-types
,--no-constants
,--no-service-helpers
. - AST: All type references and complex constant values now record the line numbers on which they were specified.
- AST: Added a Node interface to unify different AST object types.
- AST: Added Walk to traverse the AST using a Visitor.
- Handle
nil
values in generatedString()
methods. - Plugins: Fail code generation if communication with a plugin fails to disconnect properly.
- Fixed conflicts in helper functions when imported types had names similar to locally defined types.
1.0.0 - 2016-11-14
- Field names
ToWire
,FromWire
,String
, and for exceptionsError
are now reserved. Override the names of these fields in the generated code with thego.name
annotation. - Plugins: The version of ThriftRW used to compile the plugin is now matched against the version actually generating code.
0.5.0 - 2016-11-10
- A
go.name
annotation may now be specified to override the names of entities in the generated Go code. The annotation is supported for struct, union, and exception types, and their fields, enum types and enum items, and parameters of functions. - Plugins: Added a new
Service.Name
field which contains the name of field normalized per Go naming conventions. This, along withFunction.Name
may be used to build the names of theArgs
,Result
, andHelper
types for a function.
- Breaking: Generated enums now have first-class JSON support. Enums are (un)marshalled from/to strings if possible with fallback to integer for unrecognized values.
- Breaking:
Args
,Result
, andHelper
types for service functions are now generated in the same package as the user-defined types. These types are now named similarly to$service_$function_Args
where$service
and$function
are the names of the Thrift service and function normalized based on Go naming conventions. - Code generation will abort if struct fields, after conversion to Go style names, are not unique in the structure.
- Plugins: Renamed
Service.Name
toService.ThriftName
since it contains the name of the service as it appeared in the Thrift file. - Plugins: Constructors for
Plugin
andServiceGenerator
clients and handlers are now exposed in the same package as the interfaces. - Non-primitive types constants are now inlined in the generated Go code
instead of being referenced in an effort to reduce the impact of user errors
on the generated code. This is because non-primitive constants were
previously implemented as global
var
s which might be modified by user code.
- Plugins: Removed
Service.Directory
andService.ImportPath
because these are now same as the corresponding module.
0.4.0 - 2016-11-01
- Expose whether a function is oneway to plugins.
- Expose the version of the library under
go.uber.org/thriftrw/version.Version
. - Generated code will test for version compatibility with the current version of ThriftRW during initialization.
- Breaking: The
compile
API now exposes annotations made while referencing native Thrift types. This changes theTypeSpec
s for primitive types from values to types. - The
compile
API now also exposes annotations fortypedef
declarations. - Generate args structs and helpers for oneway functions.
- Breaking: Remove the
--yarpc
flag. Install the ThriftRW YARPC plugin fromgo.uber.org/yarpc/encoding/thrift/thriftrw-plugin-yarpc
and use--plugin=yarpc
instead.
0.3.2 - 2016-10-05
- Fix import paths for code generated using
--yarpc
. Note that this flag will be removed in a future version.
0.3.1 - 2016-09-30
- Fix missing canonical import path to
go.uber.org/thriftrw
.
0.3.0 - 2016-09-29
- Breaking: Renamed project to
go.uber.org/thriftrw
. - Breaking: Keywords reserved by Apache Thrift are now disallowed as identifiers in Thrift files.
- Breaking: The
Package
field of theplugin.TypeReference
,plugin.Service
, andplugin.Module
structs was renamed toImportPath
.
0.2.1 - 2016-09-27
- Plugin templates: Imports in generated code are now always qualified if the package name doesn't match the base name.
- Plugin templates: Fixed a bug where imports in templates would use the base
name of the package even if it had a hyphen in it if it wasn't available on
the
GOPATH
.
0.2.0 - 2016-09-09
-
Added a
-v
/--version
flag. -
Added a plugin system.
ThriftRW now provides a plugin system to allow customizing code generation. Initially, only the generated code for
service
declarations is customizable. Check the documentation for more details.
- Breaking: The
String()
method forenum
types now returns the name of the item as specified in the Thrift file.
- Breaking: Fixed a bug where all-caps attributes that are not known abbreviations were changed to PascalCase.
- Initial release.