Installations
npm install swagger-md
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>=4
Node Version
8.5.0
NPM Version
5.3.0
Score
50
Supply Chain
91.6
Quality
77.2
Maintenance
50
Vulnerability
98.6
License
Releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
Springworks
Download Statistics
Total Downloads
104,642
Last Day
1
Last Week
6
Last Month
84
Last Year
1,159
GitHub Statistics
5 Stars
222 Commits
5 Forks
21 Watching
2 Branches
7 Contributors
Package Meta Information
Latest Version
3.0.0
Package Id
swagger-md@3.0.0
Size
6.32 kB
NPM Version
5.3.0
Node Version
8.5.0
Total Downloads
Cumulative downloads
Total Downloads
104,642
Last day
-90.9%
1
Compared to previous day
Last week
-88%
6
Compared to previous week
Last month
50%
84
Compared to previous month
Last year
-55.8%
1,159
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
swagger-md
Converts Swagger API spec to Markdown format.
Usage
Install NPM module:
npm install swagger-md
Convert Swagger API spec to Markdown format:
1import swagger_md from 'swagger-md'; 2import swagger_spec from './swagger-api-spec.json'; 3 4function responseExampleProvider(path, method) { 5 return [ 6 '```json', 7 '{ "foo": 1 }', 8 '```', 9 ].join('\n'); 10} 11 12swagger_md.convertToMarkdown(swagger_spec, { response_example_provider: responseExampleProvider }).then(markdown_str => { 13 // Use markdown_str, e.g. write to "api.md" 14});
1// It is also possible to pass a path to the root file of the API spec (can be json or yaml) and supports local file refs. 2const path_to_spec = 'path/to/api-spec.json'; 3 4swagger_md.convertToMarkdown(path_to_spec).then(markdown_str => { 5 // refs to other local files are resolved and the markdown contains the entire API 6});
resolveApiSpec
resolves the API spec in the same way as convertToMarkdown
but returns the resolved object without converting it to markdown
1const path_to_spec = 'path/to/api-spec.json'; 2const options = { 3 // optionally specify that external refs should be fetched and resolved 4 external: true 5}; 6 7swagger_md.resolveApiSpec(path_to_spec, options).then(spec => { 8 // spec == the resolved API spec 9});
To use the swagger-md in a CommonJS module environment the usage statement should look like:
1var swagger_md = require('swagger-md').default; 2...
What can it do?
See ./test-fixtures/swagger
for examples of a swagger.json
converted to Markdown.
Want it do handle more? Feel free to contribute!
Contributing
- Write a new test with new fixtures or extend the existing ones
- Make a PR
- :pray: :clap:
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 2/4 approved changesets -- score normalized to 5
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 30 are checked with a SAST tool
Score
4.2
/10
Last Scanned on 2024-12-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More