- Getting Started
- Directory Structure
- Conventions
- Continuous Integreation
- Continuous Deployment
- Generating Proofs
The purpose of this document is to describe to developers how to navigate this repository in order to make meaningful contributions to this product.
To get started building, testing, or contributing to this repository, you will need Node.js and git. Node is expected to be either version 14 or 16.
git clone https://github.com/w3c-ccg/traceability-vocab.git
cd traceability-vocab
npm i
To run a local version of the spec you can run:
npx serve ./docs
The primary focus of this repository is to define schemas which describe Verifiable Credentials which act as a digitally
equivalent signed form of a document. These credentials can be found in the /docs/openapi/components/schemas/credentials/
directory, starting from the root of this repository.
To enable standard re-usable parts for defining RDF classes in credentials, we have a common
folder located at
/docs/openapi/components/schemas/common/
in which we store these classes. As a comparison to React, think of credentials
as
top-level pages, and think of common
as the components that make up these pages.
Presentations are a way to exchange credentials between parties. Presentations can have a specific schema or structure
that defines a specific workflow. One such workflow definition would be a workflow for importing steel. Presentation
definitions can be found in the /docs/openapi/components/schemas/presentations/
directory.
When the npm i
command is run, it will generate the JSON-LD context from the schemas. This context is found at
/docs/contexts/traceability-v1.jsonld
from the root of this repository.
There are several scripts in this repository for compiling trace vocabulary. These scripts can be found in the
/packages/traceability-schemas/scripts/
directory from the root of this repository. That directory contains
README.md
which describes the specifics of each script and what it does.
The specification is in the /docs
folder from the root of the repository. The index.html
file contains the static
text that can be found in the spec. This document references different sections which can be found in the /docs/sections
directory.
While there are not any strict conventions, there are specific guidelines that are followed for defining a consistent style with respect to schemas. They are described as follows.
- Verifiable Credentials should not declare any top-level properties not defined in the vc-core spec
- All of the properties for a credential type should be declared in the
credentialSubject
type
properties should be declared as an array for simplification- An attempt should be made to use existing
common
types before declaring new ones - RDF classes should not be declared with any undefined terms
- Example JSON files must include all of the properties defined in the JSON schema
When submitting a pull request, the proposed changes must pass the Continuous Integration tests.
These tests can be run in the local developer environment by running npm test
from the root
of the repository. This will run the tests located in the /packages/traceability-schemas/__tests__/
folder.
Common errors when not passing these tests include:
- Malformed or incorrect
.yml
indentation - Incorrect OpenAPI
.yml
syntax - Broken proofs as a result of context changes
- Example JSON files that don't pass schema validation
- Cascading changes as a result of changing a
common
RDF class used by multiple files
After a pull request is merged, the Continuous Delivery (CD) script will create the spec document which is deployed to https://w3c-ccg.github.io/traceability-vocab/. The scripts which produce this document are described as follows.
schemas-to-openapi.js
builds the YAML (.yml
) file for the OpenAPI Specopenapi-to-context.js
builds the JSON-LD context from the OpenAPI spec which is written to/docs/contexts/traceability-v1.jsonld
schemas-to-vocab.js
builds the HTML (.html
) files for the schemas which are referenced from/docs/index.html
in the spec