Skip to content

Commit c1c894f

Browse files
committed
docs: add documentation for rule DOK.21
Signed-off-by: Mats Johansson <extern.mats.johansson@digg.se>
1 parent 9e8d3fc commit c1c894f

File tree

6 files changed

+32
-3
lines changed

6 files changed

+32
-3
lines changed

GUIDELINES.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Detta dokument specificerar reglerna som verktyget tillämpar.
4141
- [ID: DOK.17](#id-dok17)
4242
- [ID: DOK.19](#id-dok19)
4343
- [ID: DOK.20](#id-dok20)
44+
- [ID: DOK.21](#id-dok21)
4445
2. [Område: Datum- och tidsformat](#område-datum--och-tidsformat)
4546
- [ID: DOT.01](#id-dot01)
4647
- [ID: DOT.04](#id-dot04)
@@ -92,7 +93,7 @@ Detta dokument specificerar reglerna som verktyget tillämpar.
9293

9394
## Område: Dokumentation
9495

95-
**Täckningsgrad: 46%**
96+
**Täckningsgrad: 50%**
9697

9798
### ID: DOK.01
9899

@@ -404,6 +405,33 @@ I exemplet ovan, så exemplifieras regeln med GET samt en POST operation, där r
404405

405406
---
406407

408+
### ID: DOK.21
409+
410+
**Krav:** Krav på autentisering SKALL anges i specifikationen.
411+
412+
**Typ:** SKALL
413+
414+
**JSON Path Plus-uttryck:**
415+
416+
```
417+
$
418+
```
419+
420+
**Förklaring:**
421+
Regeln förutsätter att det finns minst en förekomst av objektet `security`, antingen på rot- eller operationsnivå.
422+
423+
**Exempel:**
424+
425+
![Exempelbild som visar var security-objektet kan existera i en OpenAPI description](images/dok21-1.png)
426+
427+
_Security-objektet kan existera på antingen rot- eller operationsnivå, eller båda._
428+
429+
![Exempelbild som visar att security-objektet också kan användas när API:et saknar säkerhet](images/dok21-2.png)
430+
431+
_Om säkerhet saknas så bör det signaleras genom att tilldela security-objektet en tom array._
432+
433+
---
434+
407435
## Område: Datum- och tidsformat
408436

409437
**Täckningsgrad: 50%**

REUSE.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ path = [
3030
"images/dok17.png",
3131
"images/dok19.png",
3232
"images/dok20.png",
33+
"images/dok21.png",
3334
"images/dok3.png",
3435
"images/dok6-1.png",
3536
"images/dok6-2.png",

images/dok21-1.png

41.4 KB
Loading

images/dok21-2.png

13 KB
Loading

src/rulesets/DokRules.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ export class Dok21 extends BaseRuleset {
435435
id: 'DOK.21',
436436
};
437437
given = '$';
438-
message = 'Krav på autentisering SKALL anges i specifikationen ';
438+
message = 'Krav på autentisering SKALL anges i specifikationen.';
439439
then = [
440440
{
441441
function: (targetVal: OpenAPIObject, _opts: string, paths: string[]) => {

tests/unit/dok.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ testRule('Dok21', [
525525
},
526526
errors: [
527527
{
528-
message: 'Krav på autentisering SKALL anges i specifikationen',
528+
message: 'Krav på autentisering SKALL anges i specifikationen.',
529529
severity: DiagnosticSeverity.Error,
530530
},
531531
],

0 commit comments

Comments
 (0)