Repo-level information for github.com/go-openapi/conformance-suites.
Contributing guidelines and maintainer documentation are shared across the
go-openapi organization.
Subsections of go-openapi conformance suites
Getting started
A conformance suite is a corpus of test cases, published as a single file.
You can read it with any JSON reader and a base64 decoder, and score your parser, written in any language.
Go users can also import this module, to run the oracles or the generators, or to load the small corpus
embedded in the module without downloading anything.
Seed a Go fuzz target with a corpus, and draw YAML documents for property tests with rapid.
Subsections of Getting started
Read a corpus
A corpus is one file. This page reads it with jq and with Python, and turns a case into an expected outcome
without the Go packages. File format lists every field.
Get a corpus file
Each release tag holds the compact corpus of each suite, at a fixed path in the repository:
suite
file
JSON
json/testdata/json-compact.jsonl.gz
YAML
yaml/corpus/testdata/yaml-compact.jsonl.gz
Download a file at a release tag, so your tests read the same cases until you choose to move:
The releases page lists the tags. The header records
what built the file: gunzip -c yaml-compact.jsonl.gz | head -1 | jq '{tier, cases, generator, digest}'.
Note
Releases do not attach corpus files yet. The plan is for each release to attach the compact and extended corpora
of both suites, with a checksum list. Until then, the tag is the way to pin a corpus.
@base64d writes text, so use it only on documents that are valid UTF-8. For the bytes of any case, pipe .src
to base64 -d.
Read it in another language
Any language with gzip, JSON and base64 can read a corpus. In Python:
import base64
import gzip
import json
with gzip.open("json-compact.jsonl.gz", "rt", encoding="utf-8") as f:
header = json.loads(f.readline())
if header["format"] !=4:
raiseSystemExit(f"unsupported format {header['format']}")
cases = [json.loads(line) for line in f]
if len(cases) != header["cases"]:
raiseSystemExit(f"truncated: {len(cases)} of {header['cases']} cases")
forcasein cases:
src = base64.b64decode(case["src"])
tags =case.get("tags", [])
# score src here
The example checks the format first and the length last, as File format
asks.
Check the vocabulary
Before you score anything, read header.vocabulary and decide your parser’s position on every tag in it that
is not settled. A tag you have no position on leaves every case carrying it unscored. A newer corpus can add a
tag, so run this check on every new file.
Turn a case into an expected outcome
You need three things about your parser:
Its stage: how far it takes a document. parse for a parser that only checks syntax, compose for one that
builds a tree and resolves aliases, construct for one that builds native values.
Its stand on each open tag: it accepts such documents, refuses them on purpose, or does not guarantee
either answer.
Which settled rules it declines. A parser that never resolves aliases cannot check a rule about them, and
declines it.
Then work through these steps in order. The first step that gives an answer decides.
Leave out the tags past your stage. A tag whose stage in the header comes later than your parser’s stage
asks nothing of it.
Settled tags. Go through the case’s tags in the order it lists them. For a tag whose spec has settled:
if you decline its rule, the case is not scored;
if settled is reject, expect a rejection;
if settled is accept, the construct is legal and the grammar still decides, so go on.
Open tags. Go through the remaining tags in order:
you refuse it: expect a rejection;
you have no position, or you do not guarantee either answer: the case is not scored;
you accept it, and the case is opaque: the case is not scored, because nothing can say what the bytes
denote without the decoder your parser uses;
you accept it: go on.
The grammar refuses it. If wellFormed is false, expect a rejection. A document that does not parse
does not compose or construct either.
The verdict’s reach.verdictAt is the last stage at which the grammar’s acceptance is evidence. If it is
earlier than your parser’s stage, the case is not scored. An absent verdictAt means parse.
Otherwise, expect acceptance.
A case that is not scored tells nothing about your parser. Skip it, and do not count it as a pass. The Go
package stance runs the same steps in Table.Expect; see Score a parser in Go.
Info
The YAML Test Suite view, a jq filter that writes in.yaml, in.json and error for each case, comes with the
YAML pages.
Score a parser in Go
This page scores the standard library’s json.Valid against the JSON compact corpus embedded in the module.
Replace json.Valid with a call to your own parser.
Install
go get github.com/go-openapi/conformance-suites
The module requires go1.26 or newer.
Load a corpus
jsoncorpus.CompactSuite returns the header and the cases of the compact corpus embedded in the module:
header, cases, err:=jsoncorpus.CompactSuite()
To use a corpus file you downloaded or built, open it and call suite.ReadAll:
You can build the full JSON corpus with jsoncorpus.Full().Write(w).
Declare your parser’s positions
The JSON grammar does not settle everything: a parser may refuse a byte order mark, or accept an unpaired
surrogate escape, and still conform to RFC 8259. Each such property has a tag. A stance.Table records your
parser’s position on every tag:
varstdlib = stance.Table{
Name: "encoding/json Valid",
Because: "checks syntax only, and requires UTF-8 with no byte order mark",
At: stance.Parse,
Speaks: jsoncorpus.Vocabulary(),
Stands: map[stance.Tag]stance.Stand{
stance.TagBOM: stance.Refuses,
stance.TagNotUTF8: stance.Accepts,
stance.TagUTF16: stance.Refuses,
stance.TagUTF32: stance.Refuses,
jsoncorpus.TagLoneSurrogate: stance.Accepts,
jsoncorpus.TagDeepNesting: stance.Refuses,
},
}
Name and Because appear in the reasons that Table.Expect returns.
At is the last stage your parser reaches. json.Valid only checks syntax, so it stops at stance.Parse,
and the corpus does not ask it about number/out-of-range, which arises at stance.Construct.
Speaks gives the stage of each tag. Use the vocabulary of the grammar under test.
Stands gives your position on each tag:
stand
meaning
effect on a case carrying the tag
stance.Accepts
your parser reads such documents
the grammar’s verdict decides
stance.Refuses
your parser rejects them on purpose
the case expects a rejection
stance.Either
your parser does not guarantee either answer
the case is not scored
stance.Undeclared
no position (the zero value)
the case is not scored
Find the positions by measuring your parser, not by reading its documentation. jsoncorpus.DefaultLexer was
built that way, and two of its positions differed from what its authors expected.
Check the vocabulary first
Before you score anything, check that your table covers every tag the corpus uses:
ifunknown:=header.Unknown(stdlib.Speaks.Tags()); len(unknown) > 0 {
returnfmt.Errorf("the corpus uses tags this table does not know: %v", unknown)
}
A tag missing from your table counts as Undeclared, so every case carrying it becomes Undecided. Without
this check, a newer corpus with a new tag would score fewer of your cases and give no warning.
Score every case
Convert each suite.Case to a stance.Doc, ask the table for the expected outcome, and compare it with what
your parser does:
With the table above, json.Valid has no disagreement with the compact corpus.
Read the outcome
Table.Expect returns one of three outcomes, and a reason:
stance.Accept: a conforming parser with your positions reads the document.
stance.Reject: it refuses the document.
stance.Undecided: the case tells nothing about your parser. Skip it, and do not count it as a pass.
A case is Undecided when it carries a tag you did not declare or declared as Either, when the grammar’s
acceptance does not reach the stage your parser stops at, or when the bytes are opaque to the oracle.
With the table above, every Undecided case is opaque: its bytes are not valid UTF-8, json.Valid accepts
some such documents, and the oracle cannot say what they denote. The reason string names the cause:
encoding/not-utf8: encoding/json Valid tolerates this, and nothing here can say what the bytes denote
without the decoder that would read them
Score several modes
A parser with a strict mode and a lenient mode needs two tables, and one corpus. Copy the table, change the
positions that differ, and run the loop once per mode.
Select a subset
Each case lists the constructs it contains in Features. To run only part of a corpus, filter the
stance.Doc values with stance.With or stance.Without. Features never change the expected outcome.
Keep your results in your repository
This module does not ship a test harness or a record of known failures. Keep the scoring loop, your tables
and your list of known disagreements in your own repository, next to your parser.
Fuzz and property tests in Go
Scoring a parser against a corpus checks the cases the corpus holds. A fuzz target and a property test go past
them. The fuzzer mutates the corpus documents, and yamlgen draws new documents for
rapid. In both, the oracle gives the verdict on any document,
so a test can check documents nobody wrote down.
The examples below test go-openapi/go-yaml. Replace yaml.Unmarshal
with your parser’s entry point.
Install
go get github.com/go-openapi/conformance-suites
go get github.com/go-openapi/conformance-suites/yaml/corpus # the embedded YAML corpus, 1.6 MB
go get github.com/go-openapi/conformance-suites/yaml/yamlgen # the YAML generator, which requires rapid
Each is a module of its own, so a test requires only what it uses.
Seed a fuzz target
Add every corpus document as a seed. The corpus already covers the grammar, so the fuzzer starts there and spends
its time on combinations nobody generated.
The check runs in one direction only. A parser that accepts a document the grammar rejects has a defect, unless
you declare that leniency. A parser that refuses a document the grammar accepts may be right: the specification
sets rules beyond the grammar, such as unique keys, and your parser takes positions on the questions it leaves open.
To check that direction too, give each document a verdict with your stance.Table, as
Score a parser does for the corpus cases.
go test without -fuzz runs each seed once: 25,175 distinct documents, about 6 seconds with go-yaml.
With -fuzz, Go first measures the coverage of every seed, which takes about a minute before the fuzzer starts
mutating. Seed a subset, such as the refused cases, to start sooner.
go-yaml’s own fuzz_test.go adds the YAML Test
Suite and the inputs reduced from past bug reports to the same seeds.
JSON
RFC 8259 leaves little to the implementation, so a JSON fuzz target can compare verdicts in both directions:
import (
"encoding/json""testing""unicode/utf8"jsoncorpus"github.com/go-openapi/conformance-suites/json")
funcFuzzValid(f*testing.F) {
_, cases, err:=jsoncorpus.CompactSuite()
iferr!=nil {
f.Fatal(err)
}
for_, c:=rangecases {
f.Add(c.Src)
}
f.Fuzz(func(t*testing.T, src []byte) {
if !utf8.Valid(src) {
return// json.Valid does not check UTF-8: the corpus tags this encoding/not-utf8 }
ifgot, want:=json.Valid(src), jsoncorpus.Text(src).OK; got!=want {
t.Errorf("json.Valid says %v, RFC 8259 says %v:\n%q", got, want, src)
}
})
}
The JSON corpus is embedded in the root module, so this needs no other module.
Draw documents with rapid
yamlgen.Values draws what a document means and yamlgen.Styles draws how to write it. yamlgen.Emit writes a
value in a style, and every document it writes is valid YAML 1.2. Two properties follow, and neither needs an
expected value.
Every style reads the same
Write one value in two styles. A parser must read both documents as the same value.
import (
"bytes""testing""github.com/go-openapi/conformance-suites/yaml/yamlgen""github.com/go-openapi/go-yaml""pgregory.net/rapid")
funcTestEveryStyleReadsTheSame(t*testing.T) {
rapid.Check(t, func(rt*rapid.T) {
value:=yamlgen.Values().Draw(rt, "value")
sa, sb:=yamlgen.Styles().Draw(rt, "style a"), yamlgen.Styles().Draw(rt, "style b")
ifsa.Version!=""||sb.Version!="" {
return// "%YAML 1.1" changes what some spellings mean }
a, b:=yamlgen.Emit(value, sa), yamlgen.Emit(value, sb)
varva, vbanyea, eb:=yaml.Unmarshal([]byte(a), &va), yaml.Unmarshal([]byte(b), &vb)
switch {
caseea!=nil&&eb!=nil:
return// the parser refuses this value in any style: a position, not a presentation defectcaseea!=nil||eb!=nil:
rt.Fatalf("one style refused:\n%s\nerror: %v\n\nthe other:\n%s\nerror: %v", a, ea, b, eb)
}
// Compare what the parser writes back: one value has one canonical form.ca, _:=yaml.Marshal(va)
cb, _:=yaml.Marshal(vb)
if !bytes.Equal(ca, cb) {
rt.Fatalf("one value, two readings:\n%s\nreads as\n%s\n%s\nreads as\n%s", a, ca, b, cb)
}
})
}
Three choices keep this property free of false failures:
A style that declares %YAML 1.1 is skipped. Under YAML 1.1, << is a merge key and some plain spellings
resolve to other types, so the two documents can mean different things.
A value that both styles fail to read is skipped. go-yaml, for example, refuses a mapping as a key when it reads
into any. That is a position the parser takes, and it does not depend on the style.
The two readings are compared through yaml.Marshal. Comparing Go values directly fails on NaN, and printing
them shows the addresses of pointers such as *big.Float.
No broken document is accepted
yamlgen.Mutate breaks a valid document. Many mutations leave a document that is still valid YAML, so ask the
oracle first, and keep only the documents it rejects.
how names the mutation, such as a-document-marker-inside, so a failure tells you what kind of break the parser
missed.
When a property fails
rapid shrinks the drawn value and style to a small failing case, and prints a -rapid.failfile flag that replays
it. Raise the number of draws with -rapid.checks: the default is 100, and the rarer shapes appear only after
thousands of draws.
go-yaml’s tests go further. They compare each document with the value the generator meant (yamlgen.Write
returns it as Written.Means), and they keep a ledger of known divergences (yamlgen.Divergence), so that a known
defect does not stop the run and a fixed one is noticed.
Concepts
The concepts that ship with a document in our corpus: coverage, oracle, tags and stances.
What a document denotes, under each reading that has an answer.
Subsections of Concepts
The oracle
Every case in a corpus carries wellFormed, the verdict of an oracle: a recognizer compiled from the grammar the
specification publishes. This page explains why the corpus needs one, where the grammars come from, and what the
oracle returns.
Why a generated corpus needs an oracle
The generator writes a valid document, then breaks it with a mutation: it deletes a byte, swaps two, truncates
the text. The generator cannot tell whether the result is still valid. In JSON, most mutations break the
document. In YAML, most do not: a: b with a byte deleted is a:b, a plain scalar, and still valid YAML. So
each document needs a label from something that knows the language.
Why not an existing parser
A corpus labelled by a parser stores that parser’s answers. Every other parser would then be scored against
its bugs, and the parser itself would always score perfectly. The oracle instead reads the grammar that the
specification publishes, so a disagreement between a parser and the corpus points at one of two documents: the
parser or the grammar.
The oracle also separates two faults that a round trip cannot. When parse(render(value)) fails, the renderer
may have written invalid text, or the parser may have refused valid text. Asking the oracle about
render(value) tells which.
The YAML grammar is a parameterized PEG. Its rules take up to four arguments: the indentation n, the extra
indentation m, the context c (such as block-in or flow-key) and the chomping t. Its notation adds
ordered choice, lookahead in both directions, lookbehind and character-set subtraction. JSON needs none of the
parameters, but uses the same format, so one compiler serves both.
What the oracle returns
res:=yamlcorpus.Stream(src) // or jsoncorpus.Text(src)res.OK// whether the whole input matches the grammar
Result holds the verdict and two counters, Steps and Hits, which measure the work done. The oracle builds
no tree, emits no events and returns no error message. It only has to be right, so it skips everything a parser
spends its time on.
function
question
yamlcorpus.Stream
is src a valid YAML 1.2 stream (l-yaml-stream, from block-in)?
yamlcorpus.FlowNode
is src exactly one flow node (ns-flow-node, from flow-out)?
jsoncorpus.Text
is src exactly one JSON text?
NewRecognizer(hint)
a reusable oracle, for a caller that checks documents in a loop
The verdict covers syntax only. YAML sets rules the grammar cannot express, such as an alias naming an anchor
that occurs earlier, and a parser that composes the document must check them too. The corpus records how far the
verdict reaches in verdictAt: see Tags and stances.
Patches to the YAML grammar
The YAML specification states some rules in its prose and leaves them out of the grammar file. Compiling the file
as published would accept documents YAML forbids, or refuse documents it allows. So yamlcorpus applies
13 patches before compiling. Each names the rule it rewrites and the reason:
rule
the prose the grammar file leaves out
s-l+block-indented
the extra indentation a compact collection detects is not written down
c-b-block-header
the two block header indicators may be written in either order
c-b-block-header
a block scalar’s header ends at the end of its line
a ? with no space after it opens a plain scalar, not an explicit key
c-directives-end
a directives-end marker is a line holding only the three dashes
ns-flow-yaml-node
a flow collection carrying properties is still a flow node
ns-flow-map-implicit-entry
a JSON-like key carrying properties may take a value adjacent to its :
s-l+block-collection
properties belong to the collection only if the line ends after them
ns-reserved-directive
YAML and TAG name the two directives the spec defines, so neither names a reserved one
Most patches add the same missing check: the specification writes an indicator character into the grammar, then
constrains what may follow it in the text around the production.
None of the patches follows what a parser does. Each one rests on the specification’s text, and each one checks
the shape of the rule it rewrites: if a newer grammar file fixes or moves the rule, the compile fails and names
the patch.
JSON needs no patch. RFC 8259’s grammar runs as written.
Calibration
A corpus stores the oracle’s verdicts, so an oracle wrong on one document puts a false accusation into every
corpus built from it. Two tests score the oracles against the hand-written suites before any corpus is built:
suite
must accept
must reject
the oracle
YAML Test Suite (TestRecognizerAgreesWithTheYAMLTestSuite)
The suite is right about both. Section 6.8.1 makes a second %YAML directive for the same document an error.
Section 6.8.2.2 scopes a %TAG directive to the document that follows it, so !prefix! is undefined in the second
and third documents.
The grammar cannot express either rule:
l-directive-document takes one or more l-directive, and each matches one directive alone. Nothing in a
production counts how many %YAML lines came before.
c-ns-shorthand-tag is a c-tag-handle followed by tag characters. It matches the shape of !prefix! and
never asks whether a %TAG directive declared it. Checking that takes a table of the handles each document declares, and a grammar keeps no table.
So the oracle accepts both documents, as the grammar does. A patch cannot fix this, because each rule needs state
that lives outside any production. TestRecognizerAgreesWithTheYAMLTestSuite lists the two fixtures by name, with
the reason. The test fails if either one starts to agree, so the list cannot go stale.
The corpus states both rules as tags with a settled outcome, instead of as verdicts:
tag
stage
settled
directive/yaml-repeated
compose
reject, section 6.8.1
directive/handle-out-of-scope
compose
reject, section 6.8.2.2
A case carrying either tag keeps the grammar’s wellFormed: true, and Table.Expect turns the settled rule into
an expected rejection. See Settled rules.
The YAML Test Suite has one flaw here: its error file marks a broken syntax and a broken rule the same way. A
parser that checks only syntax cannot tell which of its failures on the suite are real defects. The corpus keeps
the two apart: wellFormed holds the grammar’s verdict, and the tag holds the rule and the stage it belongs to.
How it runs
grammar.Compile walks the grammar file once and builds a tree of Go closures. Running closures costs two orders
of magnitude less than interpreting the decoded file at every step, and a corpus build calls the oracle hundreds
of thousands of times.
The recognizer memoizes the result of a rule at a position. Without it, nested flow collections take exponential time:
twenty nested sequences take 115 million steps and five seconds. With it, the time is linear, at about twice the
cost on documents that never backtrack.
how a block scalar’s header passes m and t to the rule after it;
how a block collection’s indentation is measured from its first line;
why a failed alternative costs nothing to undo.
Tags and stances
A case does not say “must accept” or “must reject”. It stores the grammar’s verdict and the list of questions
the document raises that the specification leaves open. A stance, declared by each parser, turns the two into
an expected outcome when the corpus is replayed.
Why a corpus cannot store “must accept”
Every specification worth testing against leaves some questions to the implementation:
RFC 8259 lets a parser limit the range and precision of numbers, and calls the meaning of an unpaired surrogate
escape unpredictable.
YAML 1.2 admits UTF-8, UTF-16 and UTF-32, and a library may support only one of them.
A corpus that stored “this document must be accepted” would store one parser’s choice as if it were the language,
and would mark a conforming parser wrong for making another. So a case stores what the grammar says, and names
the open questions with tags.
Tags and features
A tag (stance.Tag) names a question the language leaves open: number/out-of-range, encoding/bom,
anchor/cyclic-meaning. A case lists the tags its document carries. A tag gates scoring: a parser that has no
position on a tag is not scored on the cases carrying it.
A feature (stance.Feature) names a construct the document contains: a flow collection, a CRLF line break,
an anchor. Features never change the expected outcome. Use them to select a subset of the corpus with
stance.With and stance.Without, and to report what a failing document holds.
To decide which one a new label is, ask whether a conforming parser could refuse the construct, or read it
differently. If it could, the label is a tag. If it could not, it is a feature.
A stance.Table records a parser’s stand on each tag:
stand
meaning
Accepts
the parser reads such documents, and the grammar’s verdict decides
Refuses
the parser rejects them on purpose, so the case expects a rejection
Either
the parser does not guarantee either answer, so the case is not scored
Undeclared
no position, the zero value: the case is not scored
Undeclared is not scored on purpose. A table that leaves a tag out gives no free pass on the cases carrying
it. Call Header.Unknown to find the tags a corpus uses that your table does not know.
Outcomes
Table.Expect returns an outcome and the reason for it:
Accept: a conforming parser with these stands reads the document.
Reject: it refuses the document.
Undecided: the case tells nothing about this parser. Skip it, and do not count it as a pass.
Read a corpus lists the steps
Table.Expect takes, for readers without Go.
Stages
“Valid” is not one question. A document can be well formed and still not resolve, or resolve and still not fit
the model a program loads it into. The YAML specification names the steps, and they apply to JSON too:
stage
what a parser does
Parse
reads the characters into a serialization: syntax
Compose
builds the representation: resolves aliases, collects mapping keys
Construct
builds native values: numbers, strings, maps
Each tag has the stage at which its question first arises, in the grammar’s vocabulary and in the header’s
vocabulary. number/out-of-range arises at Construct, because nothing before construction has a numeric type.
Table.At is how far a parser takes a document, and it is a floor. A parser that stops at Parse is not asked
about a tag that arises at Construct. A parser that notices a parse question later, say while it builds a
string, still answers it.
Encoding is not a stage. What a run of bytes denotes is settled before parsing starts.
How far the verdict reaches
wellFormed is the grammar’s verdict at Parse. A refusal holds at every stage: a document that does not
parse does not compose or construct either. An acceptance does not: a document can parse and still fail to
compose, as when it uses an alias to an anchor that never occurs.
So a case records verdictAt, the last stage at which an acceptance by the grammar is evidence. A parser that
goes further than verdictAt is not scored on the case’s acceptance. An absent verdictAt means Parse, the
least a case can claim.
Settled rules
Some questions the grammar cannot express are settled by the specification all the same. YAML says an alias
must refer to an anchor that occurs earlier in the document: a parser that reads an undefined alias is wrong,
whatever its stance.
A stance.Rule records such a requirement: the tag, the clause that settles it, and the outcome it fixes. The
header’s tag spec carries the same facts in settled and because. Table.Requires holds a language’s rules,
and Table.Expect checks them before the stands:
A rule that fixes Reject makes the case expect a rejection, whatever the table’s stand.
A rule that fixes Accept says the construct is legal. The grammar still decides whether the document is.
A table can decline a rule with Either, when the parser cannot check it at all: a parser that never resolves
aliases cannot check a rule about them. The case is then not scored. A table cannot turn a settled rejection
into an acceptance.
Rules.Contradicted names the settled rules a table marks Accepts. Such an entry is a mistake, most likely a
tag copied into the wrong table, and the function reports it so you can delete it.
Opaque bytes
The oracle reads UTF-8. A case is opaque when its bytes are not valid UTF-8, even after the normalization the
grammar allows. The grammar’s verdict then says nothing about a parser that decodes those bytes in some other
way, as UTF-16 or with replacement characters.
So for a parser that Accepts the tag explaining the bytes, usually encoding/not-utf8, an opaque case is
Undecided. A parser that Refuses the tag still expects a rejection: refusing does not depend on what the
bytes denote.
Two examples
Each example takes one case from a compact corpus and runs Table.Expect on it with several tables. The outcomes
and reasons are copied from a run; each reason drops the table name it starts with.
JSON: a lone surrogate
The case shape/value/lone high surrogate, from the JSON compact corpus:
src is ["\uD834"]: an array holding a string whose only escape is the first half of a surrogate pair. The
grammar accepts it, because RFC 8259’s grammar allows any \u escape. The RFC calls the result unpredictable, so
the case carries string/lone-surrogate, an open tag.
the grammar accepts it and no property this parser refuses is present
a table that declares Either
Either
Undecided
declines to guarantee this
a table that leaves the tag out
Undeclared
Undecided
has not ruled on this
DefaultLexer and encoding/json give opposite answers, and both conform. The case scores each against what it
declares.
YAML: a merge key
The case shape/merge/a merge from an anchored mapping, from the YAML compact corpus:
{
"name": "shape/merge/a merge from an anchored mapping",
"src": "YmFzZTogJmIge2E6IDF9CmQ6CiAgPDw6ICpiCiAgYzogMgo=",
"wellFormed": true,
"tags": ["merge/key"],
"verdictAt": "construct"}
src is:
base: &b {a: 1}
d:
<<: *bc: 2
YAML 1.1 reads << as a merge key, so d holds a: 1 and c: 2. YAML 1.2 dropped merge keys from the core
schema, and many parsers still apply them. The question arises when the parser builds native values, so
merge/key is placed at Construct. It is an open tag: no rule settles it.
Each table below sets Speaks: yamlbuild.Vocabulary() and Requires: yamlbuild.AllRules():
table
At
stand on merge/key
outcome
reason
applies merge keys
Construct
Accepts
Accept
the grammar accepts it and no property this parser refuses is present
refuses merge keys
Construct
Refuses
Reject
refuses this on purpose
does not guarantee either
Construct
Either
Undecided
declines to guarantee this
no position
Construct
Undeclared
Undecided
has not ruled on this
refuses merge keys, stops at composing
Compose
Refuses
Accept
the grammar accepts it and no property this parser refuses is present
a parser only
Parse
Undeclared
Accept
the grammar accepts it and no property this parser refuses is present
The last two rows show the stage floor. merge/key arises at Construct, past where these two tables stop, so
Table.Expect skips the tag and the grammar’s verdict decides. A parser that never builds native values never
meets the merge question, so its stand on merge/key does not matter.
Coverage and selection
A build draws far more documents than a corpus can hold. This page explains what the oracle records while it
reads a document, and how the builder uses that record to choose the documents to keep.
What the oracle records
Given a Coverage vector, the oracle counts each production it enters while it reads a document. A bucket is
not the production alone:
YAML: the production, the context it was entered in (block-in, flow-key, …), and the indentation
n and m, each reduced to nine classes.
JSON: the production. JSON has no context and no indentation.
The context is part of the bucket because the same rule decides differently in block-in and in flow-key.
The indentation is part of it because two documents that differ only in how far they are indented once produced
the same record, and the builder kept one of them.
Each bucket counts attempts and successes apart, so a backtracked attempt still counts as an entry.
Reach computes the buckets that can be entered at all, from a start production in a context. From a YAML
stream, 605 production-by-context buckets are reachable, and the compact
corpus enters every one. A test fails if a document enters a bucket Reach declares unreachable.
Signatures
A document’s signature is a digest of the set of buckets it entered. Two documents with one signature took
the same route through the grammar. For a refused document, the route is close to a statement of how the
document is wrong.
The signature that put a case in the corpus is stored in origin.signature. Bucket numbers change when the
grammar changes, so the corpus stores digests and documents, never vectors.
How a build keeps a document
Generate(seed, documents, mutantsEach) draws valid documents and breaks each one mutantsEach times. The
builder then reads each document with the oracle and keeps it if any of these holds:
it enters a bucket no kept document has entered;
its signature has fewer than PerSignature kept documents;
it holds a combination of constructs no kept document holds, such as a tab, an escape or a line break style
(in JSON, this applies to valid documents only);
The construct set catches what the route cannot. The compact YAML corpus enters every reachable bucket, so a new
document rarely reaches a new one, and a document holding a tab takes the same route as one holding a space.
A document with a meaning is never dropped. Two documents can take the same route and denote different values:
they are one test for a recognizer and two for a decoder. A mutant carries no meaning, because nobody knows what
it denotes, so the quota applies to it.
The enumerated shapes go in before any drawn document and are never dropped: the JSON encoding and value
shapes, and the YAML families such as anchor patterns and schema scalars. No coverage signal points at them. A
byte order mark appears in no grammar production, and an alias enters the same productions whether its anchor
exists or not.
Tiers
A tier is a Build recipe. The three tiers draw from the same seed and differ in how many documents they draw
and how many they keep:
tier
JSON
YAML
compact
Compact(): 8,000 documents, 24 mutants each, up to 16 per signature: 3921 cases
Compact(): 3,000 documents, 16 mutants each, up to 16 per signature: 28279 cases
extended
40,000 documents, 24 mutants each, up to 16 per signature: 11982 cases
15,000 documents, 16 mutants each, up to 16 per signature: 112578 cases, 6.8 MB
full
Full(): the compact draw, every document kept: 144396 cases
Full(): 6,000 documents, 12 mutants each, every document kept
Compact lives in the repository, and the Go modules embed it. Every test run rebuilds it and compares the
result with the stored file.
Extended draws five times the compact documents and keeps the same quota, so it reaches the shapes the
generator draws rarely. The quota caps the refused documents, so five times the documents gives about three times
the JSON cases and four times the YAML ones. Run against the YAML extended tier on 2026-11-23, go-yaml showed
seven candidate defects that the compact tier had missed. Extended is written as a Build literal for now, not as a function;
it is meant to ship with each release.
Full drops nothing, valid documents included. No build calls Full() today.
A build reads no clock and calls no parser, so the same recipe writes the same bytes every time.
Why sixteen per signature
A signature is how the oracle sees a document. Keeping one document per signature throws away everything two
documents differ by that the oracle cannot see, and parsers fail in exactly those places.
The quota was set by replaying each build through go-yaml and counting the distinct error messages it produced:
documents kept per signature
1
4
16
32
distinct messages
14
19
22
23
Going from 16 to 32 found one more message and cost 37 KB. Drawing more documents found more than raising the
quota did, because most messages appear in about one document in twenty thousand. So the compact build keeps 16
per signature and draws more documents.
Meanings and readings
A verdict says whether a parser must read a document. A meaning says what the parser must read it as. The YAML
corpus carries a meaning for 2864 of its
28279 compact cases. The JSON corpus carries
none.
When a case carries a meaning
The generator draws a value first and writes it as YAML second, so it knows what each document it writes means.
The hand-written families, such as the anchor and schema shapes, state theirs too. A case carries no meaning
when:
the grammar refuses the document: a refused document denotes nothing;
the document is a mutant: nobody knows what a broken document denotes, even when it is still valid;
the generator declines to say. One shape does this, under %YAML 1.1: the same text written plain in one place
and quoted in another, where the generator cannot tell which occurrence resolved to a boolean.
The fields
A meaning is stored in the case, as a JSON object:
field
holds
under
the reading that gives this answer, such as yaml-1.2-core
json
the value, written as JSON
cyclic
true when the value holds a cycle, and then json is absent
Compare json as a JSON value, not as text: the writer compacts the whitespace, and a reader that decodes
numbers into float64 rounds those it cannot hold.
A cyclic value, such as recursive: &x [ *x ], has no JSON form. The compact corpus holds
4 such cases. A parser that returns a value it can write as JSON for
one of them has replaced the cycle with something else.
Readings
A plain scalar carries no tag, so a resolution step outside the grammar decides what it denotes. YAML defines
several. A reading names the one used:
reading
resolution
yaml-1.2-core
YAML 1.2’s core schema, the specification’s default
yaml-1.1
YAML 1.1’s types, still common: yes is a boolean and 0777 is octal
The header lists the readings the corpus weighed in readings. The JSON and failsafe schemas of YAML 1.2 are not
weighed. The failsafe schema reads every scalar as a string. The JSON schema may refuse a scalar that matches none
of its own productions, which would be a verdict and not a value, and the corpus leaves that question open.
One meaning, or one per reading
Most documents mean the same under every reading. Such a case carries meaning alone.
Where the readings disagree, the case also carries meanings, with one entry per reading that has an answer. The
core answer appears in both fields, so a consumer can look in one place. The compact corpus holds
334 such cases:
src is k: 0777 in base64. When meanings is present and has no entry for a reading, that reading has no
answer for the document: YAML 1.1, for example, has no reading of a 0o513 integer under a !!int tag.
Pick the meaning for your parser
Declare the reading your parser implements in stance.Table.Reads, then ask the header:
table:=stance.Table{Reads: "yaml-1.1"/* ... */}
ifm, ok:=header.MeaningFor(c, table.Reads); ok {
// compare your parser's value with m.JSON, or check m.Cyclic}
Header.MeaningFor returns one of three answers:
the case lists an answer under the reading: it returns that answer;
the case lists none, and the corpus weighed the reading: the readings agree, so it returns meaning;
the corpus never weighed the reading: it returns false, and the case says nothing about your values.
An empty Reads asks for the corpus default, the answer in meaning.
Without the header’s list, the second and third answers would look the same. A parser reading the failsafe schema
would be handed the integer for k: 1, and marked wrong for reading the string "1".
Without Go, the same steps take a few lines: look for your reading in meanings; if meanings is absent and your
reading is in the header’s readings, use meaning; otherwise skip the value.
A meaning never changes a verdict
Table.Expect does not read Table.Reads. k: 0777 is a valid document under every reading; the readings
disagree only on what it denotes. So a parser on another reading is scored on the verdict as usual, and on the
value only where the corpus states an answer for its reading.
Suites
Each suite has its grammar, its generator, its tag vocabulary and its corpus.
YAML 1.2, patched for the rules the spec states in prose: the generator, the mutations, the tags and features,
the readings, and the parsers the corpus is checked against.
Subsections of Suites
JSON
The JSON suite tests whether a parser accepts exactly the documents RFC 8259 admits, and holds it to the
positions it declares on the questions the RFC leaves open. The package is jsoncorpus, in the root module.
The grammar
jsoncorpus.JSON is the grammar of RFC 8259, compiled from json/testdata/rfc8259.json with no patches: every
production runs as the RFC writes it. It has 33 rules. jsoncorpus.Text
checks one document against it:
ok:=jsoncorpus.Text(src).OK
Calibration
Before the grammar decides a single case, TestRecognizerAgreesWithJSONTestSuite scores it against the vendored
copy of Nicolas Seriot’s JSONTestSuite:
files
count
the grammar
y_, must accept
95
accepts every one
n_, must reject
188
refuses every one
i_, implementation-defined
35
accepts 21; the test records them and asserts nothing
A corpus stores the grammar’s verdicts, so a grammar wrong on one document would put a false accusation into every
corpus built from it.
The generator
jsoncorpus.Generate(seed, documents, mutantsEach) draws documents and breaks each one:
RandomValue draws a value tree, and RandomStyle draws how to write it: indentation and spacing, the
whitespace around the top value, and which characters are escaped.
Emit writes the value in that style.
Mutate applies one of 8 mutations to the bytes: delete a byte,
delete a run, duplicate a byte, swap two neighbors, truncate, substitute a byte the grammar knows, insert a byte
the grammar knows, substitute an arbitrary byte.
The grammar then gives each document and each mutant its verdict. A Build keeps the cases that bring a coverage
signature nothing has brought yet: Compact() keeps up to 16 per
signature, and Full() keeps every document. Coverage explains signatures.
The generator draws only values whose meaning it knows, so two kinds of case are written by hand:
ValueShapes writes the documents whose meaning RFC 8259 leaves open, each with its tag: duplicate names and
lone surrogate escapes.
EncodingShapes writes every byte order mark in every position it can occupy.
The census
TestTheGeneratedCorpusIsWiderThanTheSuite checks that every construct a valid JSONTestSuite document holds, a
case of the compact corpus holds too. It counts 40 constructs, from a
top-level scalar to an escaped form feed, listed by jsoncorpus.Constructs. None is missing. Grammar coverage
cannot make this check: the suite and the corpus both enter every production.
Normalization
jsoncorpus.Normalize removes a leading UTF-8 byte order mark, and nothing else. RFC 8259 section 8.1 lets a
parser ignore the mark, and the bytes after it are unchanged. A case’s wellFormed is the grammar’s verdict on
the normalized bytes.
Ill-formed UTF-8 and UTF-16 are not normalized. Reading them takes a decoder and a policy for what does not
decode, and the suite would be grading a parser against a policy of its own.
Tags
The JSON vocabulary has 8 tags. jsoncorpus.Vocabulary places each at a
stage:
what an unpaired \uXXXX escape means; RFC 8259 section 8.2 calls it unpredictable
structure/deep-nesting
parse
how deep a parser nests before it gives up
object/duplicate-name
compose
which member of a repeated name wins; RFC 8259 section 4 calls it unpredictable
number/out-of-range
construct
what a number past float64 becomes; RFC 8259 section 6 lets a parser limit range and precision
RFC 8259 settles none of them. Tags gives the full description of each.
DefaultLexer
jsoncorpus.DefaultLexer is the stance of the default lexer of github.com/go-openapi/core/json:
tag
stand
encoding/bom
Accepts
encoding/not-utf8, encoding/utf16, encoding/utf32
Refuses
string/lone-surrogate
Refuses
structure/deep-nesting
Accepts
Its At is Parse: the lexer returns a number’s text and converts nothing, so it never reaches the stage where a
number can be out of range, and the table takes no position on number/out-of-range.
The positions were measured, by running the lexer over the suite’s implementation-defined cases. Two of them
differed from what its authors expected:
the lexer tolerates a byte order mark, though it still refuses a mark with no document after it;
it refuses a lone surrogate escape, which is stricter than the grammar.
What the suite leaves out
Resource limits.structure/deep-nesting marks a document nested more than
128 levels deep, the depth where nesting stops being a shape and becomes
a question of a parser’s limits. The generator stays well below it on purpose, so no case carries the tag: the
suite tests what a parser reads, not the budget that stops it on hostile input.
Meanings. A JSON case carries no meaning: the corpus says whether a parser should accept a document, not
what value it should read.
Features. A JSON case carries no features, so a subset cannot be selected by construct.
Other parsers. The YAML suite is checked against five parsers in the consensus module. The JSON suite is
checked against JSONTestSuite only.
YAML
The YAML suite tests whether a parser accepts exactly the documents YAML 1.2 admits, holds it to the positions it
declares on the questions the specification leaves open, and states what each valid document means.
the compact corpus, embedded: 1.6 MB, so it has a module of its own
The grammar
yamlcorpus.YAML is the grammar that yaml/yaml-grammar publishes, with
211 productions, compiled with 13 patches
for rules the specification states only in prose. yamlcorpus.Stream checks one stream:
ok:=yamlcorpus.Stream(src).OK
The oracle lists the patches, and the calibration against the YAML Test Suite:
299 fixtures that must be accepted and
94 that must be rejected, with 2
declared departures.
The generator
yamlgen draws a value first, then a way to write it:
Values draws a value tree: scalars of every core type, sequences, mappings, mappings keyed by collections, and
anchors with aliases in about a quarter of the documents.
Styles draws a Style: block or flow, the indentation, the quoting, literal or folded scalars and their
chomping, comments, line breaks, tags and how to spell them, number and time forms, escapes, directives, explicit
keys, a byte order mark, and %YAML 1.1.
Emit writes the value in that style. Every document it writes is valid YAML 1.2.
The value comes first, so the builder knows what each valid document means: see
Meanings.
yamlbuild.Generate draws through rapid’s Example, which produces a value from a seed, so a seed rebuilds the
corpus byte for byte. Every test run rebuilds the compact corpus and compares it with the stored file, so a rapid
upgrade that changes the draws fails the build.
Mutations
The builder breaks each document with one of 10 mutations: delete a
byte, delete a run, duplicate a byte, swap two neighbors, truncate, substitute a byte, substitute an indicator,
insert an indicator, indent a line further, outdent a line.
The byte mutations know nothing about YAML, on purpose: a mutation that knew the grammar would make only the
errors someone already thought of. The two indentation mutations are the exception. A random byte rarely lands in
the leading spaces of a line, and indentation is where parsers and this recognizer have had their bugs.
Most mutants are still valid YAML. The oracle sorts them, and the corpus keeps the ones that bring a new route
through the grammar: see Coverage.
yamlgen.Mutate, used in property tests, is a separate set aimed at
YAML’s structure: a tab in the indentation, a line moved sideways, a document marker inside a scalar. The corpus
builder does not use it.
Rules broken on purpose
Some documents are valid by the grammar and still wrong, and a byte mutation almost never writes one. The builder
writes them with 4 rewrites of a valid value, each with its tag:
rewrite
tag
alias renamed to nothing
anchor/alias-undefined
a key repeated
key/duplicate
a duplicate entry appended
key/duplicate
a collection key written twice
key/duplicate
Enumerated shapes
131 cases are written by hand, named shape/<family>/<what>, and never
dropped by the builder. No coverage signal points at them: an alias enters the same productions whether its anchor
exists or not, and every plain scalar enters the same productions whatever it denotes. The families:
family
covers
anchor
aliases undefined, forward, across documents and as keys; anchors redefined, unused or on an empty node; cycles
directive
repeated %YAML and %TAG, versions, reserved directives, handles out of scope
escape
an escape of the last code point, and one past it
indentation, separation
tabs between a property and its node, and tabs opening a block scalar’s content
key
duplicates, before and after resolution; keys that are booleans, null, floats, tagged, aliases or collections
merge
<< keys: from an alias or a mapping written in place, a sequence of merges, overridden, quoted, alone
reach
productions the generator rarely reaches: explicit keys in flow, kept trailing breaks, more-indented folded lines
schema
plain scalars the YAML 1.1 and 1.2 schemas resolve differently: yes, 0777, 1_000
tag
verbatim, local, non-specific and secondary tags; handles and percent escapes; tags whose content does not fit, such as !!int on a word; !!omap
Encoding
The oracle reads UTF-8. A document that starts with a byte order mark carries encoding/bom. A document whose bytes
are not valid UTF-8, almost always a mutant, carries encoding/not-utf8 and is marked opaque: the compact corpus
holds 1596 of them. The YAML generator writes no UTF-16 or UTF-32, so the
corpus carries no tag for them.
Tags
The YAML vocabulary has 66 tags. The specification settles
11 of them as a rejection and 11
as an acceptance, and leaves 44 open:
family
stages
the questions
anchor/*
parse, compose, construct
undefined and forward aliases (settled: reject), aliases as keys and redefined anchors (settled: accept), cyclic values (open)
directive/*
parse, compose
repeated directives (settled: reject), a later minor version (open), reserved directives (settled: accept)
encoding/*
parse
a byte order mark, bytes that are not UTF-8
escape/*, indentation/*, separation/*
parse, compose
escapes past U+10FFFF (settled: reject), tabs
key/*
parse, compose, construct
duplicate keys (settled: reject), keys that are not strings or not scalars (open)
merge/*
construct
every form of <<: YAML 1.2 dropped merge keys, and many parsers still apply them
representation/*, json/*
construct
values a native type may not hold: wide integers, out-of-range floats, binary, timestamps, ordered maps
schema/*
construct
plain scalars the schemas resolve differently
tag/*
parse, compose, construct
undeclared handles (settled: reject), verbatim and non-specific tags (settled: accept), tags on content that does not fit them (open)
Tags lists every tag with its stage, its settled outcome and its description.
Features
A YAML case also lists features: the constructs its document holds, from presentation/block-literal to
node/anchor and value/merge-key. The header lists all 61. Features never
change an expected outcome. Use them to select a subset of the corpus, or to see what a failing document holds:
2864 compact cases carry a meaning, and
334 carry one per reading, under yaml-1.2-core and
yaml-1.1. Meanings explains how to pick the one that applies to your parser.
Other parsers
Two modules import real parsers. The root module imports none.
yaml/consensus runs five implementations over the corpus: the YAML 1.2 reference parser (Perl), libfyaml,
YAMLStar, go.yaml.in/yaml/v3 and github.com/go-openapi/go-yaml. The
consensus report shows where they agree with the corpus and with each other.
yaml/calibrate holds tests only. They check the generator and the corpus against go-openapi/go-yaml: that
every emitted document parses, that every style of one value reads the same, and that the stated meanings are
what a parser reads.
What the suite leaves out
The JSON and failsafe schemas. The corpus states meanings under two readings only; see
Meanings.
Events and output. The YAML Test Suite stores a parser’s event stream (test.event) and a canonical
rendering (out.yaml). The corpus stores neither: it states what a document means, not how a parser reports
reading it.
UTF-16 and UTF-32 documents. See Encoding above.
Reference
Look things up here. The concepts behind each field are in Concepts.
Five YAML parsers read the compact YAML corpus: where they agree with it, and with each other.
Subsections of Reference
File format
A corpus file holds one conformance suite: a header describing the suite, followed by its test cases. This
page lists every field, with its type and when it may be absent. The reasons behind the fields are explained
in Concepts.
Container
A corpus file is a gzip-compressed JSON Lines file, encoded in UTF-8.
Line 1 holds the header object.
Each following line holds one case object.
The test document in src is encoded in standard base64 with padding, because it often holds bytes that
are not valid UTF-8 and cannot appear in a JSON string. Every other field is plain JSON.
The gzip header carries no modification time and no operating system, so two builds of the same corpus with
the same Go toolchain produce identical files.
The name of the grammar behind the verdicts: RFC 8259, YAML 1.2.
digest
string
always
sha256: and the hex SHA-256 of the grammar file behind the verdicts.
generator
string
always
The name and version of the generator that produced the documents: jsoncorpus/1.
seed
integer
always
The seed given to the generator.
tier
string
always
compact for the small corpus embedded in the module, extended for the larger one with the same quota, full for the one that keeps every document.
cases
integer
always
The number of case lines after the header.
vocabulary
array of tag specs
always
Every tag used by at least one case, sorted by name. See below.
readings
array of strings
optional
Every reading the corpus considered when it recorded meanings, sorted: yaml-1.2-core, yaml-1.1.
features
array of strings
optional
Every feature name used by at least one case, sorted.
Tag spec
Each entry of vocabulary describes one tag, so that a consumer can score a case from the file alone.
field
type
present
content
tag
string
always
The tag name, as it appears in a case’s tags.
stage
string
always
The earliest stage at which the question can arise: parse, compose or construct.
settled
string
optional
accept or reject when the specification decides the question. Absent when each implementation chooses.
because
string
optional
The rule from the specification, and where it is stated.
Case
A refused mutant and the valid document it came from:
{"name":"generated/0000","src":"IiI=","wellFormed":true,"origin":{"document":0,"signature":"c7ae50c0…"}}
{"name":"generated/0000/mutant/01","src":"IiIi","wellFormed":false,"origin":{"document":0,"mutation":"duplicate a byte","signature":"c7ae50c0…"}}
An encoding shape, which carries a tag:
{"name":"shape/encoding/a utf-8 mark opening-a-document","src":"77u/eyJhIjoxfQ==","wellFormed":true,"tags":["encoding/bom"],"verdictAt":"construct","origin":{"document":0,"mutation":"enumerated"}}
field
type
present
content
name
string
always
A name for the case, unique within the file.
src
base64 string
always
The test document, as raw bytes.
wellFormed
boolean
always
The grammar’s verdict, after removing the encoding properties a parser may normalize without loss. For JSON, a leading byte order mark is removed.
opaque
boolean
optional, default false
true when the bytes are not valid UTF-8 even after normalization. The oracle could not read them, so wellFormed tells nothing about a parser that decodes them some other way.
tags
array of strings
optional
The implementation-defined properties of the document. Each one is listed in the header’s vocabulary.
features
array of strings
optional
The constructs the document contains, such as a flow collection or a CRLF line break. They never change the expected outcome.
verdictAt
string
optional, default parse
The last stage at which an acceptance by the grammar is evidence: parse, compose or construct. A refusal is evidence at every stage.
meaning
meaning
optional
What the document denotes under the specification’s default reading.
meanings
array of meanings
optional
What the document denotes under every reading that has an answer. Present only when the readings disagree; it repeats the default reading.
origin
origin
always
Where the case came from. See below.
Origin
field
type
present
content
document
integer
always
The index of the generated document the case comes from.
mutation
string
optional
How the document was changed: a mutation name such as delete a byte, or enumerated for an encoding shape. Absent for a document generated whole.
signature
string
optional
The hex SHA-256 of the coverage fingerprint the builder used to select the case.
Meaning
field
type
present
content
under
string
always
The reading: rfc8259, yaml-1.2-core, yaml-1.1.
json
any JSON value
optional
The value, as JSON. null is a value; an absent field means there is none. Absent when cyclic is true.
cyclic
boolean
optional, default false
true when the value is a graph with a cycle, which has no JSON form.
Checks before scoring
Run these checks before you use a corpus file:
The format. Reject a file whose format you do not support. Read format on its own first: a newer
format may change the shape of other fields.
The length. Count the case lines and compare the count with cases. A shorter file is truncated.
The vocabulary. Every tag in vocabulary must be one your parser has a position on, or one the
specification settles. A reader that ignores an unknown tag scores the case as if the tag were absent.
The grammar, if you also run the oracle: compare digest with the digest of your grammar. A
different digest means the verdicts came from another version of the grammar file.
The Go reader runs the first two checks. Call Header.Unknown for the third.
Compatibility
format changes only when a reader of the previous version would misunderstand a newer file.
Adding an optional field does not change format. A reader must ignore the fields it does not know.
features, meanings and readings were all added this way: a reader that skips them still derives the
same expected outcomes, and still finds the default reading in meaning.
Format 4 changed meaning.json from a base64 string to a JSON value. A format-3 reader cannot decode it.
Compare meanings as JSON values, not as text: the writer removes insignificant whitespace, and a reader that
decodes numbers into 64-bit floats rounds the ones it cannot hold.
Do not rely on case names, or on the seed reproducing the corpus, to stay stable between releases.
Go
The suite package reads and writes this format:
suite.NewReader reads the header and returns a Reader. Reader.Next returns one case at a time and
fails on a truncated file.
suite.ReadAll reads a whole file into memory. suite.FromBytes does the same for a file held in a byte
slice, such as an embedded corpus.
suite.Content removes the gzip container and returns the JSON Lines.
suite.NewWriter and Writer.Add write a file. Writer.Close fails if the number of cases written
differs from cases.
Header.Spec returns the tag spec for one tag. Header.MeaningFor returns the meaning of a case under one
reading.
Tags
Generated
This page is written by go run hack/doc-site/gentags.go from each grammar’s Vocabulary().
Edit the doc comment on the tag’s constant, not this page.
A tag names an implementation-defined property a document exhibits. Every case in a corpus lists its tags, and the
file’s header repeats each tag with its stage and, where the specification settles it, the outcome.
The stage is the earliest point at which the question can be asked: parse, compose or construct.
A consumer that answers it later answers the same question. “Settled” means the specification fixes the outcome,
so no stance can change it; “open” means each parser takes its own position.
Encoding
Declared in package stance and placed by the JSON grammar. A question about what the bytes denote, settled before parsing starts.
Tag
Stage
Specification
What it marks
encoding/bom
parse
open
A document opening with a UTF-8 byte order mark. It declares no change of encoding, which is what makes ignoring it a defensible position and skipping the others not.
encoding/not-utf8
parse
open
Bytes that are not well-formed UTF-8 at all: lone continuation bytes, overlong sequences, truncated sequences, surrogates encoded directly, and code points beyond U+10FFFF.
encoding/utf16
parse
open
A document that announces or looks like UTF-16.
encoding/utf32
parse
open
A document that announces or looks like UTF-32.
JSON
Placed by jsoncorpus.Vocabulary. RFC 8259 settles none of them: each one is a position a parser takes.
Tag
Stage
Specification
What it marks
number/out-of-range
construct
open
A number the grammar admits and float64 cannot carry: it overflows, underflows to zero, or is an integer too large to survive as one. RFC 8259 section 6 lets an implementation limit range and precision, so a parser that converts is exposed where a parser that keeps the text is not.
object/duplicate-name
compose
open
An object holding two members of one name. RFC 8259 section 4 says names SHOULD be unique and calls the behavior of software receiving such an object unpredictable: it may keep the last, keep the first, or refuse.
string/lone-surrogate
parse
open
A \uXXXX escape naming a surrogate that is not part of a well-formed pair. RFC 8259 section 8.2 calls the behavior unpredictable. The escape itself is grammatical – four hex digits – so this is a question about the value, never about the syntax.
structure/deep-nesting
parse
open
A document nested more than 128 levels deep. No specification sets a limit and every parser has one, whether it says so or not. The generator stays well below that depth on purpose, so that no case tests the budget a parser keeps against hostile input.
YAML
Placed by yamlbuild.Vocabulary. A tag the specification settles carries the clause and the outcome it fixes, from yamlbuild.AllRules.
Anchors and aliases
Tag
Stage
Specification
What it marks
anchor/alias-across-documents
compose
Reject, section 3.2.2.2: anchor names are local to a document, so an earlier document’s anchor is out of scope
An alias naming an anchor from an earlier document in the same stream.
anchor/alias-as-key
compose
Accept, section 7.1: an alias is a node, and a node may be a mapping key
An alias used as a mapping key. Legal wherever a node is legal, which is a question about composing and not about the model underneath.
anchor/alias-forward
compose
Reject, section 7.1: the anchor must precede the alias, so a forward reference names nothing
An alias naming an anchor that occurs later.
anchor/alias-recursive
parse
Accept, section 3.2.1: an anchor identifies its node from where the node begins, so an alias within it resolves
An alias inside the node its own anchor names.
anchor/alias-undefined
compose
Reject, section 7.1: an alias refers to the most recent preceding node having the given anchor, and there is none
An alias naming an anchor that never occurs.
anchor/cyclic-meaning
construct
open
A document whose representation graph contains a cycle, which is a different question from whether it parses.
anchor/on-empty-node
compose
Accept, section 7.1: the empty node is a node, and may be anchored
An anchor on a node with no content.
anchor/redefined
compose
Accept, section 3.2.2.2: an anchor name may be reused, and the alias takes the most recent
The same anchor name given to two nodes. Legal, and the later one wins.
anchor/unused
compose
Accept, section 7.1: nothing requires an anchor to be referred to
An anchor nothing refers to. Legal, and worth having because it is the shape a parser is most likely to have simply dropped.
Directives
Tag
Stage
Specification
What it marks
directive/handle-out-of-scope
compose
Reject, section 6.8.2.2: TAG directives apply to the document that follows them, so a later document has no such handle
A handle declared for one document and used in a later one.
directive/multiple
compose
Accept, section 6.8: nothing limits a document to one directive, and a %YAML with a %TAG is the ordinary prelude
A document with more than one directive, which is ordinary: a %YAML and a %TAG together are the commonest prelude there is.
directive/reserved
compose
Accept, section 6.8: a directive a processor does not recognize is ignored with a warning, not refused
A directive that is neither %YAML nor %TAG, which the spec says to ignore with a warning rather than refuse.
directive/tag-handle-repeated
compose
Reject, section 6.8.2.2: it is an error to specify more than one TAG directive for the same handle in the same document
The same %TAG handle declared twice for one document.
directive/yaml-major-version
compose
Reject, section 6.8.1: a processor must reject a directive whose major version differs from its own
A %YAML whose major version is not 1, which a 1.x processor must refuse rather than guess at.
directive/yaml-minor-version
compose
open
A %YAML whose minor version is beyond what the processor knows – 1.9 today.
directive/yaml-repeated
compose
Reject, section 6.8.1: it is an error to specify more than one YAML directive for the same document
Two %YAML directives for one document.
directive/yaml-version
parse
open
A %YAML directive stating the version.
escape
Tag
Stage
Specification
What it marks
escape/past-unicode
compose
Reject, section 5.7: \U escapes a 32-bit Unicode character, and no character lies past U+10FFFF
A double-quoted scalar holding a \U escape past U+10FFFF.
indentation
Tag
Stage
Specification
What it marks
indentation/tab-opens-content
parse
open
A root block scalar whose first content line opens with a tab at column 0.
JSON representation
Tag
Stage
Specification
What it marks
json/not-representable
construct
open
A document whose meaning has no JSON form: a non-finite float, or an entry keyed on a collection.
Mapping keys
Tag
Stage
Specification
What it marks
key/distinct-after-resolution
compose
Accept, section 3.2.1.1: keys resolving to different nodes are different keys, however alike they look
Two keys that look nearly alike and are not equal, because resolution gives them different types.
key/duplicate
parse
Reject, section 3.2.1.1: it is an error for two equal keys to appear in the same mapping node
Two keys with the same spelling.
key/duplicate-after-resolution
compose
Reject, section 3.2.1.1: keys are equal when they resolve to the same node, however they are written
Two keys that are equal only once they are resolved: quoting removed, tags applied, aliases followed.
key/integral-float
construct
open
A mapping key that resolves to a float whose value is a whole number: 1.0, 1e3, -0.0.
key/not-a-scalar
construct
open
A mapping key that resolves to a collection.
key/not-a-string
construct
open
A mapping key that resolves to something other than a string: a number, a boolean, a null.
Merge keys
Tag
Stage
Specification
What it marks
merge/into-non-mapping
construct
open
<< given something that is not a mapping.
merge/key
construct
open
A << key whose value is an alias to a mapping – the construct working as intended.
merge/key-alone
construct
open
A << written as a flow entry’s key with no :.
merge/quoted
construct
open
A quoted <<, which suppresses the merge in every reading because quoting resolves it to a string.
merge/sequence
construct
open
<< given a sequence of mappings, which 1.1 merges in order with the earlier winning.
merge/written-in-place
construct
open
<< given a mapping written where it stands, rather than an alias to one written elsewhere.
Representation in a model
Tag
Stage
Specification
What it marks
representation/binary
construct
open
A !!binary, whose value a model holds as raw bytes or as the base64 text.
representation/float-inexact
construct
open
A float written with more digits than the model’s float type keeps, so a reader into one rounds and the document’s digits are not what it holds.
representation/float-non-finite
construct
open
.inf, -.inf or .nan: a float a model may hold, refuse, or never resolve to a float in the first place.
representation/float-out-of-range
construct
open
A float whose magnitude is past what the model’s float type holds, in either direction: it overflows to an infinity or underflows to zero.
representation/integer-wide
construct
open
An integer past what a machine word holds, which a model may hold whole, round to a float, or refuse.
representation/ordered-map
construct
open
An !!omap, whose entries a model holds as ordered pairs or as a plain mapping.
representation/timestamp
construct
open
A !!timestamp, whose value a model holds as a moment, as a zoned text, or as the text the document wrote.
Schema resolution
Tag
Stage
Specification
What it marks
schema/bool-legacy
construct
open
A scalar YAML 1.1 read as a boolean and 1.2 does not: yes, no, on, off, y, n and their capitalizations.
schema/float-exponent-only
construct
open
1e3: digits and an exponent with no decimal point. A float under 1.2’s core schema and under JSON, and a string under 1.1, whose float required a point.
schema/float-special
construct
open
.inf and .nan. Floats under core, strings under failsafe and under JSON, which has no way to write either.
schema/int-binary
construct
open
0b1010. A YAML 1.1 integer, and nothing in 1.2.
schema/int-non-decimal
construct
open
0x1A and 0o17: core integers, and strings under the JSON schema, which writes neither.
schema/int-octal-legacy
construct
open
A leading zero. YAML 1.1 read 0777 as octal 511; 1.2 spells octal 0o777 and leaves the leading-zero form as a decimal or a string. It is the disagreement most likely to be load-bearing, because file modes are written this way and both readings are plausible numbers.
schema/int-sexagesimal
construct
open
1:30. A YAML 1.1 integer meaning 90, and a string in 1.2 – which is why 12:34:56 is a time in some documents and a string in others.
schema/int-underscores
construct
open
1_000. A YAML 1.1 integer, and nothing in 1.2.
schema/timestamp-legacy
construct
open
2001-12-14. A timestamp in YAML 1.1, which had the type, and a string in 1.2, which does not.
Separation
Tag
Stage
Specification
What it marks
separation/tab
parse
open
A document separating with a tab where a space would do.
Tags on nodes
Tag
Stage
Specification
What it marks
tag/binary-not-base64
construct
open
!!binary not base64!.
tag/bool-not-a-boolean
construct
open
!!bool 7.
tag/float-not-a-number
construct
open
!!float xyz.
tag/int-not-an-integer
construct
open
!!int abc.
tag/kind-mismatch
construct
open
A tag over a node of the wrong kind: a collection tag on a scalar or on the other collection, or a scalar tag on a collection.
tag/local
construct
open
A ! shorthand, whose meaning is the application’s.
tag/named-handle
parse
open
A shorthand using a handle a %TAG directive declared.
tag/non-specific
compose
Accept, section 6.9.1: a non-specific tag is legal, and asks that resolution be suppressed
A bare !, which suppresses resolution rather than naming a type.
tag/null-not-null
construct
open
!!null 5.
tag/omap-not-a-sequence-of-pairs
construct
open
!!omap over anything but a sequence of one-entry mappings: an element that is not a mapping, an element holding two entries, the tag on a mapping, or one key written twice.
tag/percent-escape
parse
open
A tag URI carrying a percent escape, which is the only route to a hex digit outside a quoted scalar.
tag/secondary
compose
Accept, section 6.8.2.2: the secondary handle is declared by default as tag:yaml.org,2002:
A !! shorthand, which resolves through the secondary handle to tag:yaml.org,2002: unless a %TAG says otherwise.
tag/timestamp-not-a-date
construct
open
!!timestamp not-a-date.
tag/undeclared-handle
parse
Reject, section 6.8.2.2: a tag shorthand must use a handle a %TAG directive declared, and this one does not
A shorthand whose handle no %TAG declares.
tag/verbatim
compose
Accept, section 6.8.2.1: a verbatim tag is used as presented and resolves through nothing
A tag written out in full between angle brackets, which resolves through nothing at all.
Consensus report
The consensus report compares five YAML parsers on every case of the compact YAML corpus. For each parser it
scores the verdict (accept or reject), the loaded value and the round trip against the corpus, and lists the cases
on which the parsers disagree, by tag and by feature.
This page will carry a copy of the repository README, the way every go-openapi
doc site does. The README’s usage sections overlap Getting started:
decide which one holds the example before copying.
LICENSE
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Third-party notices
See NOTICE: the YAML Test Suite
and JSONTestSuite fixtures (MIT), and yaml-spec-1.2.json, which states no license.
NOTICE
Copyright 2025-2026 go-swagger maintainers
// SPDX-FileCopyrightText: Copyright 2025-2026 go-swagger maintainers
// SPDX-License-Identifier: Apache-2.0
This software library, github.com/go-openapi/conformance-suites, includes software developed
by the go-swagger and go-openapi maintainers ("go-swagger maintainers").
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this software except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.
This software ships with copies of other software which license terms are recalled below.
Third-party notices for github.com/go-openapi/conformance-suites
============================================================
github.com/yaml/yaml-grammar -- yaml/testdata/yaml-spec-1.2.json
------------------------------------------------------------
yaml/testdata/yaml-spec-1.2.json is copied unmodified from
https://github.com/yaml/yaml-grammar/blob/68cba4e5c77f13b316da71b129da9b986ea80a55/yaml-spec-1.2.json
(git blob 69cc3ee97ed22f97bb16b0dd76f8eff57742391c, identical on master as of 2026-11-22).
The yaml package embeds it and compiles the YAML 1.2 recognizer from it.
That repository states no license, and neither does https://github.com/yaml/yaml-spec.
We have not been granted a license for this file. It is not covered by this project's
Apache-2.0 license.
github.com/yaml/yaml-test-suite -- internal/yamltestsuite/testdata/
------------------------------------------------------------
The conformance fixtures under internal/yamltestsuite/testdata are used unmodified from
https://github.com/yaml/yaml-test-suite, under the MIT License. A copy of that
license is provided verbatim below and vendored alongside the fixtures at
internal/yamltestsuite/testdata/LICENSE.
(internal/yamltestsuite/yaml.go is not part of the suite: it is this project's
loader for the fixtures, and is covered by the root LICENSE.)
MIT License
Copyright (c) 2016-2020 Ingy döt Net
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
github.com/nst/JSONTestSuite -- internal/jsontestsuite/testdata/
------------------------------------------------------------
The conformance fixtures under internal/jsontestsuite/testdata/test_parsing are used unmodified from
https://github.com/nst/JSONTestSuite at revision 1ef36fa, under the MIT License. A copy of that
license is provided verbatim below and vendored alongside the fixtures at
internal/jsontestsuite/testdata/LICENSE.
(internal/jsontestsuite/json.go is not part of the suite: it is this project's
loader for the fixtures, and is covered by the root LICENSE.)
MIT License
Copyright (c) 2016 Nicolas Seriot
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Maintainers
Outline
This page is an outline. The structure is up for review; the prose is not written.
What the page must answer
Where does a new grammar, generator or helper go?
Which packages are public, and why?
When does a second module appear?
How is a corpus regenerated, and how is a release cut?
Sections
One directory per grammar (json, yaml); suite and stance beside them; the engine in internal/grammar
Public: suite and stance (a consumer reads a file and declares a table); the oracle’s result types
Each grammar package re-exports the engine types it returns: type Result = grammar.Result
Package names carry the grammar: jsoncorpus, yamlcorpus, yamlgen
No parser imported in the root module, tests included; consensus is a module of its own
One module until a dependency or an embed forces a split (yaml/corpus)
Regenerating the compact corpus, and the regenerate-and-diff test
Updating metrics.yaml
Releasing: bump-release.yml or a signed semver tag; corpus assets once released
The consensus report
The consensus image (yaml/consensus/docker/Dockerfile) pins every parser, go-openapi/go-yaml included. Bump the
go-yaml pin by hand, together with the stance files it needs. Each release runs the image on the compact corpus and
attaches the results file, consensus-results.jsonl.gz, to the release. The doc site renders the
consensus report from the results file of the latest release.
To produce a report yourself, build the image and run it on a corpus file, as the Dockerfile’s header describes.
Then render it into this site, under /consensus/, or into any directory: