REST Expanders 3.18.0
Changes and improvements
Refactoring Options.Option
As net.democritus.sys.Options.Option is being phased out, this version of rest-expanders replaced the vast majority of
its uses with java.util.Optional. All of these changes are located in the validation system and may affect custom
code.
Migration guide
Updating to Optional<T>
-
ValidationResult.getFirstError()now returnsOptional<T>. This method is used in most generated endpoints. If the implementation was copied to custom code, this should be adapted as well.Originalif (validateUrlResult.isValidationFailed()) throw new ResourceNotFoundException(validateUrlResult.getFirstError().getValue());Migratedif (validateUrlResult.isValidationFailed()) throw new ResourceNotFoundException(validateUrlResult.getFirstError().get()); -
Any implementation of database validators that call generated methods in
DatabaseValidatorclass should be adapted if they use the return value of those methods. They have been changed to returnOptional<T>. This applies to:DatabaseValidator.existsProjection()DatabaseValidator.existsDataRef()DatabaseValidator.isUniqueProjection()DatabaseValidator.isUniqueDataRef()DatabaseValidator.connectedProjection()DatabaseValidator.connectedDataRef()
-
Any calls to a
CommonDataValidator'sexistsmethods or theexists/uniquemethods in the otherDataValidatorsshould be refactored to also handle the newOptional<T>return value. This applies to:<dataElement>CommonDataValidator.validate<dataElement>Exists()<dataElement><operation>DataValidator.validate<dataElement>Exists()<dataElement><operation>DataValidator.validate<dataElement>Unique()
