Skip to content

2.0.0-rc.3 - A bag of improvements

Pre-release
Pre-release
Compare
Choose a tag to compare
@oscartbeaumont 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 go specta = { version = "...", features = ["typescript"] } to use the specta::ts and specta::export::ts modules.

Other Breaking Changes:

  • Drop serde as default feature. It's now temporarily under typescript. 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 to cfg on ExportContext
  • Rename TsExportError to ExportError
  • 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 to specta::ts::comments::js_doc. This was just a mistake.
  • Remove Into<TupleType> for T where T: DataTypeFrom. You can use Into<DataType> for T instead.
  • EnumVariant was renamed to EnumVariants and EnumVariant is now a wrapper struct with shared metadata about the variant such as skip , comments or deprecated.
  • NamedDataType.comments is now NamedDataType.docs and is now Cow<'static, str> instead of Vec<Cow<'static, str>>.
  • CommentFormatterFn now takes CommentFormatterArgs 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) and A(#[serde(skip] (), String) are different types in TS (string and [string] respectively) and the exporter needs to know that.
  • Drop dependency on document-features and indoc to make builds slightly quicker and fix issues while vendoring Specta
  • Fix pub struct A((String)) or pub enum A { A((String)) } causing the macro to error out.
  • Reject invalid names when doing #[specta(rename = "name")] on a container (struct or enum). Eg. names containing @
  • Fix #[specta(rename = "@demo") not working due to an issue with the way the macro processed strings for the rename 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.