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.
0.13.1 - 2024-04-03
- Fixed resolution of field types when the type name is the same as the field name (#99)
0.13.0 - 2024-02-07
- The minimum supported rust version is now 1.70.0.
- Updated the miette dependency to version 7.0.0.
0.12.0 - 2023-09-01
- The minimum supported rust version is now 1.64.0.
- Updated to prost 0.12.0
- When adding files to a
DescriptorPool
, the library now validates that all referenced types are contained within the dependency files (including files imported usingimport public
). Fixes #57.
0.11.5 - 2023-08-29
- Added new APIs for getting and clearing message fields:
DynamicMessage::fields
Gets an iterator over all fields of this message.DynamicMessage::fields_mut
Gets an iterator returning mutable references to all fields of this message.DynamicMessage::take_fields
Clears all fields from the message and returns an iterator yielding the values.DynamicMessage::extensions
Gets an iterator over all extension fields of this message.DynamicMessage::extensions_mut
Gets an iterator returning mutable references to all extension fields of this message.DynamicMessage::take_extensions
Clears all extension fields from the message and returns an iterator yielding the values.DynamicMessage::take_field
Clears the value for the given field, and returns it.DynamicMessage::take_field_by_name
Clears the value for the field with the given name, and returns it.DynamicMessage::take_field_by_number
Clears the value for the field with the given number, and returns it.DynamicMessage::take_extension
Clears the value for the given extension field and returns it.
- Added new APIs for inspecting unknown fields of a message.
DynamicMessage::unknown_fields()
Gets an iterator over unknown fields for this message.DynamicMessage::take_unknown_fields()
Clears all unknown fields from the message and returns an iterator yielding the values.UnknownField
An unknown field found when deserializing a protobuf message..
0.11.4 - 2023-04-28
- Monomorphised some code in
DescriptorPool::add_*
methods to reduce binary size. Thanks to @srijs for #40 and #41. - Source code info is now omitted from the built-in descriptors for well-known types. This reduces the binary size by around 100KB.
0.11.3 - 2023-04-11
- Updated logos dependency to 0.13.0.
0.11.2 - 2023-04-09
- Adjusted the
Debug
implementation forDescriptorError
to be more concise and readable.
- Fixed parsing of group fields from text format. The field name must now match the type name of the group field.
0.11.1 - 2023-04-05
- Added
Kind::wire_type
. Thanks to @slinkydeveloper for #34
0.11.0 - 2023-03-27
- Added a global descriptor pool which can be fetched using
DescriptorPool::global()
. By default it just contains well-known types, but additional files can be added usingDescriptorPool::decode_global_file_descriptor_set()
andDescriptorPool::add_global_file_descriptor_proto()
. (#13) - prost-reflect-derive Added the
file_descriptor_set_bytes
attribute as an alternative todescriptor_pool
, which automatically registers the file with the global pool. - prost-reflect-build Added
Builder::file_descriptor_pool_bytes
to set thefile_descriptor_set_bytes
derive attribute.
- Duplicate files are now always ignored when adding to a
DescriptorPool
(previously, the code would skip files with identical contents, but now it skips any file with the same name). - prost-reflect-derive Update syn requirement from 1.0.84 to 2.0.3
- prost-reflect-build Breaking Renamed
Builder::file_descriptor_expr
toBuilder::descriptor_pool
. - prost-reflect-build Breaking Removed the default behaviour of looking for the file descriptor under
crate::DESCRIPTOR_POOL
. One ofdescriptor_pool
orfile_descriptor_pool_bytes
must be set explicitly.
0.10.3 - 2023-03-20
- Fixed type resolution for double fields. Thanks to @jackkleeman for #29
0.10.2 - 2023-02-17
- Updated the base64 dependency to version 0.21.0.
- If the
json_name
property for a field is unset, it will now be populated with the camel-cased field name (#5).
0.10.1 - 2023-01-07
- The path for repeated extension options now includes the array index (for consistency with the output of protoc).
0.10.0 - 2023-01-04
- Added the
path()
method to all descriptor types, which returns a path that can be used to get source code info by comparing againstLocation::path
. - Added the
options()
method to all descriptor types, which returns a message containing the options defined for the descriptor, including custom options. - The
uninterpreted_options
field of options is now used to populate options if it is present.- Note that if the
text-format
feature flag is not enabled, then options set through theaggregate_value
field will be ignored.
- Note that if the
- Added several new validation checks when constructing a
DescriptorPool
instance. - Added new
file()
,line()
andcolumn()
methods to get more context information about errors. - When the
miette
feature is enabled,DescriptorError
now implementsDiagnostic
. When source code is provided throughDescriptorError::with_source_code
, and span information is provided inFileDescriptorProto::source_code_info
, then the error will have labels annotating relevant portions of the source.
- The minimum supported rust version is now 1.60.0.
- Breaking: The
FileDescriptor::dependencies
now returns all imported files, instead of just those imported withimport public
. The newpublic_dependencies
method preserves the old behaviour (#19). - Breaking: The
reflect-well-known-types
feature flag has been removed, and the functionality is now always available. - Updated the base64 dependency to version 0.20.0.
0.9.2 - 2022-08-14
- Added support for parsing and formatting dynamic messages using the text format. This functionality is enabled with the new
text_format
feature flag. SeeDynamicMessage::parse_text_format
andDynamicMessage::to_text_format
. - Added a
Display
implementation forDynamicMessage
andValue
which uses the text format. This is available even when thetext_format
feature is disabled. - Added new methods for setting dynamic message fields without panicking:
try_set_field
,try_set_field_by_number
andtry_set_field_by_name
- Added
Value::into_map_key()
0.9.1 - 2022-08-01
- Fixed docs build
0.9.0 - 2022-07-30
- Added
MessageDescriptor::get_extension_by_full_name()
.
- Updated to prost 0.11.0
- When the
serde
feature is enabled, the functions inprost-types
for parsing and formatting time types are now used. This removes thetime
dependency. - The minimum supported rust version is now 1.56.0.
0.8.1 - 2022-05-29
- Added the
FileDescriptor
API for inspecting individual protobuf files. - Added methods to
MessageDescriptor
to get child messages, enums and extensions.
0.8.0 - 2022-05-09
DescriptorPool
(formerlyFileDescriptor
) now supports adding individualFileDescriptorProto
instances (#6).
- Breaking:
FileDescriptor
has been renamed toDescriptorPool
. (The nameFileDescriptor
may be used in a future release to provide an API for inspecting individual source files)FileDescriptor::new
has been renamed toDescriptorPool::from_file_descriptor_set
.FileDescriptor::file_descriptor_set
has been replaced byDescriptorPool::file_descriptor_protos
to allow for it containing multiple sets of descriptors.- The
parent_file
method on all descriptor types has been renamed toparent_pool
. - The
file_descriptor
parameter of theReflectMessage
derive macro has been renamed todescriptor_pool
. - The default value of the descriptor pool expression for
prost-reflect-build
is changed fromcrate::FILE_DESCRIPTOR
tocrate::DESCRIPTOR_POOL
.
0.7.0 - 2022-04-03
- Updated to version
0.10.0
of prost.
0.6.1 - 2022-02-27
- The public dependencies
prost
,prost-types
andbytes
are now re-exported from the crate root.
0.6.0 - 2022-02-20
- Added implementations of [
ReflectMessage
] for the google well-known types inprost-types
, behind a feature flagreflect-well-known-types
.
- The minimum supported rust version is now 1.54.0.
0.5.7 - 2022-02-14
- Added
file_descriptor_proto
methods to descriptor types to access raw details about the file the object is defined in.
0.5.6 - 2022-02-03
- Fixed handling of enums with the
allow_alias
option (see #9).
0.5.5 - 2022-02-01
- Added
MessageDescriptor::descriptor_proto
and friends to get the rawprost_types
representation of protobuf definitions.
0.5.4 - 2022-02-01
- Replace
chrono
dependency withtime
for parsing and formatting RFC 3339 timestamps when theserde
feature is enabled. This avoids security vulnerabilities RUSTSEC-2020-0071 and RUSTSEC-2020-0159 which are not yet patched inchrono
.
0.5.3 - 2022-01-18
0.5.2 - 2022-01-09
DynamicMessage
now stores all fields (normal, extensions, and unknown) in the same storage, reducing its footprint from 48 bytes to 40.
0.5.1 - 2022-01-05
- Added
DynamicMessage::get_field_mut
and friends for in-place modification of messages.
0.5.0 - 2022-01-05
- Extension fields are now decoded from their byte representation
- Added APIs to get extensions for a given message.
DynamicMessage::get_extension
no longer returns an option.
0.4.0 - 2022-01-04
- New helper method
DynamicMessage::decode
. - New APIs to get reserved names and fields for messages and enums
- New descriptor APIs to inspect extension fields
- New dynamic message APIs to get and set extension fields
- Renamed
SerializeOptions::emit_unpopulated_fields
toSerializeOptions::skip_default_fields
(note the meaning is inverted as well!). DynamicMessage::{has_field,get_field,set_field,clear_field}
now take a field descriptor instead of a number. Use the new_by_number
variants for the old behavior.
-
The library now passes the protobuf conformance tests. This uncovered a number of edge cases:
- Fixed unpacked fields not accepting packed bytes
- Unknown fields are now preserved and roundtripped.
- Fixed default value for enums with negative values
- When receiving multiple fields of a oneof in the byte representation, only the last is set.
- Trailing zeros (e.g.
10.00
) are now accepted when parsing integers from the JSON representation. - Fixed handling of
null
in JSON deserialization. - Deserialization of
google.protobuf.NullValue
now accepts the"NULL_VALUE"
string. - Deserialization of floats from JSON now validates the value is in range.
- Nonzero trailing bits are allowed when deserializing JSON bytes from base64.
- Serialization of
google.protobuf.FieldMask
fails if the path cannot be roundtripped through camelCase. google.protobuf.Duration
uses a different number of trailing zeroes depending on the precision of the input.- JSON serialization of
google.protobuf.Timestamp
andgoogle.protobuf.Duration
fails if it is outside the allowed range. - Duplicate oneof fields is now an error during JSON deserialization
- Extensions are roundtripped though JSON format
0.3.5 - 2022-01-02
- Fixed deserialization of negative durations
0.3.4 - 2022-01-01
- Added
MessageDescriptor::map_entry_key_field
andMessageDescriptor::map_entry_value_field
to help with inspecting message types. - Added
Value::is_valid_for_field
to validate that value types are compatible with message fields. DynamicMessage::set_value
now asserts that the value type is compatible with the field type.
- Fixed
FieldDescriptor::is_packed
returning true for non-repeated fields.
0.3.3 - 2021-12-30
- Added support for JSON mapping of
google.protobuf.Any
.
0.3.2 - 2021-12-29
- Builder methods on
SerializeOptions
andDeserializeOptions
are nowconst
.
- Fixed a case where serialization could produce invalid JSON.
0.3.1 - 2021-12-29
- Fixed docs for
ReflectMessage
macro.
0.3.0 - 2021-12-29
- Added
parent_message()
method toMessageDescriptor
andEnumDescriptor
to support inspecting the structure of nested types. - Added
package_name()
method toMessageDescriptor
,EnumDescriptor
andServiceDescriptor
to determine which package they are defined in. - Added
ReflectMessage
trait for types which can identify themselves with aMessageDescriptor
. - Added a derive macro which can be used as part of
prost_build
to generateReflectMessage
implementations.
- Renamed
merge_from_message
totranscode_from
andto_message
totranscode_to
.
0.2.0 - 2021-12-27
- Added support for serializing and deserializing with serde. By default the serialization format is the canonical JSON encoding.
0.1.0 - 2021-12-26
- Initial release, including support for inspecting message types at runtime.