Skip to content

Instantly share code, notes, and snippets.

@ioggstream
Last active September 28, 2018 12:15
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/002e901e45c5f2ad0a6021d9c3768959 to your computer and use it in GitHub Desktop.
Save ioggstream/002e901e45c5f2ad0a6021d9c3768959 to your computer and use it in GitHub Desktop.
Sample yaml
---
openapi: 3.0.0
info:
title: Ricerca PEC
description: |-
#### Descrizione
API che recupera gli indirizzi di PEC a partire dal codice fiscale o partita IVA.
#### Note
version: "1.0"
x-summary: Specifiche non ufficiali.
servers:
- url: http://{host}:{port}/api-pec/1.0
paths:
/status:
get:
responses:
200:
description: Ritorna lo stato del servizio in formato problem+json.
content:
application/json:
schema:
$ref: '#/components/schemas/Problem'
/pec:
post:
summary: Questa e' una "get with body' non cacheable. Valutare una get normale coi parametri in query.
description: |
Recupera la PEC a partire dal codiceFiscale
requestBody:
$ref: '#/components/requestBodies/Richiesta'
responses:
200:
description: Risposta corretta.
content:
application/json:
schema:
$ref: '#/components/schemas/Risultati'
security:
- apiToken: []
authorizationBearer: []
components:
schemas:
Pec:
required:
- pec
- bancaDati
- dataValidita
properties:
pec:
format: email
type: string
example: foo@pec.example.it
bancaDati:
type: string
example: inipec
dataValidita:
format: date-time
type: string
PecError:
properties:
codice:
type: string
example: KO
descrizione:
type: string
example: Servizio non raggiungibile
bancaDati:
type: string
example: inipec
Risultati:
properties:
risultati:
type: array
items:
$ref: '#/components/schemas/Pec'
errori:
type: array
items:
$ref: '#/components/schemas/PecError'
RisultatiOld:
# Nel vecchio modello è da capire come gestire uno schema
# visto che il nome della banca dati e' nel valore della property.
properties:
inipec:
properties:
Esiti:
anyOf:
- $ref: '#/components/schemas/PecError'
- $ref: '#/components/schemas/Pec'
Problem:
$ref: https://teamdigitale.github.io/openapi/schemas/problem.yaml#/Problem
Richiesta:
required:
- bancheDatiEscluse
- codiceFiscale
type: object
properties:
bancheDatiEscluse:
type: array
items:
type: string
example:
- indicepa
- inipec
codiceFiscale:
type: string
example: AAABBB77T05E472I
requestBodies:
Richiesta:
description: |
La chiamata dovrà essere effettuata in POST in quanto dovrà essere fornito il JSON atteso in input, avente in input la possibilità di escludere l’interrogazione a determinate banche dati e il codice fiscale o la partita iva da ricercare.
content:
application/json:
schema:
$ref: '#/components/schemas/Richiesta'
required: true
securitySchemes:
apiToken:
type: apiKey
description: |
I due access token saranno identici, il primo servirà per gestire il permesso all’utilizzo dell’api,
il secondo per poter effettuare l’elaborazione sottostante.
name: AccessToken
in: header
authorizationBearer:
type: apiKey
description: |
Un access Bearer token per gestire il permesso all’utilizzo dell’api,
identico ad AccessToken utilizzato per effettuare l’elaborazione sottostante.
name: Authorization
in: header
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment