Ontwikkel een OpenAPI Specificatie voor API Logging en Tracing
description
Met deze prompt kan de gebruiker een OpenAPI specificatie maken die gedetailleerde logging- en tracingfunctionaliteiten beschrijft, wat essentieel is voor het monitoren van API-prestaties en het oplossen van problemen. Het helpt gebruikers om transparante en traceerbare API's te ontwerpen, wat betrouwbaarheid en onderhoudbaarheid verhoogt. Dit is een unieke invalshoek die niet overlapt met bestaande prompts die zich richten op beveiliging, documentatie of mocking.
prompt
Help me een OpenAPI specificatie te maken die gedetailleerde logging en tracing functionaliteiten voor mijn API beschrijft.
API Naam: <voer de naam van mijn API in>
Logniveau's (bijv. info, debug, error): <beschrijf de logniveau's die moeten worden vastgelegd>
Tracing Methode (bijv. distributed tracing, corre ...
try_prompt
generate_helper
disclaimerOnPageApi
tags
ai_answers
provider: openai
model: gpt-4.1-nano
openapi: 3.0.3
info:
title: Klantenbeheer API
versie: 1.0.0
description: >
API voor het beheer van klanten, orders en facturen met gedetailleerde logging en tracing functionaliteiten.
Deze specificatie documenteert de logging- en tracing-eisen.
servers:
- url: https://api.klantenbeheer.nl
components:
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: X-API-Key
parameters:
CorrelationIdHeader:
name: X-Correlation-ID
in: header
description: >
Unieke correlation ID voor distributed tracing.
required: false
schema:
type: string
security:
- ApiKeyAuth: []
paths:
/klanten:
get:
summary: "Lijst van klanten"
description: >
Deze endpoint retourneert een lijst van klanten. Voor logging en tracing wordt
gebruik gemaakt van correlation IDs en logging op verschillende niveaus.
parameters:
- $ref: '#/components/parameters/CorrelationIdHeader'
responses:
'200':
description: "Lijst van klanten"
tags:
- Klanten
x-logging:
niveaus:
- info
- error
- debug
belang: "Alleen relevante logs worden gegenereerd afhankelijk van het logniveau."
x-tracing:
methode: distributed tracing
correlationId: true
/orders:
get:
summary: "Lijst van orders"
description: >
Endpoint voor het ophalen van orders, met tracing en logging zoals gespecificeerd.
parameters:
- $ref: '#/components/parameters/CorrelationIdHeader'
responses:
'200':
description: "Lijst van orders"
tags:
- Orders
x-logging:
niveaus:
- info
- error
- debug
belang: "Gedetailleerde logging voor alle niveaus met trace ID."
x-tracing:
methode: distributed tracing
correlationId: true
/facturen:
get:
summary: "Lijst van facturen"
description: >
Endpoint voor factuurgegevens, met ondersteuning voor tracing en logging.
parameters:
- $ref: '#/components/parameters/CorrelationIdHeader'
responses:
'200':
description: "Lijst van facturen"
tags:
- Facturen
x-logging:
niveaus:
- info
- error
- debug
belang: "Logging met trace ID voor elke request."
x-tracing:
methode: distributed tracing
correlationId: true
# Algemene beschrijving van logging en tracing
x-logging- en-tracing:
beschrijving: >
De API ondersteunt gedetailleerde logging op niveaus: info, error, debug.
Tracing wordt uitgevoerd via distributed tracing met correlation IDs,
zodat elke request traceerbaar is door de hele stack.
implementatie:
- Alle endpoints gebruiken een header X-Correlation-ID voor correlation.
- Logging wordt aangepast op basis van het ingestelde logniveau.
- Distributed tracing wordt ondersteund door het doorgeven van correlation IDs.
- Authenticatie via API key in header X-API-Key.
```
provider: deepseek
model: deepseek-chat
```yaml
openapi: 3.0.3
info:
title: Klantenbeheer API
description: API voor klantenbeheer met uitgebreide logging en tracing functionaliteiten
version: 1.0.0
contact:
name: API Ondersteuning
email: support@klantenbeheer.nl
servers:
- url: https://api.klantenbeheer.nl/v1
description: Productie server
paths:
/klanten:
get:
summary: Haal klantenlijst op
description: Endpoint voor het ophalen van alle klanten met logging en tracing
operationId: getKlanten
tags:
- Klanten
security:
- apiKey: []
parameters:
- name: X-Correlation-ID
in: header
description: Unieke correlatie ID voor distributed tracing
required: true
schema:
type: string
format: uuid
example: "123e4567-e89b-12d3-a456-426614174000"
responses:
'200':
description: Succesvolle response met klantenlijst
headers:
X-Trace-ID:
description: Trace ID voor distributed tracing
schema:
type: string
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/Klant'
log_info:
type: object
properties:
correlation_id:
type: string
timestamp:
type: string
format: date-time
log_level:
type: string
enum: [info, error, debug]
default: info
'400':
description: Ongeldige request
'500':
description: Interne serverfout
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
post:
summary: Maak nieuwe klant aan
description: Endpoint voor het aanmaken van een nieuwe klant
operationId: createKlant
tags:
- Klanten
security:
- apiKey: []
parameters:
- name: X-Correlation-ID
in: header
description: Unieke correlatie ID voor distributed tracing
required: true
schema:
type: string
format: uuid
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NieuweKlant'
responses:
'201':
description: Klant succesvol aangemaakt
headers:
X-Trace-ID:
description: Trace ID voor distributed tracing
schema:
type: string
'400':
description: Ongeldige klantgegevens
/orders:
get:
summary: Haal orders op
description: Endpoint voor het ophalen van orders met uitgebreide logging
operationId: getOrders
tags:
- Orders
security:
- apiKey: []
parameters:
- name: X-Correlation-ID
in: header
description: Unieke correlatie ID voor distributed tracing
required: true
schema:
type: string
format: uuid
responses:
'200':
description: Succesvolle response met orders
headers:
X-Trace-ID:
description: Trace ID voor distributed tracing
schema:
type: string
/facturen:
get:
summary: Haal facturen op
description: Endpoint voor het ophalen van facturen met uitgebreide logging
operationId: getFacturen
tags:
- Facturen
security:
- apiKey: []
parameters:
- name: X-Correlation-ID
in: header
description: Unieke correlatie ID voor distributed tracing
required: true
schema:
type: string
format: uuid
responses:
'200':
description: Succesvolle response met facturen
headers:
X-Trace-ID:
description: Trace ID voor distributed tracing
schema:
type: string
components:
securitySchemes:
apiKey:
type: apiKey
name: X-API-Key
in: header
description: API key voor authenticatie
schemas:
Klant:
type: object
properties:
id:
type: string
format: uuid
naam:
type: string
email:
type: string
format: email
telefoon:
type: string
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
required:
- id
- naam
- email
NieuweKlant:
type: object
properties:
naam:
type: string
example: "Jan Jansen"
email:
type: string
format: email
example: "jan@voorbeeld.nl"
telefoon:
type: string
example: "+31612345678"
required:
- naam
- email
ErrorResponse:
type: object
properties:
error:
type: object
properties:
code:
type: string
message:
type: string
correlation_id:
type: string
timestamp:
type: string
format: date-time
log_level:
type: string
enum: [error]
default: error
trace_id:
type: string
debug_info:
type: object
properties:
stack_trace:
type: string
additional_info:
type: string
description: Alleen beschikbaar wanneer log_level op debug staat
LogEntry:
type: object
properties:
correlation_id:
type: string
description: Unieke correlatie ID voor het traceren van requests door het systeem
trace_id:
type: string
description: Trace ID voor distributed tracing across services
timestamp:
type: string
format: date-time
log_level:
type: string
enum: [info, error, debug]
endpoint:
type: string
method:
type: string
enum: [GET, POST, PUT, DELETE]
user_id:
type: string
duration_ms:
type: integer
status_code:
type: integer
parameters:
CorrelationIDHeader:
name: X-Correlation-ID
in: header
description: Unieke correlatie ID voor distributed tracing
required: true
schema:
type: string
format: uuid
headers:
TraceIDHeader:
description: Trace ID header voor distributed tracing
schema:
type: string
responses:
LoggingResponse:
description: Standaard response met logging informatie
headers:
X-Trace-ID:
$ref: '#/components/headers/TraceIDHeader'
content:
application/json:
schema:
type: object
properties:
log_info:
$ref: '#/components/schemas/LogEntry'
security:
- apiKey: []
```