# Validation of the Configuration

## 1. Overview

The ShapeChange configuration defines how a UML model is read and processed by ShapeChange. It is therefore essential to ensure that the configuration is correct. ShapeChange performs two types of validations:

- syntactic validation based on the XML Schema definition of the ShapeChange configuration, and

- semantic validation (this feature is available since ShapeChange version 2.2.0)

Both types of validation are described in more detail in the following sections.

## 2. XML Schema based Validation

The XML Schema (XSD) configured in the xsi:schemaLocation attribute of the ShapeChange configuration root element is used to check the syntactical correctness of the configuration. The latest version of the ShapeChange configuration XSD can be found at https://shapechange.net/resources/schema/ShapeChangeConfiguration.xsd

## 3. Semantic Validation

(since v2.2.0)

In addition to the XML Schema based validation, ShapeChange can also check the parameters and rules defined in the configuration for consistency. The intent is to prevent configuration mistakes that would otherwise only be noticed during or after processing a UML model. As processing the model can take a significant amount of time, it is useful to identify and correct configuration issues before the model is processed.

An example of a common configuration mistake is not specifying a parameter that is required by a conversion rule.

ShapeChange performs the semantic validation before it converts the model. The validation can result in log messages with different severity level. An error causes the validation to fail, which also prevents model conversion. In that case, the configuration issues reported in the log should be corrected before ShapeChange is executed again.

Note | In case that semantic validation is not behaving as expected, it can be skipped by including the input parameter 'skipSemanticValidationOfShapeChangeConfiguration' with a value of 'true'.

### 3.1. Basic Configuration Validator

The validation of the input parameters as well as any general semantic validation tasks are executed by the BasicConfigurationValidator (in package de.interactive_instruments.ShapeChange).

### 3.2. Implementation of Configuration Validators

This section documents how specific configuration validators are implemented.

Semantic validation of transformers and targets is implemented by specific classes that are dynamically instantiated by ShapeChange.

- The class must be located in the same package as the transformer/target.

- It must have the same name as the transformer/target, just with the suffix 'ConfigurationValidator'.

- The class must have a constructor without arguments.

- The class must implement the interface de.interactive_instruments.ShapeChange.ConfigurationValidator.

For example, the implementation of the validator for the FeatureCatalogue target has the name 'FeatureCatalogueConfigurationValidator' and is located in package 'de.interactive_instruments.ShapeChange.Target.FeatureCatalogue'.