Last active
May 25, 2018 20:18
-
-
Save twilson63/b5c87e909f7c95b1886b95fe8132cee5 to your computer and use it in GitHub Desktop.
Swagger Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @swagger | |
* /profiles/: | |
* post: | |
* description: "Description here" | |
* parameters: | |
* - name: FHIRBundle | |
* in: body | |
* required: true | |
* schema: | |
* $ref: "#/definitions/Bundle" | |
* responses: | |
* 200: | |
* description: Success | |
* schema: | |
* $ref: "#/definitions/Success" | |
* 409: | |
* description: Conflict | |
* schema: | |
* type: object | |
* properties: | |
* name: | |
* type: string | |
* statusCode: | |
* type: string | |
* status: | |
* type: string | |
* message: | |
* type: string | |
* 500: | |
* description: Internal Server Error | |
* schema: | |
* type: string | |
* properties: | |
* error: | |
* type: string | |
* | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bundle: | |
type: object | |
description: FHIR Bundle | |
required: ["resourceType", "requestType","entry"] | |
properties: | |
resourceType: | |
type: string | |
enum: | |
- Bundle | |
requestType: | |
type: string | |
enum: | |
- Actual | |
- Proposed | |
entry: | |
type: array | |
items: | |
anyOf: | |
- $ref: "#/components/schemas/Patient" | |
- $ref: "#/components/schemas/Medication" | |
- $ref: "#/components/schemas/MedicationStatement" | |
example: | |
requestType: proposed | |
resourceType: Bundle | |
entry: | |
- resourceType: Patient | |
identifiers: | |
- value: 1234 | |
gender: male | |
birthDate: 1970-05-19 | |
- resourceType: Medication | |
code: | |
coding: | |
- system: http://www.nlm.nih.gov/research/umls/rxnorm | |
code: 308047 | |
- resourceType: Medication | |
code: | |
coding: | |
- system: http://www.nlm.nih.gov/research/umls/rxnorm | |
code: 209459 | |
Patient: | |
type: object | |
properties: | |
identifier: | |
type: array | |
items: | |
$ref: "#/components/schemas/identifier" | |
name: | |
type: array | |
items: | |
$ref: "#/components/schemas/HumanName" | |
telcom: | |
type: array | |
items: | |
$ref: "#/components/schemas/ContactPoint" | |
gender: | |
type: string | |
enum: | |
- male | |
- female | |
- unknown | |
- other | |
birthDate: | |
type: string | |
description: >- | |
A date, or partial date (e.g. just year or year + month) as used in human communication. There is no time zone. Dates SHALL be valid dates | |
ContactPoint: | |
type: object | |
properties: | |
system: | |
type: string | |
enum: | |
- phone | |
- fax | |
- pager | |
- url | |
- sms | |
- other | |
value: | |
type: string | |
use: | |
type: string | |
enum: | |
- home | |
- work | |
- temp | |
- old | |
- mobile | |
rank: | |
type: integer | |
period: | |
$ref: '#/components/schemas/Period' | |
Medication: | |
type: object | |
properties: | |
resourceType: | |
type: string | |
enum: | |
- Medication | |
code: | |
$ref: "#/components/schemas/code" | |
MedicationStatement: | |
type: object | |
properties: | |
identifier: | |
$ref: "#/components/schemas/identifier" | |
medication: | |
$ref: "#/components/schemas/Medication" | |
dosage: | |
$ref: "#/components/schemas/Dosage" | |
identifier: | |
type: array | |
items: | |
type: object | |
properties: | |
system: | |
type: string | |
value: | |
type: string | |
code: | |
type: object | |
properties: | |
coding: | |
type: array | |
items: | |
type: object | |
properties: | |
system: | |
type: string | |
code: | |
type: string | |
display: | |
type: string | |
HumanName: | |
type: object | |
properties: | |
use: | |
type: string | |
enum: | |
- usual | |
- official | |
- temp | |
- nickname | |
- anonymous | |
- old | |
- maiden | |
text: | |
type: string | |
description: full name | |
family: | |
type: string | |
given: | |
type: array | |
items: | |
type: string | |
prefix: | |
type: array | |
items: | |
type: string | |
suffix: | |
type: array | |
items: | |
type: string | |
period: | |
$ref: "#/components/schemas/Period" | |
Period: | |
type: object | |
properties: | |
start: | |
type: string | |
description: >- | |
A date, date-time or partial date (e.g. just year or year + month) as used in human communication. If hours and minutes are specified, a time zone SHALL be populated. Seconds must be provided due to schema type constraints but may be zero-filled and may be ignored. Dates SHALL be valid dates. The time "24:00" is not allowed | |
end: | |
type: string | |
description: >- | |
A date, date-time or partial date (e.g. just year or year + month) as used in human communication. If hours and minutes are specified, a time zone SHALL be populated. Seconds must be provided due to schema type constraints but may be zero-filled and may be ignored. Dates SHALL be valid dates. The time "24:00" is not allowed | |
Dosage: | |
type: object | |
properties: | |
text: | |
type: string | |
timing: | |
type: object | |
properties: | |
when: | |
type: array | |
items: | |
type: object | |
properties: | |
code: | |
type: string | |
system: | |
type: string | |
display: | |
type: string | |
ProfilesResponse: | |
type: object | |
properties: | |
ok: | |
type: boolean | |
id: | |
type: number |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"docs": "swagger-jsdoc -d swaggerDef.js server.js" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const HOST = 'https://api.sotria.io' | |
const pkg = require('./package.json') | |
module.exports = { | |
info: { | |
// API informations (required) | |
title: pkg.name, // Title (required) | |
version: pkg.version, // Version (required) | |
description: pkg.description // Description (optional) | |
}, | |
host: HOST, // Host (optional) | |
basePath: '/' // Base path (optional) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment