c2pa-types
Exports TypeScript types used by c2pa-web that are auto-generated from c2pa-rs structs.
Prerequisites
Ensure the repo-wide prerequisites are installed:
See the c2pa-js README for details.
Building
To build the types:
nx build c2pa-types
The types are built as follows:
- Specific structs (example) from c2pa-rs are annotated with the
schemars::JsonSchemaattribute. - JSON schema files are generated by calling
schemars::schema_forand saved to theschemas/directory. - Schema files are read by
json-schema-to-typescriptand used to generate TypeScript types, saved to thetypes/directory. - Types are "gathered" and exported from the
index.d.tsfile.