Skip to content

Release v0.3.0

Compare
Choose a tag to compare
@chrisrink10 chrisrink10 released this 07 May 14:33
· 4 commits to master since this release
8f33c5d

Added

  • Add s.dict_tag as a convenience factory for building mapping specs for which
    the value spec tags are derived automatically from the corresponding dict keys (#52)
  • Add documentation built using Sphinx and hosted on ReadTheDocs (#9)
  • Add a regex validator to the s.bytes factory (#37)
  • Added Spec.compose_conformer to allow composition of new conformers with existing
    conformers (#65)
  • Added s.merge to allow seamless merging of mapping Specs (#70)
  • Added ErrorDetails.as_map to convert ErrorDetails instances to simple dicts (#79)
  • Added s.kv to validate and conform generic key/value mapping types (#71)

Changed

  • Breaking Spec.with_conformer will now replace the default conformer applied
    to a Spec instance. Previously, most default conformers were applied using the
    private Spec._default_conform method. To emulate the previous behavior, you
    can use Spec.compose_conformer, which will compose your conformer after any
    existing conformers on a Spec instance and return a copy with that composition.
    (#65)
  • s.all and s.and now return the result of calling s(tag, pred, conformer) if
    passed only one predicate (#72)
  • Breaking ErrorDetails.via now only includes user-defined (or default) tags.
    Previously, Spec factories such as s.str would inject tags for child validators
    such as str_matches_regex into via, making it difficult to programmatically
    determine which Spec the input value violated (#78)
  • Mapping spec default conformers will now use the same key insertion order as the
    original mapping spec predicate. Optional keys will now retain their insertion
    position, rather than being appended at the end of the conformed map. (#82)

Fixed

  • Fixed a bug where s(None) is not a valid alias for s(type(None)) (#61)
  • Fixed a bug where it was possible to define duplicate keys in mapping Specs with
    s.opt(k) (#74)
  • Fixed a bug where string Spec factory error message for values which do not match
    a regex incorrectly indicates that the string does match the regex (#77)

Removed

  • Breaking Removed register_str_format_spec; use register_str_format to
    register new string formats for s.str(format_="...") (#78)