
Security News
pnpm 10.16 Adds New Setting for Delayed Dependency Updates
pnpm's new minimumReleaseAge setting delays package updates to prevent supply chain attacks, with other tools like Taze and NCU following suit.
A swisspush project
Documentation for your JSON types.
Give Docson a JSON schema and it will generate a beautiful documentation.
$ docson -d ./schemas/
server ready and running at localhost:3000
# and then...
firefox http://localhost:3000/schemas/ship.json
To include a Docson schema documentations on any page (wiki, ...) without worrying about messing up with javascript libraries and cross-origin issues:
Install Docson somewhere as described above.
Place the following script
tags in the including page, nothing else is needed:
Note that you can refer to a sub-schema by adding a json-pointer path as 'dollar-parameter': index.html#/docson/examples/example.json$items
You can directly reference your JSON types defined as TypeScript interfaces. If the path ends with .ts
, Docson will use Typson to convert the Type Scripts to schema in order to generate the documentation.
For example, index.html#/typson/example/invoice/line.ts$InvoiceLine is the documentation of line.ts.
You need to install Typson by yourself on your server. It must be in a directory named typson
located at the same level as the docson
directory.
You can adapt Swagger UI to display Docson-generated model documentation instead of the builtin signatures.
See how it looks like in the Swagger Docson example
In Swagger UI's index.html
, include the Swagger integration script after other script tags:
<script src='/path-to-docson/docson-swagger.js' type='text/javascript'></script>
Also, you will need a patched version of Swagger Client so that the raw json-schema model is visible from Docson. Either replace the swagger.js
file in your Swagger UI disctribution or take it directly from github by replacing
<script src='/lib/swagger.js' type='text/javascript'></script>
with
<script src='https://raw2.github.com/lbovet/swagger-js/models-exposed/lib/swagger.js' type='text/javascript'></script>
For a better layout of parameter models, you may want to change the width of some elements:
<style>
.swagger-ui-wrap {
max-width: 1200px;
}
.swagger-ui-wrap .body-textarea {
width: 200px;
}
</style>
You can also integrate Docson in your application and use its javascript API:
docson.doc(element, schema, ref)
element
is the element which will host the documentation. Either a DOM element (id or object) or jQuery element.schema
is the URI or path to the schema or a string containing the schema source itself.ref
is an optional json-pointer path to a sub-schema.Examples:
Not implemented:
Please pull-request your failing schemas in the tests/
folder and open an issue describing the expected result.
FAQs
Documentation for your JSON types
The npm package docson receives a total of 281 weekly downloads. As such, docson popularity was classified as not popular.
We found that docson demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm's new minimumReleaseAge setting delays package updates to prevent supply chain attacks, with other tools like Taze and NCU following suit.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.