Nothing checks that what a declaration says a value looks like is what it is written as
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 12/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- csharp
- 领域
- testing-qa
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- C#
- 星标
- 0
- 派生
- 0
- 平均合并
- 20 小时 34 分钟
- 30 天内合并 PR
- 5
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
iokode/WireShape 的其他 Issue
-
An enumeration is asked what it travels as by a way of its own, beside the form of every other type未关闭
难度 5/5 一周以上 新手友好度 15/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
-
area:repo elsa 3 prio low triaged type:bug
难度 2/5 1-3 小时 新手友好度 72/100
elsa-workflows/elsa-core#9258 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 90/100
iokode/OpinionatedFramework#140 ·
-
accessibility effort: small enhancement
难度 2/5 1-3 小时 新手友好度 78/100
pedersebastian/CustomBossChallenge#185 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100