Skip to content

Commit 3873810

Browse files
chore: sync with main
Signed-off-by: Nicklas Silversved <nicklas.silversved@digg.se>
1 parent 844f8c4 commit 3873810

File tree

15 files changed

+1182
-255
lines changed

15 files changed

+1182
-255
lines changed

README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,73 @@ npm start -- -f openapi.yaml
108108
```
109109
> Notera: Att alla kommandon lokalt körs med `npm start --`.
110110
111+
### API (Application programming interface) läge
112+
```bash
113+
npm start -- -m api
114+
```
115+
116+
Validera mot en endpoint:
117+
```bash
118+
POST http://localhost:3000/api/v1/validation/validate
119+
```
120+
121+
Request body - application/json`
122+
```bash
123+
{
124+
"yaml": "<base64encoded file>",
125+
"categories": [
126+
"CATEGORY1",
127+
"CATEGORY2"
128+
]
129+
}
130+
```
131+
132+
Använd detta kommando för att validera en yaml-fil via terminalen, här kan du även validera mot specifika [kategorier](#tillgängliga-kategorier-med-regler):
133+
```bash
134+
curl -X POST http://localhost:3000/api/v1/validation/validate \
135+
-H "Content-Type: application/json" \
136+
-d "{\"yaml\": \"$(base64 -w 0 Path_to_the_YAML_file)\", \"categories\": [\"CATEGORY1\", \"CATEGORY2\"]}"
137+
```
138+
Exempel
139+
```bash
140+
curl -X POST http://localhost:3000/api/v1/validation/validate \
141+
-H "Content-Type: application/json" \
142+
-d "{\"yaml\": \"$(base64 -w 0 apis/dok-api.yaml)\", \"categories\": [\"DokRules\", \"UfnRules\"]}"
143+
```
144+
145+
Det går också att validera via en url istället för en fil men då behöver API-läget startas med en extra flagga för att låsa upp möjligheten att nyttja endpointen:
146+
```bash
147+
npm start -- -m api --enableUrlValidation
148+
```
149+
150+
Använd detta kommando för att validera en yaml-fil baserat på en url via terminalen, även här kan man skicka med kategorier för valideringen. Se tidigare kommando:
151+
```bash
152+
curl -sS -X POST http://localhost:3000/api/v1/validation/url \
153+
-H "Content-Type: application/json" \
154+
-d '{"url":"<URL_TO_YAML_FILE>"}' | jq
155+
```
156+
157+
Exempel:
158+
```bash
159+
curl -sS -X POST http://localhost:3000/api/v1/validation/url \
160+
-H "Content-Type: application/json" \
161+
-d '{"url":"https://testurl.com/q/openapi"}' | jq
162+
```
163+
164+
#### Ladda ned information om regelutfall som en Excel-fil via api-läge
165+
166+
För att spara information om regelutfall från diagnostiseringen till en avstämningsfil i Excel, använd resultatet från tidigare validering som "result" nedan:
167+
```bash
168+
curl -X POST http://localhost:5173/api/validation/generate-report \
169+
-H "Content-Type: application/json" \
170+
-o avstamningsfil.xlsx \
171+
-d '{
172+
"result": [],
173+
"categories": []
174+
}'
175+
176+
```
177+
111178
## Versioner
112179
Main-branchen, feature-brancher, pre-release- och testversioner används med reservation för att de kan innehålla funktionalitet som inte är garanterad att den är testad på samma sätt som en stabil version.
113180

0 commit comments

Comments
 (0)