Skip to content

Commit 3576dac

Browse files
committed
docs: enhance rules documentation with structured table of contents and improved formatting
1 parent 717641b commit 3576dac

File tree

1 file changed

+61
-29
lines changed

1 file changed

+61
-29
lines changed

rules/index.md

Lines changed: 61 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,41 @@ search_exclude: true
77

88
# Rules
99

10-
### R0001
11-
12-
**HTTP method mismatch**
10+
<!-- TOC -->
11+
* [Rules](#rules)
12+
* [R0001](#r0001)
13+
* [HTTP method mismatch](#http-method-mismatch)
14+
* [R0002](#r0002)
15+
* [HTTP status mismatch](#http-status-mismatch)
16+
* [R0007](#r0007)
17+
* [No matching security scheme](#no-matching-security-scheme)
18+
* [R1001](#r1001)
19+
* [Type mismatch](#type-mismatch)
20+
* [R1002](#r1002)
21+
* [Value mismatch](#value-mismatch)
22+
* [R1003](#r1003)
23+
* [Constraint violation](#constraint-violation)
24+
* [R2001](#r2001)
25+
* [Missing required property](#missing-required-property)
26+
* [R2002](#r2002)
27+
* [Missing optional property](#missing-optional-property)
28+
* [R2003](#r2003)
29+
* [Unknown property](#unknown-property)
30+
* [R3001](#r3001)
31+
* [Discriminator mismatch](#discriminator-mismatch)
32+
* [R3002](#r3002)
33+
* [Invalid discriminator setup](#invalid-discriminator-setup)
34+
* [R3003](#r3003)
35+
* [Missing discriminator](#missing-discriminator)
36+
* [R3004](#r3004)
37+
* [Property not in any schema options](#property-not-in-any-schema-options)
38+
* [R3005](#r3005)
39+
* [Property matches no schema option](#property-matches-no-schema-option)
40+
<!-- TOC -->
41+
42+
## R0001
43+
44+
### HTTP method mismatch
1345

1446
The HTTP method does not match the method defined in the specification.
1547

@@ -41,9 +73,9 @@ The contract expects `GET /orders`, but the request uses `POST`, so a method mis
4173
- Update the client or provider to use the method defined in the specification.
4274
- If the method should be different, update the specification accordingly.
4375

44-
### R0002
76+
## R0002
4577

46-
**HTTP status mismatch**
78+
### HTTP status mismatch
4779

4880
The HTTP status code does not match the expected status code defined in the specification.
4981

@@ -75,9 +107,9 @@ The contract expects a `200` response, but the provider returns `404`, so a stat
75107
- Return the status code defined in the specification.
76108
- If the actual status is correct, update the specification to reflect it.
77109

78-
### R0007
110+
## R0007
79111

80-
**No matching security scheme**
112+
### No matching security scheme
81113

82114
The request does not satisfy the requirements of any defined security scheme.
83115

@@ -111,9 +143,9 @@ The request does not include the required `X-API-Key` header, so no matching sec
111143
- Provide credentials that satisfy one of the defined security schemes.
112144
- If authentication is not required, remove or update the security requirement in the specification.
113145

114-
### R1001
146+
## R1001
115147

116-
**Type mismatch**
148+
### Type mismatch
117149

118150
The value type does not match the expected type defined in the specification.
119151

@@ -145,9 +177,9 @@ When validating the response from the provider, `price` is a string instead of a
145177
- Update the provider to return a numeric `price`, not a string.
146178
- If the string is correct, update the specification to accept a string type.
147179

148-
### R1002
180+
## R1002
149181

150-
**Value mismatch**
182+
### Value mismatch
151183

152184
The value does not match the expected value defined in the specification.
153185

@@ -180,9 +212,9 @@ During validation of the request from consumer to stub, `status` is not one of t
180212
- Send a value that matches the specification enum.
181213
- If the new value is valid, update the specification enum to include it.
182214

183-
### R1003
215+
## R1003
184216

185-
**Constraint violation**
217+
### Constraint violation
186218

187219
The value does not satisfy the constraints defined in the specification.
188220

@@ -215,9 +247,9 @@ The request from consumer to stub is validated and fails because `username` is s
215247
- Provide values that satisfy the constraint (e.g., a longer `username`).
216248
- If the constraint is too strict, relax it in the specification.
217249

218-
### R2001
250+
## R2001
219251

220-
**Missing required property**
252+
### Missing required property
221253

222254
A required property defined in the specification is missing.
223255

@@ -251,9 +283,9 @@ Request validation fails because `email` is required but missing.
251283
- Include all required properties in the payload.
252284
- If the property should not be required, update the specification.
253285

254-
### R2002
286+
## R2002
255287

256-
**Missing optional property**
288+
### Missing optional property
257289

258290
An optional property defined in the specification is missing.
259291

@@ -288,9 +320,9 @@ When optional fields are enforced, the missing `description` is reported as an o
288320
- If strict checking is not intended, run with the default optional behavior.
289321
- If the property should be required, mark it as required in the specification.
290322

291-
### R2003
323+
## R2003
292324

293-
**Unknown property**
325+
### Unknown property
294326

295327
A property was found that is not defined in the specification.
296328

@@ -325,9 +357,9 @@ During response validation, `extra` is not defined and `additionalProperties: fa
325357
- Remove unexpected properties from the payload.
326358
- If the property is valid, add it to the specification or allow additional properties.
327359

328-
### R3001
360+
## R3001
329361

330-
**Discriminator mismatch**
362+
### Discriminator mismatch
331363

332364
The value provided does not match the discriminator defined in the specification.
333365

@@ -383,9 +415,9 @@ The discriminator value does not match any mapping, so validation of the request
383415
- Use a discriminator value that maps to a defined schema.
384416
- If a new subtype is needed, add it to the specification and discriminator mapping.
385417

386-
### R3002
418+
## R3002
387419

388-
**Invalid discriminator setup**
420+
### Invalid discriminator setup
389421

390422
The discriminator property defined in the specification is missing from the subschemas.
391423

@@ -435,9 +467,9 @@ The discriminator is declared, but neither subschema defines the `type` property
435467
- Add the discriminator property to each subschema and mark it required.
436468
- Ensure the discriminator mapping values align with the schema definitions.
437469

438-
### R3003
470+
## R3003
439471

440-
**Missing discriminator**
472+
### Missing discriminator
441473

442474
The discriminator property defined in the specification is missing.
443475

@@ -493,9 +525,9 @@ The payload lacks the discriminator property `type`, so validation reports a mis
493525
- Include the discriminator property in the payload.
494526
- If the discriminator is not needed, remove it and adjust the composed schema.
495527

496-
### R3004
528+
## R3004
497529

498-
**Property not in any schema options**
530+
### Property not in any schema options
499531

500532
The property is not defined in any available schema options.
501533

@@ -536,9 +568,9 @@ During validation of the request from consumer to stub, `c` is not present in an
536568
- Send a payload that matches at least one `anyOf` option.
537569
- If `c` is valid, add it to one of the option schemas or add another option.
538570

539-
### R3005
571+
## R3005
540572

541-
**Property matches no schema option**
573+
### Property matches no schema option
542574

543575
The property does not satisfy any available schema options.
544576

0 commit comments

Comments
 (0)