Repository navigation
Releases
coffeejson-swift 2.1.0
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\Sreads.
The import trims other human text by the same rule.
Fixed
SchemaValidatorreads\sand\Sin apatternas ECMA-262 does. It
accepted a title of U+FEFF alone and refused one of U+0085 alone.
coffeejson-swift 2.0.0
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_waterwas stated in.
ImportedPourStep.cumulativeWaterGrams: Doubleis replaced by
cumulativeWater: WaterTarget, an enum with.grams(Double)for a mass
(gram, orouncein canonical grams) and.milliliters(Double)for a
volume. A step withat_sand ato_waterinmilliliteris 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 setsDerivedQuantities.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.roastAgtronandImportedBean.roastAgtronare
Double?. They wereInt?, so a bean stating a valid fractional Agtron
number such as62.5, which the schema allows, failed to import. A reader
that formats the value for display chooses its own number of decimals. -
GearLabelsfollows the registry's corrected ids and labels. An id that
1.1.1 carried and the registry renamed, such astimemore-c3, still
resolves as an alias, under the new label.toddyandwafo-basketare
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.ShareLinkremoves ASCII whitespace (space, tab, line
feed, form feed, carriage return) from thedvalue 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 vectorsstandard-alphabet,whitespace-in-payload,over-paddedand
stray-characterpin the rule, and the package runs them.
Added
GearLabelscarries 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 whosetitleis whitespace alone, as it did, and
SchemaValidatorrejects both the blank recipe title and the blank
localization title through the schema'spattern. 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
NOTICEfile carries the copyright and MIT permission notice of
ajv-formats, whoseuriregular expressionSchemaValidatorcopies. The
package shipped that expression without the notice since 1.1.1.
coffeejson-swift 1.1.1
Reads and writes CoffeeJSON 1.1, and follows the spec where decoding, units
and the schema validator diverged from it.
Fixed
ImportedTasting.extractionYieldPercentno 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.decodeDocumentapplies 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
watercarries a unit the package does not recognize reads
as stating no water, as the spec requires. It imports throughratiowhen
it states one and otherwise fails with.missingRequiredField("water").
It used to import withwaterStatedByVolumeset and no volume. SchemaValidatorassertsformat: uri, as the format's own harness does.
Aurlorbased_onthat 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
ounceconverts 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.foundationUnitstill names Foundation's ounce.
Changed
-
The doc comment on
Party.rolesays a role may appear on any credit, an
authoror aroasteras well as a producer. It said a role was absent on
those two. -
ImportError.Kind.allCaseslists the twelve kinds in the order of the
format's error table, with.notAURLand.notHTTPlast. They were first.
coffeejson-swift 1.1.0
Reads and writes CoffeeJSON 1.1.
Added
Gear.variantsays 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.brewerandImportedRecipe.grindergive the gear as the
document states it, so an app can show its own label for a registered id.GearLabelsholds the gear registry's display labels, keyed by language
tag.GearLabels.forLanguage(_:)narrows a tag such asja-JPtoja,
then falls back toen.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.currentVersionis"1.1".ImportedRecipe.brewerLabelandImportedRecipe.grindDescriptionresolve a
registered id to the registry's label and showvariantbeside it. For
customand an unknown id, they show the statedlabelas written. Without
alabel, they showbrandandmodel, then the id itself. In 1.0.0 they
showed the statedlabelfirst for every id.
coffeejson-swift 1.0.0
The first release. Reads and writes CoffeeJSON 1.0.