@opentext/forms-schema-generator
v26.1.1
Published
Generates a JSON schema for use with OpenText™ Forms API
Readme
forms-schema-generator
Generates a JSON schema for use with OpenText™ Forms API
Contents
Install
Run:
npm install @opentext/forms-schema-generatorUsage
A schema can be generated from any of the following sources:
- A Core Content workspace type definition
- A Core Content document type definition
- A CMS type definition model
- A CMS trait definition model
- A workflow model
The source is automatically detected from its contents. For example, to generate a schema from a Core Content workspace type definition:
import { schemaGenerator } from '@opentext/forms-schema-generator';
// Generate schema
const schema = schemaGenerator(workspaceTypeDefinition);The following options are available:
- generateSourceReferences - true if otSource references suitable for UI Modeler should be generated (default is false)
- propertyNamePrefix - the string to prefix every property name with
For example:
import { schemaGenerator } from '@opentext/forms-schema-generator';
// Define options
const options = {
generateSourceReferences: true,
propertyNamePrefix: `workflow/${workflowModel.data.properties.process_id}/`
}
// Generate schema
const schema = schemaGenerator(workflowModel, options);