Skip to content

Instantly share code, notes, and snippets.

@secustor
Created September 13, 2021 12:25
Show Gist options
  • Save secustor/8ca002e5ff7053ffb5bcf48554ce61b0 to your computer and use it in GitHub Desktop.
Save secustor/8ca002e5ff7053ffb5bcf48554ce61b0 to your computer and use it in GitHub Desktop.
openapi: 3.0.1
info:
title: Auslieferung
version: v1
servers:
- url: /api/v1
# TODO add security OIDC?
paths:
/deliveries:
get:
# TODO add search parameters
responses:
"200":
content:
application/json:
schema:
items:
$ref: '#/components/schemas/Delivery'
type: array
text/json:
schema:
items:
$ref: '#/components/schemas/Delivery'
type: array
description: Returns delivery definitions
"400":
description: Bad request
"401":
description: Unauthorized
"500":
description: Something went horribly wrong on the server side.
summary: Retrieves definitions of deliveries
tags:
- Delivery
/deliveries/{deliveryId}:
get:
parameters:
- description: The unique id of the delivery.
explode: false
in: path
name: deliveryId
required: true
schema:
type: string
style: simple
responses:
"200":
content:
text/plain:
schema:
$ref: '#/components/schemas/Delivery'
application/json:
schema:
$ref: '#/components/schemas/Delivery'
text/json:
schema:
$ref: '#/components/schemas/Delivery'
description: Successfully retrieved delivery
"400":
description: Bad request
"401":
description: Unauthorized
"404":
description: Delivery not found
"500":
description: Something went horribly wrong on the server side.
summary: Loads a definition of a specific delivery
tags:
- Delivery
/deliveries/subscriptions/{subscriptionId}:
get:
parameters:
- description: The unique id of the subscription.
explode: false
in: path
name: subscriptionId
required: true
schema:
type: string
style: simple
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/Subscription'
text/json:
schema:
$ref: '#/components/schemas/Subscription'
description: Successfully retrieved subscriptions
"400":
description: Bad request
"401":
description: Unauthorized
"404":
description: Subscription not found
"500":
description: Something went horribly wrong on the server side.
summary: Loads definitions of all subscriptions
tags:
- Subscription
/deliveries/subscribe:
post:
summary: subscribe to a delivery stream
requestBody:
required: true
description: "subscribe to a delivery stream"
content:
application/json:
schema:
$ref: '#/components/schemas/SubscriptionCreationModel'
callbacks:
DeliveryReleased:
'{$request.body#/callbackUrl}':
post:
requestBody:
description: "subscribe to a delivery stream"
content:
application/json:
schema:
properties:
delivery:
$ref: '#/components/schemas/Delivery'
subscription_id:
$ref: '#/components/schemas/SubscriptionID'
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/DeploymentState'
text/json:
schema:
$ref: '#/components/schemas/DeploymentState'
description: Deployment successful
"202":
content:
application/json:
schema:
$ref: '#/components/schemas/DeploymentState'
text/json:
schema:
$ref: '#/components/schemas/DeploymentState'
description: Successfully accepted deployment. Notify result on callback url update result
"400":
description: Bad request
"401":
description: Unauthorized
"500":
description: Something went horribly wrong on the server side.
summary: Loads definitions of all subscriptions
tags:
- Webhook
responses:
"201":
content:
application/json:
schema:
$ref: '#/components/schemas/Subscription'
text/json:
schema:
$ref: '#/components/schemas/Subscription'
description: Successfully retrieved subscriptions
"400":
description: Bad request
"401":
description: Unauthorized
"500":
description: Something went horribly wrong on the server side.
tags:
- Subscription
/deliveries/unsubscribe:
post:
summary: delete subscription
requestBody:
required: true
description: "remove to a delivery stream"
content:
application/json:
schema:
properties:
subscription_id:
$ref: '#/components/schemas/SubscriptionID'
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/Subscription'
text/json:
schema:
$ref: '#/components/schemas/Subscription'
description: Successfully deleted subscription. Will return the full Subscription object
"400":
description: Bad request
"401":
description: Unauthorized
"404":
description: Subscription not found
"500":
description: Something went horribly wrong on the server side.
tags:
- Subscription
components:
schemas:
Delivery:
type: object
properties:
delivery_id:
type: number
example: 58621
reference:
type: string
example: GKV21DI0124
service:
$ref: '#/components/schemas/ServiceVersion'
release_date:
type: string
example: 2021-10-05T14:48:00.000Z
archive_url:
type: string
example: "https://example.com/aaaaaaaaaaaaaaaaaa/archive.zip"
customers:
type: array
example:
- 'AOK'
- 'BARMER'
status:
type: string
enum:
- 'released'
- 'pulledBack'
- 'preRelease'
ServiceVersion:
properties:
semantic:
type: string
example: 2.4.0
long:
type: string
example: 2.4.0-DI-OC-EAU
Subscription:
properties:
subscription_id:
$ref: '#/components/schemas/SubscriptionID'
allOf:
- $ref: '#/components/schemas/SubscriptionCreationModel'
required:
- subscription_id
SubscriptionCreationModel:
properties:
callbackUrl:
type: string
format: uri
example: "https://microservice.dienstleister.com/endpoint?aParameter=encodedString"
required:
- callbackUrl
DeploymentState:
type: object
properties:
status:
type: string
enum:
- 'succeeded'
- 'failed'
- 'unknown'
SubscriptionID:
type: string
example: aaaaaa-bbbbbbb-ccccc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment