Skip to content

Instantly share code, notes, and snippets.

@ioggstream
Created April 5, 2019 12:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ioggstream/b4fcfd236e088f22ef6398878f0ceb3b to your computer and use it in GitHub Desktop.
Save ioggstream/b4fcfd236e088f22ef6398878f0ceb3b to your computer and use it in GitHub Desktop.
oas3 for async
openapi: 3.0.1
info:
title: RESTbusywaiting
version: "1.0"
description: |-
Questo file descrive semplicemente i metodi di un'API
e non indica tutte le informazioni di metadatazione che
normalmente vanno inserite.
license:
name: Apache 2.0 License
url: http://www.apache.org/licenses/LICENSE-2.0.html
paths:
/tasks:
post:
description: Crea in maniera asincrona un task o una risorsa.
operationId: PushMessage
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/MType'
responses:
202:
description: Preso carico correttamente di M
headers:
Location:
description: URL dove recuperare il risultato
required: true
schema:
type: string
format: uri
content:
application/json:
schema:
$ref: '#/components/schemas/MTaskRef'
'400':
$ref: '#/components/responses/400BadRequest'
default:
$ref: '#/components/responses/default'
/tasks/{id_task}:
get:
description: M Result
operationId: PullResponseById
parameters:
- $ref: '#/components/parameters/id_task'
responses:
200:
description: |-
Lo stato della risorsa o del task. Se il task
è completato o la risorsa è disponibile, il valore
di `status` e' `processed`
content:
application/json:
schema:
$ref: '#/components/schemas/MResponseType'
'400':
$ref: '#/components/responses/400BadRequest'
'404':
$ref: '#/components/responses/404NotFound'
default:
$ref: '#/components/responses/default'
components:
parameters:
id_task:
name: id_task
in: path
required: true
schema:
type: string
responses:
400BadRequest:
description: Richiesta non accoglibile
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
404NotFound:
description: Identificativo non trovato
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
default:
description: |-
Errore inatteso. Questo viene ritornato nel caso ci sia
un errore inatteso. Non vanno mai esposti i dati interni
del server.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
schemas:
Link:
properties:
href:
type: string
format: url
example: 'https://api.example.com/tasks/1234'
type:
type: string
example: self
MTaskRef:
properties:
status:
type: string
example: processing
links:
type: array
items:
$ref: '#/components/schemas/Link'
MType:
type: object
properties:
a:
$ref: '#/components/schemas/AComplexType'
b:
type: string
MResponseType:
type: object
properties:
c:
type: string
status:
type: string
example: processed
AComplexType:
type: object
properties:
a1s:
type: array
items:
type: string
a2:
type: string
ErrorMessage:
$ref: 'https://raw.githubusercontent.com/teamdigitale/openapi/0.0.4/docs/definitions.yaml#/schemas/Problem'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment