-
Notifications
You must be signed in to change notification settings - Fork 10
Schema Generator
Use the Schema Generator application to create CaaS schema definition files from an existing document type model.
The generator configuration consists of the following files and directories:
-
schema.yml
: Defines the content types to include in the schema. -
customizers
: Contains customizations to generated interface and object types. These can include additional or redefined fields or properties to ignore. -
static
: Custom schema definition files added to the generated schema, e.g. for beans returned by services like the page grid.
See the following listing from the sample configuration:
.
├── schema.yml
|
├── customizers
| ├── Content_.yml
| └── CMLinkable.yml
| └── ...
|
├── static
| ├── PageGrid.yml
| └── PageGridPlacement.yml
For each CoreMedia document type an interface and an object type definition are generated.
The interface type contains the fields while the object type usually is empty.
The interface type name corresponds to the CoreMedia type name, the object type name appends the suffix Impl
to the type name.
This file contains a list of content types to include in the generated schema files.
includedTypes:
- Content_
- CMArticle
- CMCollection
- ...
A customizer YAML file allows you to modify the generated output for an interface or object definition: It defines the following properties:
-
name
: The mandatory name of the customized interface or object type -
excludedProperties
: The names of content properties to exclude from the generated type's field list. -
customFields
: List of additional customized fields, either a Constant Field or a Custom Field.
Example from the sample schema:
name: CMImage
excludedProperties:
- data
customFields:
- !CustomField
name: link
sourceName: this
targetType: String
dataFetcher: Uri
Type Descriptor: !Constant
Properties:
-
name
: The name of the added or modified field. -
targetType
: The type name of the returned value. -
value
: A special SpEL expression defining the value. Expressions encapsulated with#{<expr>}
are evaluated at schema loading time. Expressions encapsulated with${<expr>}
are evaluated at runtime. If no value expression is given null is returned. -
nonNull
: Optional constraint for the returned value.
Type Descriptor: !CustomField
Properties:
-
name
: The name of the added or modified field. -
targetType
: The type name of the returned value. -
sourceName
: A SpEL expression for retreiving the value. -
fallbackSourceNames
: An optional list of SpEL expressions which are evaluated if the original source expression yields null or an empty result. -
dataFetcher
: The data fetcher/field class name. -
nonNull
: Optional constraint for the returned value.
Example
- !CustomField
name: teaserTitle
sourceName: "teaserTitle"
fallbackSourceNames:
- "title"
targetType: String
dataFetcher: ContentProperty
See Schema Definition for additional information on fields.
The files are added as is to the generated schema files. See Schema Definition for the required syntax.