Skip to content

Releases

coffeejson-swift 2.1.0

Choose a tag to compare

@ken0nek ken0nek released this 04 Dec 07:05
579a4a8

Writes CoffeeJSON 1.2: Codec.currentVersion is "1.2", and Codec.encode
stamps it.

Changed

  • A recipe title of U+FEFF alone now fails the import as a missing title, and
    one of U+0085 alone imports: whitespace is the set the schema's \S reads.
    The import trims other human text by the same rule.

Fixed

  • SchemaValidator reads \s and \S in a pattern as ECMA-262 does. It
    accepted a title of U+FEFF alone and refused one of U+0085 alone.

coffeejson-swift 2.0.0

Choose a tag to compare

@ken0nek ken0nek released this 04 Dec 07:05

Reads and writes CoffeeJSON 1.1. The major is this package's API: the
coffeejson wire version it reads and writes is unchanged.

Changed

  • Breaking. A pour step keeps the dimension its to_water was stated in.
    ImportedPourStep.cumulativeWaterGrams: Double is replaced by
    cumulativeWater: WaterTarget, an enum with .grams(Double) for a mass
    (gram, or ounce in canonical grams) and .milliliters(Double) for a
    volume. A step with at_s and a to_water in milliliter is now a timed
    pour. It was a read-only step with its water gone, though the spec says a
    consumer must schedule water off that pair. A windowed volume schedules on
    its midpoint and sets DerivedQuantities.steps, as a windowed mass does.
    To migrate, read the case where you read grams, and decide what a volume
    step means to you:

    // Before
    let grams = step.cumulativeWaterGrams
    ImportedPourStep(atSeconds: 0, cumulativeWaterGrams: 30)
    
    // After
    guard case .grams(let grams) = step.cumulativeWater else {
        // a volume: convert by your own model and show it as converted, or skip
        return
    }
    ImportedPourStep(atSeconds: 0, cumulativeWater: .grams(30))
  • Breaking. Bean.roastAgtron and ImportedBean.roastAgtron are
    Double?. They were Int?, so a bean stating a valid fractional Agtron
    number such as 62.5, which the schema allows, failed to import. A reader
    that formats the value for display chooses its own number of decimals.

  • GearLabels follows the registry's corrected ids and labels. An id that
    1.1.1 carried and the registry renamed, such as timemore-c3, still
    resolves as an alias, under the new label. toddy and wafo-basket are
    gone, because neither names one product. Gear.displayLabel(using:) treats
    them as unregistered ids.

Fixed

  • A share link whose payload a mail client, chat app or text recognition
    wrapped now imports. ShareLink removes ASCII whitespace (space, tab, line
    feed, form feed, carriage return) from the d value before it decodes, and
    ignores trailing = padding. It already read the standard Base64 alphabet.
    Any other character in the payload is still .malformedBase64. The format's
    scan vectors standard-alphabet, whitespace-in-payload, over-padded and
    stray-character pin the rule, and the package runs them.

Added

  • GearLabels carries 180 more entries that the gear registry now lists,
    among them ten scales and nine kettles. No recipe member takes a
    scale or a kettle, so this adds their labels and no API.
  • The test suite runs the format's two blank-title fixtures. The import
    rejects a recipe whose title is whitespace alone, as it did, and
    SchemaValidator rejects both the blank recipe title and the blank
    localization title through the schema's pattern. The import does not read
    localizations, so a document whose only fault is a blank localized title
    still imports, with the recipe's own title.
  • A NOTICE file carries the copyright and MIT permission notice of
    ajv-formats, whose uri regular expression SchemaValidator copies. The
    package shipped that expression without the notice since 1.1.1.

coffeejson-swift 1.1.1

Choose a tag to compare

@ken0nek ken0nek released this 04 Dec 07:05

Reads and writes CoffeeJSON 1.1, and follows the spec where decoding, units
and the schema validator diverged from it.

Fixed

  • ImportedTasting.extractionYieldPercent no longer uses the recipe's target
    yield when the tasting carries a measured yield it cannot read as one mass,
    a window or an unrecognized unit. It derives nothing instead, because the
    spec takes the beverage mass from the tasting whenever it carries one.
  • Codec.decodeDocument applies the version gate before it decodes any
    collection. A document of another major now reports .unsupportedVersion
    even when its recipes, beans or tastings have a shape this major does not
    read, where it used to report a field of that shape.
  • A recipe whose water carries a unit the package does not recognize reads
    as stating no water, as the spec requires. It imports through ratio when
    it states one and otherwise fails with .missingRequiredField("water").
    It used to import with waterStatedByVolume set and no volume.
  • SchemaValidator asserts format: uri, as the format's own harness does.
    A url or based_on that is not a URI now fails the gate, where it used to
    pass it. The fixture corpus rejects four documents on that keyword alone.
  • An ounce converts to grams at the format's 28.349523125 g, where it used
    Foundation's 28.3495 g. A recipe stated as 1 oz to 15 oz now has a ratio of
    exactly 15. KnownMassUnit.foundationUnit still names Foundation's ounce.

Changed

  • The doc comment on Party.role says a role may appear on any credit, an
    author or a roaster as well as a producer. It said a role was absent on
    those two.

  • ImportError.Kind.allCases lists the twelve kinds in the order of the
    format's error table, with .notAURL and .notHTTP last. They were first.

coffeejson-swift 1.1.0

Choose a tag to compare

@ken0nek ken0nek released this 04 Dec 07:05

Reads and writes CoffeeJSON 1.1.

Added

  • Gear.variant says which member of a registered family a piece of gear is,
    for example a size, a material or a generation. The package reads it and
    writes it.
  • ImportedRecipe.brewer and ImportedRecipe.grinder give the gear as the
    document states it, so an app can show its own label for a registered id.
  • GearLabels holds the gear registry's display labels, keyed by language
    tag. GearLabels.forLanguage(_:) narrows a tag such as ja-JP to ja,
    then falls back to en.
  • Gear.displayLabel(using:) renders one piece of gear as a display string.
    Pass your own labels to show a registered id in your locale.

Changed

  • Codec.currentVersion is "1.1".
  • ImportedRecipe.brewerLabel and ImportedRecipe.grindDescription resolve a
    registered id to the registry's label and show variant beside it. For
    custom and an unknown id, they show the stated label as written. Without
    a label, they show brand and model, then the id itself. In 1.0.0 they
    showed the stated label first for every id.

coffeejson-swift 1.0.0

Choose a tag to compare

@ken0nek ken0nek released this 04 Dec 07:05

The first release. Reads and writes CoffeeJSON 1.0.