Skip to content

Commit 69b3548

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

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)
@@ -93,7 +94,7 @@ Detta dokument specificerar reglerna som verktyget tillämpar.
9394

9495
## Område: Dokumentation
9596

96-
**Täckningsgrad: 46%**
97+
**Täckningsgrad: 50%**
9798

9899
### ID: DOK.01
99100

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

406407
---
407408

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

410438
**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
@@ -439,7 +439,7 @@ export class Dok21 extends BaseRuleset {
439439
id: 'DOK.21',
440440
};
441441
given = '$';
442-
message = 'Krav på autentisering SKALL anges i specifikationen ';
442+
message = 'Krav på autentisering SKALL anges i specifikationen.';
443443
then = [
444444
{
445445
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
@@ -527,7 +527,7 @@ testRule('Dok21', [
527527
},
528528
errors: [
529529
{
530-
message: 'Krav på autentisering SKALL anges i specifikationen',
530+
message: 'Krav på autentisering SKALL anges i specifikationen.',
531531
severity: DiagnosticSeverity.Error,
532532
},
533533
],

0 commit comments

Comments
 (0)