Ontwikkel een OpenAPI Specificatie voor API Lifecycle Management en Automatisering
description
Met deze prompt kan de gebruiker een OpenAPI specificatie maken die niet alleen de API definieert, maar ook het beheer en de automatisering van het volledige levenscyclusproces ondersteunt. Dit helpt fouten te verminderen, versnelt deployment, en maakt onderhoud efficiënter in vergelijking met standaard specificaties die alleen endpoints beschrijven.
prompt
Help me bij het creëren van een OpenAPI specificatie die gericht is op het beheren en automatiseren van de volledige levenscyclus van mijn API, inclusief deployment, versiebeheer, en automatische updates.
API Naam: <voer de naam van mijn API in>
Lifecycle Processen (bijv. deployment, rollback, versiebeheer): <beschrijf de processe ...
try_prompt
generate_helper
disclaimerOnPageApi
tags
ai_answers
provider: openai
model: gpt-4.1-nano
openapi: 3.0.3
info:
title: E-commerce API
description: >
API voor het beheren van producten, bestellingen en klanten in een e-commerce omgeving.
Deze specificatie bevat ook de lifecycle management processen zoals deployment, rollback en versiebeheer,
inclusief automatisering via Jenkins en GitHub Actions.
version: 1.0.0
servers:
- url: https://api.ecommerce.com/v1
description: Productieomgeving
components:
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: X-API-KEY
schemas:
Error:
type: object
properties:
code:
type: integer
example: 400
message:
type: string
example: Ongeldige aanvraag
# Versiebeheer en lifecycle management endpoints
paths:
/lifecycle/deploy:
post:
summary: Deploy nieuwe versie van de API
description: >
Triggert een deployment proces via automatiseringstools zoals Jenkins of GitHub Actions.
Voor automatische deployment wordt deze endpoint aangeroepen met de gewenste versie.
security:
- ApiKeyAuth: []
requestBody:
description: Specificatie van de versie die gedeployed moet worden
required: true
content:
application/json:
schema:
type: object
properties:
version:
type: string
example: "1.0.1"
environment:
type: string
enum: [production, staging]
example: production
responses:
'200':
description: Deployment gestart
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: success
message:
type: string
example: Deployment naar productie gestart.
'400':
$ref: '#/components/schemas/Error'
/lifecycle/rollback:
post:
summary: Rollback naar vorige versie
description: >
Voert een rollback uit naar de vorige stabiele versie via automatiseringstools.
security:
- ApiKeyAuth: []
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
targetVersion:
type: string
description: Versie waarnaar teruggegaan moet worden. Indien leeg, wordt de laatste stabiele versie gebruikt.
example: "1.0.0"
responses:
'200':
description: Rollback gestart
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: success
message:
type: string
example: Rollback naar versie 1.0.0 gestart.
'400':
$ref: '#/components/schemas/Error'
/versions:
get:
summary: Overzicht van alle API-versies
description: Geeft een lijst van alle beschikbare versies met status.
security:
- ApiKeyAuth: []
responses:
'200':
description: Lijst van versies
content:
application/json:
schema:
type: object
properties:
versions:
type: array
items:
type: object
properties:
version:
type: string
example: "1.0.0"
status:
type: string
enum: [deployed, staging, deprecated]
example: deployed
deployedAt:
type: string
format: date-time
example: "2023-10-01T12:00:00Z"
# API operation endpoints (voorbeeld)
/products:
get:
summary: Lijst van producten
description: Bevat een lijst van alle producten.
security:
- ApiKeyAuth: []
responses:
'200':
description: Lijst van producten
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Product'
'401':
$ref: '#/components/schemas/Error'
post:
summary: Product toevoegen
description: Voegt een nieuw product toe aan de catalogus.
security:
- ApiKeyAuth: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Product'
responses:
'201':
description: Product aangemaakt
'400':
$ref: '#/components/schemas/Error'
# Schema voor Product
schemas:
Product:
type: object
properties:
id:
type: string
example: "prod-123"
name:
type: string
example: "Laptop"
description:
type: string
example: "Een krachtige laptop"
price:
type: number
format: float
example: 999.99
stock:
type: integer
example: 50
# Automatisering en lifecycle management documentatie
x-lifecycle-management:
description: >
Deze API specificatie ondersteunt het volledige lifecycle management van de API via endpoints voor deployment en rollback.
Automatiseringstools zoals Jenkins en GitHub Actions kunnen deze endpoints gebruiken om continue integratie en deployment te automatiseren.
automationTools:
- Jenkins
- GitHub Actions
authenticatie:
methode: API sleutel via header (X-API-KEY)
beschrijving: >
Voor elke operatie is een geldige API sleutel vereist. Deze wordt in de header meegestuurd.
deployment:
beschrijving: >
Gebruik /lifecycle/deploy endpoint om nieuwe versies te deployen via geautomatiseerde pipelines.
rollback:
beschrijving: >
Gebruik /lifecycle/rollback endpoint om terug te keren naar een vorige versie wanneer nodig.
versiebeheer:
beschrijving: >
Via /versions endpoint krijgt u inzicht in alle beschikbare versies en hun status.
```
provider: deepseek
model: deepseek-chat
Zeker, hier is een OpenAPI 3.0.0-specificatie in YAML voor jouw E-commerce API lifecycle management:
```yaml
openapi: 3.0.0
info:
title: E-commerce API Lifecycle Management
description: |
API voor het beheren en automatiseren van de volledige levenscyclus van de E-commerce API.
Inclusief deployment, versiebeheer, rollback en automatische updates via Jenkins en GitHub Actions.
version: 1.0.0
contact:
name: API Beheer Team
email: api-beheer@example.com
servers:
- url: https://api.jouw-ecommerce-platform.nl/v1
description: Productie omgeving
- url: https://staging-api.jouw-ecommerce-platform.nl/v1
description: Staging omgeving
components:
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: X-API-Key
description: API sleutel voor authenticatie
schemas:
DeploymentRequest:
type: object
required:
- version
- environment
properties:
version:
type: string
description: Versie die gedeployed moet worden (bijv. "v1.2.3")
example: "v1.2.3"
environment:
type: string
enum: [staging, production]
description: Doelomgeving voor deployment
example: "staging"
force_redeploy:
type: boolean
description: Forceer redeploy zelfs als versie gelijk is
default: false
jenkins_build_id:
type: string
description: Optionele specifieke Jenkins build ID
example: "jenkins-build-123"
DeploymentResponse:
type: object
properties:
deployment_id:
type: string
description: Unieke ID van de deployment
example: "dep-123456"
status:
type: string
enum: [started, in_progress, completed, failed]
description: Huidige status van de deployment
jenkins_job_url:
type: string
description: URL naar Jenkins job voor monitoring
example: "https://jenkins.jouw-platform.nl/job/ecommerce-deploy/123/"
estimated_completion_time:
type: string
format: date-time
description: Geschatte voltooiingstijd
RollbackRequest:
type: object
required:
- target_version
- environment
properties:
target_version:
type: string
description: Versie waar naar teruggerold moet worden
example: "v1.1.0"
environment:
type: string
enum: [staging, production]
description: Omgeving voor rollback
example: "production"
reason:
type: string
description: Reden voor de rollback
example: "Kritieke bug in huidige versie"
LifecycleStatus:
type: object
properties:
current_version:
type: string
description: Huidige geïmplementeerde versie
deployment_history:
type: array
items:
type: object
properties:
version:
type: string
deployed_at:
type: string
format: date-time
deployed_by:
type: string
status:
type: string
github_actions_status:
type: object
properties:
last_successful_build:
type: string
format: date-time
last_failed_build:
type: string
format: date-time
workflow_runs:
type: array
items:
type: object
properties:
id:
type: string
status:
type: string
conclusion:
type: string
security:
- ApiKeyAuth: []
paths:
/deployments:
post:
summary: Start een nieuwe deployment
description: |
Start een geautomatiseerde deployment via Jenkins pipeline.
Deze endpoint triggert de CI/CD pipeline voor de opgegeven versie.
tags:
- Deployment
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/DeploymentRequest'
responses:
'202':
description: Deployment succesvol gestart
content:
application/json:
schema:
$ref: '#/components/schemas/DeploymentResponse'
'400':
description: Ongeldige deployment request
'401':
description: Niet geautoriseerd
'500':
description: Interne serverfout bij starten deployment
get:
summary: Bekijk deployment geschiedenis
description: Haal de deployment geschiedenis op voor alle omgevingen
tags:
- Deployment
parameters:
- name: environment
in: query
schema:
type: string
enum: [staging, production]
description: Filter op specifieke omgeving
- name: limit
in: query
schema:
type: integer
default: 10
description: Aantal deployments om op te halen
responses:
'200':
description: Deployment geschiedenis succesvol opgehaald
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/DeploymentResponse'
'401':
description: Niet geautoriseerd
/deployments/{deploymentId}:
get:
summary: Bekijk specifieke deployment status
description: Haal de huidige status op van een specifieke deployment
tags:
- Deployment
parameters:
- name: deploymentId
in: path
required: true
schema:
type: string
description: ID van de deployment
responses:
'200':
description: Deployment status succesvol opgehaald
content:
application/json:
schema:
$ref: '#/components/schemas/DeploymentResponse'
'404':
description: Deployment niet gevonden
'401':
description: Niet geautoriseerd
/rollbacks:
post:
summary: Voer een rollback uit
description: |
Start een rollback naar een vorige versie via Jenkins pipeline.
Deze endpoint triggert de rollback procedure.
tags:
- Rollback
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RollbackRequest'
responses:
'202':
description: Rollback succesvol gestart
content:
application/json:
schema:
$ref: '#/components/schemas/DeploymentResponse'
'400':
description: Ongeldige rollback request
'401':
description: Niet geautoriseerd
'500':
description: Interne serverfout bij starten rollback
/lifecycle/status:
get:
summary: Haal lifecycle status op
description: |
Bekijk de huidige status van de API lifecycle, inclusief versie informatie,
deployment geschiedenis en GitHub Actions status.
tags:
- Lifecycle Management
responses:
'200':
description: Lifecycle status succesvol opgehaald
content:
application/json:
schema:
$ref: '#/components/schemas/LifecycleStatus'
'401':
description: Niet geautoriseerd
/webhooks/github-actions:
post:
summary: GitHub Actions webhook
description: |
Webhook endpoint voor GitHub Actions om build status updates te ontvangen.
Gebruikt voor automatische status updates in het lifecycle management.
tags:
- Automatisering
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
event:
type: string
description: Type GitHub event
action:
type: string
description: Uitgevoerde actie
repository:
type: object
properties:
name:
type: string
workflow_run:
type: object
properties:
id:
type: string
status:
type: string
conclusion:
type: string
responses:
'200':
description: Webhook succesvol verwerkt
'400':
description: Ongeldige webhook payload
tags:
- name: Deployment
description: Endpoints voor het beheren van API deployments
- name: Rollback
description: Endpoints voor het uitvoeren van rollbacks
- name: Lifecycle Management
description: Algemene lifecycle management endpoints
- name: Automatisering
description: Automatisering en integratie endpoints
```
Deze OpenAPI specificatie bevat:
**Authenticatie:**
- API Key authenticatie via X-API-Key header
**Lifecycle Management:**
- Deployment starten via Jenkins
- Rollback functionaliteit
- Deployment status monitoring
- Versiebeheer geschiedenis
**Automatisering:**
- Integratie met Jenkins voor CI/CD
- GitHub Actions webhook voor automatische updates
- Status monitoring van automatiseringstools
**Functionaliteiten:**
- Starten en monitoren van deployments
- Uitvoeren van rollbacks
- Bekijken van deployment geschiedenis
- Lifecycle status monitoring
- Webhook integratie voor automatisering
De specificatie is volledig in het Nederlands en richt zich op de door jou gevraagde lifecycle processen en automatiseringstools.