Nothing checks that what a declaration says a value looks like is what it is written as
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 12/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- csharp
- Ambito
- testing-qa
Direzione di ricerca
The rule belongs in the WireShape.Testing project, alongside the existing WireShape.OpenApi.Testing rule that reads Format. Start by reading how ISerializer.WriteAsText and ReadFromText are defined, since the issue depends on #9 and #11 for them. The work is design-heavy across Kind, Format, Pattern and closed lists, so it is not a first contribution; done means every declared value is checked or reported as uncheckable.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
A declaration says what a value looks like once written — its Kind, its Format, for a text its Pattern, and for an enumeration the closed list of what each of its values travels as — and a document writes each of them into the schema of the value. None of it is checked against what is written. The only rule that reads Format (WireShape.OpenApi.Testing) compares the declaration with the document, never with the writer, so a declaration and the wire can say two different things and every test passes. #9 is what that looked like: three carriers of time shipped with a Format that the text they are written as does not have.
A document saying one thing while the wire writes another must not happen, and nothing guarantees it today.
Proposal
A rule in WireShape.Testing that writes values of every form a wire declares with the writer of that wire, through ISerializer.WriteAsText (#9), and reports every value whose written form contradicts what is declared about it. It is complete: every declared value is checked, and one that cannot be checked is reported, never skipped.
What is checked of each value
Kind: aTextis written as a text, anIntegeras a number with no fractional part, aDecimalas a number, aBooleanas a truth. This needs the writer to say what it wrote, and not only its text, which is what #11 adds to writing a value: a value written whole with itsValueKind, or one written with members or as a list.Format: the text satisfies the format as the OpenAPI format registry defines it.Pattern: the text matches it.- A closed list (#11): each value of the enumeration is written as the word or the number the list gives it, and nothing the list does not hold is written for any of them.
Where the values come from
| Form | Values written |
|---|---|
A carrier of Carrier.Known |
Values the rule makes itself, covering what changes the text: each DateTimeKind of a DateTime, an offset of zero and one that is not, a time of day and a moment with and without a fraction, a negative span, the bounds of each number, -0 |
| A type declared to travel as one of those carriers | The same values of its carrier, read into the declared type with ReadFromCarrier and written as the declared type, so that the converter of the application is what is checked |
An enumeration declared or worked out as AsText or AsInteger with a closed list |
Every value of the enumeration, which the type itself lists, so no example is needed |
A text declared with Shape.AsText, or a carrier of one's own |
Examples the declaration itself carries, read with the converter of the wire and written back. Nothing else can make one: a text in a format can only be written by someone who already knows the format, and writing it back unread would prove nothing |
So Shape.AsText and Carrier can carry examples. A declaration with a Format or a Pattern and no examples is reported as one that cannot be checked.
What it knows how to check
Every format a carrier of Carrier.Known declares, after #9: uuid, int32, int64, float, double, decimal, date, date-time, time-local. A Format it has no check for is reported as one that cannot be checked, so that a word nobody verifies — email, or date-tme — does not pass in silence. Adding a format means adding its check.
Expected Behavior
- Over the wire of the documentation, with every declaration as it is meant to be, it reports nothing.
- A carrier declared
timeand written without an offset is reported, naming the type, the format and the text written. - A value declared as an
Integerand written as a string is reported. - A text declared with a
Patternwhose example is written in a form the pattern does not match is reported. - A value of an enumeration written as a word or a number other than the one its closed list gives it is reported, naming the member, what the list says and what was written.
- A declaration with a
Formator aPatternand no examples is reported as one that cannot be checked. - A
Formatthe rule has no check for is reported as one that cannot be checked. - A converter of the application that changes how a carrier is written — a
TimeOnlywith an offset — is checked as what it writes, not as what the carrier says.
Depends on
- #9, for
ISerializer.WriteAsTextandReadFromText, and for the formats of time that the rule would otherwise report. - #11, for what writing a value says it wrote, and for the closed lists of
AsTextandAsInteger.
- Lingua principale
- C#
- Stelle
- 0
- Fork
- 0
- Merge medio
- 20h 34m
- PR unite (30g)
- 5
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di iokode/WireShape
-
An enumeration is asked what it travels as by a way of its own, beside the form of every other typeAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
Tutte le issue di iokode/WireShape
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
iokode/OpinionatedFramework#140 ·
-
accessibility effort: small enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
pedersebastian/CustomBossChallenge#185 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
dotnet/command-line-api#2887 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
JiaFeiMiao-K-Cat/DiscImageStudio#331 ·
I maintainer di solito rispondono entro 1 giorno