Type-Definitions for the Interface formats used in PolicyNexus Repositories.
You can install the Typescript-Types via npm
or yarn
.
npm install @policynexus/source-repository-types
The installation is only necessary for use with Typescript. For use with JSON-Schema see below.
import * as PolicyNexus from '@policynexus/source-repository-types'
const policyNexusDocument: PolicyNexus.Document = {
"$schema": "https://raw.githubusercontent.com/policynexus/source-repository-types/main/schemas/policynexus-document.schema.json",
"name": "Example Document",
"published": "2024-04-08",
// ...
}
More TypeScript examples:
{
"$schema": "https://raw.githubusercontent.com/policynexus/source-repository-types/main/schemas/policynexus-document.schema.json",
"name": "Example Policy",
"publishedOn": "2021-01-01",
"artifacts": [
{
"type": "pdf",
"uri": "https://example.com/policy.pdf"
}
],
// ...
}
More JSON-Schama Examples:
Schema files are generated from the corresponding typescript types. You can update the schema files as follows:
git clone https://github.com/policynexus/source-repository-types
cd source-repository-types
npm install --dev
# ...
npm run build
If you have access to the PolicyNexus NPM Organization use the following lines to publish your changes:
git clone https://github.com/policynexus/source-repository-types
cd source-repository-types
# ...
npm login
npm publish --access public