2.0.0-rc.3 - A bag of improvements
Pre-release
Pre-release
oscartbeaumont
released this
26 Sep 15:14
·
137 commits
to main
since this release
Features:
- Helpers for JSDoc comment exporting (still undocumented and untested)
- Support for
(T,)
tuples. Turns out(T)
and(T,)
are completely different types.
Important Breaking Changes:
- Drop
typescript
as a default feature. You will now need to gospecta = { version = "...", features = ["typescript"] }
to use thespecta::ts
andspecta::export::ts
modules.
Other Breaking Changes:
- Drop
serde
as default feature. It's now temporarily undertypescript
. I would recommend adding it manually if your using Specta with Serde as I will likely drop this in the future for now Specta's Typescript exporter is not ready for it to be dropped. - Rename
conf
tocfg
onExportContext
- Rename
TsExportError
toExportError
- Drop
thiserror
feature, it was a no-op anyway. You can use Specta fine with thiserror but it doesn't require us to do stuff. - Move
specta::ts::js_doc
tospecta::ts::comments::js_doc
. This was just a mistake. - Remove
Into<TupleType> for T where T: DataTypeFrom
. You can useInto<DataType> for T
instead. EnumVariant
was renamed toEnumVariants
andEnumVariant
is now a wrapper struct with shared metadata about the variant such asskip
,comments
ordeprecated
.NamedDataType.comments
is nowNamedDataType.docs
and is nowCow<'static, str>
instead ofVec<Cow<'static, str>>
.CommentFormatterFn
now takesCommentFormatterArgs
as an argument to allow handling deprecated attributes.- Breaking changes to
SpectaFunction
's argument to handle deprecated exporting although this type shouldn't be used for anything publically
Fixes:
- Fix a heap of incorrectly handled cases when using
serde(skip)
.- Attribute was ignored on unnamed field of enum variants.
- Move
skip
handling from the macro into the exporter.A(String)
andA(#[serde(skip] (), String)
are different types in TS (string
and[string]
respectively) and the exporter needs to know that.
- Drop dependency on
document-features
andindoc
to make builds slightly quicker and fix issues while vendoring Specta - Fix
pub struct A((String))
orpub enum A { A((String)) }
causing the macro to error out. - Reject invalid names when doing
#[specta(rename = "name")]
on a container (struct
orenum
). Eg. names containing@
- Fix
#[specta(rename = "@demo")
not working due to an issue with the way the macro processed strings for therename
attribute. - Fix the combination of
#[specta(inline, transparent)]
on a struct that also has#[specta(optional)]
on the single field. It would previously act as if#[specta(optional)]
was not applied.