Skip to content

coffeejson-swift 2.0.0

Choose a tag to compare

@ken0nek ken0nek released this 04 Dec 07:05
· 4 commits to main since this release

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.