@oslo-flanders/swagger-generator
v3.1.0
Published
Generate OpenAPI Swagger YAML documentation.
Readme
OSLO Swagger Generator
Given an OSLO-compliant RDF file, this tool generates a Swagger API from it.
Install
npm install @oslo-flanders/swagger-generatorGlobal install
To use the service from the command line anywhere, you can install it globally.
npm install -g @oslo-flanders/swagger-generatorAPI
The service is executed from the CLI and expects the following parameters:
| Parameter | Description | Required | Possible values |
| ------------------ | ------------------------------------------------------------ | ------------------ | --------------------------- |
| --input | The URL or local file path of an OSLO-compliant RDF file | :heavy_check_mark: | |
| --output | The name of the output file | :heavy_check_mark: | |
| --language | The language in which the Swagger must be generated (labels) | No | |
| --primaryLanguage | The primary language of the API. Output files for this language keep their original name, while other languages get a _{language} suffix | No | nl (default) |
| --versionSwagger | Swagger OpenAPI specification version | :heavy_check_mark: | |
| --versionAPI | API version | :heavy_check_mark: | |
| --title | Title of the API document | :heavy_check_mark: | |
| --description | Description of the API document | :heavy_check_mark: | |
| --contextURL | JSON-LD context URL of the datastandard used in the API | :heavy_check_mark: | |
| --baseURL | API base URL for endpoints and PURIs | :heavy_check_mark: | |
| --contactName | Name of the person or organisation to contact about the API | No | |
| --contactEmail | E-mail to contact for questions about the API | No | |
| --contactURL | Link to follow as contact about the API | No | |
| --licenseName | Name of the license of the API | No | |
| --licenseURL | URL of the license of the API | No | |
| --excludeClasses | Classes to exclude from the generated Swagger | No | Persoon Organisatie Test |
| --excludeProperties | Properties to exclude from the generated Swagger | No | voornaam achternaam |
| --disableLinks | Disable the creation of links | No | true or false (default) |
| --expanded | Disable the creation of links | No | true or false (default) |
| --excludeClassesExpanded | Classes to exclude from expanding their properties in JSON-LD | No | Persoon Organisatie Test |
| --excludePropertiesExpanded | Properties to exclude from expanding in JSON-LD | No | voornaam achternaam |
| --outputFormat | Output format for the generated files. Can be specified multiple times to generate multiple formats at once. | No | application/json (default) or application/yaml |
| --silent | Suppress log messages | No | true or false (default) |
Usage
oslo-generator-swagger --input report.jsonld --output swagger.json --language nl --versionSwagger 3.0.4 --versionAPI 1.0.0 --title "Mijn API" --description "Mijn API beschrijving." --contextURL http://example.com/context.jsonld --baseURL http://example.com
oslo-generator-swagger --input report.jsonld --output swagger.json --language nl --versionSwagger 3.0.4 --versionAPI 1.0.0 --title "Mijn API" --description "Mijn API beschrijving." --contextURL http://example.com/context.jsonld --baseURL http://example.com --excludeClasses Persoon Organisatie
oslo-generator-swagger --input report.jsonld --output swagger.json --language nl --versionSwagger 3.0.4 --versionAPI 1.0.0 --title "Mijn API" --description "Mijn API beschrijving." --contextURL http://example.com/context.jsonld --baseURL http://example.com --excludeClasses Persoon --excludeProperties Persoon.voornaam
oslo-generator-swagger --input report.jsonld --output swagger.json --language nl --versionSwagger 3.0.4 --versionAPI 1.0.0 --title "Mijn API" --description "Mijn API beschrijving." --contextURL http://example.com/context.jsonld --baseURL http://example.com --excludeClasses GeregistreerdPersoon --excludeProperties Persoon.voornaam Persoon.achternaam
oslo-generator-swagger --input report.jsonld --output swagger.yaml --language nl --versionSwagger 3.0.4 --versionAPI 1.0.0 --title "Mijn API" --description "Mijn API beschrijving." --contextURL http://example.com/context.jsonld --baseURL http://example.com --outputFormat application/yaml
oslo-generator-swagger --input report.jsonld --output swagger --language nl --versionSwagger 3.0.4 --versionAPI 1.0.0 --title "Mijn API" --description "Mijn API beschrijving." --contextURL http://example.com/context.jsonld --baseURL http://example.com --outputFormat application/json application/yaml