- Add support for
#[serde(rename_all_fields)]
(#35).
- Export
Blob
newtype wrapper aroundVec<u8>
which has the Typescript typeBlob
. - Replace unmaintained
proc-macro-error
dependency withproc-macro-error2
(#34).
- Add
TypeDef
impl forIpv4Addr
andIpv6Addr
(#31).
- Add
TypeDef
impl forchar
(#30).
- Add
TypeDef
impl forstd::net::IpAddr
(#29).
- Add basic formatting (indentation and spacing) to emitted TypeScript code to make it more readable (#25).
- Fix an issue where doc-comments were emitted on both the type definition and the object for structs, as well as an issue where doc-comments meant for a type definition could be emitted on the namespace instead (#20).
- Add support for
#[serde(flatten)]
on enum variant fields.
- Fix
TypeDef
impls forHashMap
andHashSet
to allow any hasher generic parameter (#16).
- Add
TypeDef
impls for more string types (PathBuf
,Path
,CString
,CStr
,OsString
,OsStr
).
- Fix issue where unsupported serde attributes would panic the derive macro (#10).
- Fix that
TypeDef
impls on references (&'static T
,Box<T>
,Cow<'static, T>
, andPhantomData<T>
) didn't work with unsized values.
- Fix panic in
#[derive(TypeDef)]
when a struct or enum variant used an empty field list like{}
or()
- (breaking) Change
TypeDef
impl forserde_json::Value
to be more precise. Previously, this was typed asunknown
. Now, its type accepts only valid JSON values (null | boolean | number | string | JSONValue[] | { [key: string]: JSONValue; }
). This new type is more narrow, so this is a breaking change. - (breaking) Add
index_signature
field toTypeObject
for describing object index signatures. - Change CI to enable all features
- Add
TypeDef
impl forResult<T, E>
- Add
write_definition_file_from_type_infos
for generating definitions from a runtime list of type information
- Add
TypeDef
impls forserde_json
types under crate featurejson_value
- Make
DefinitionFileOptions::root_namespace
optional (breaking change), see docs for warning about usingNone
- Add
TypeInfo::write_ref_expr
for generating code that references types generated bywrite_definition_file
, see docs for usage
- Add
#[type_def(type_of = "T")]
attribute to better support using foreign types, see docs for usage
-
Breaking changes to
TypeInfo
to properly support genericsSupport for defining type information for generic Rust types was added in v0.2.2, but the implementation was incorrect. Generic Rust types would have non-generic TypeScript definitions emitted for each specific instance of the type used, all under the same name. Now, exactly one generic type definition is emitted. In order to implement this properly, the
TypeInfo
type has changed slightly to support generic types. If you've been using theTypeDef
derive macro, the changes should not affect you. If you need to implementTypeDef
for generic types manually, please refer to the documentation of theDefinedTypeInfo
struct for important implementation requirements.
- Add changelog
- Document serde attribute support
- Support
#[serde(default = "default_fn")]
- Support generic types in derive macro
- Support
#[serde(skip)]
on fields and variants in derive macro - Support
#[serde(rename)]
on types, fields, and variants in derive macro
- Some changes to
TypeInfo
structure - Internal performance improvements
- Support multi-line custom header for generated file
Initial release