use of cz.habarta.typescript.generator.compiler.TsModelTransformer in project openremote by openremote.
the class CustomExtension method getTransformers.
@Override
public List<TransformerDefinition> getTransformers() {
return Arrays.asList(new TransformerDefinition(ModelCompiler.TransformationPhase.BeforeEnums, (TsModelTransformer) (context, model) -> {
// Special processing for AssetModelInfo meta item value descriptors as JsonSerialize extension doesn't support
// @JsonSerialize(contentConverter=...)
TsBeanModel assetTypeInfoBean = model.getBean(AssetTypeInfo.class);
if (assetTypeInfoBean != null) {
assetTypeInfoBean.getProperties().replaceAll(p -> p.getName().equals("metaItemDescriptors") || p.getName().equals("valueDescriptors") ? new TsPropertyModel(p.getName(), new TsType.BasicArrayType(TsType.String), p.modifiers, p.ownProperty, p.comments) : p);
}
Constants.IGNORE_TYPE_PARAMS_ON_CLASSES.forEach(beanClass -> {
TsBeanModel bean = model.getBean(beanClass);
if (bean != null && bean.getTypeParameters() != null) {
// Remove the type parameter - this works in conjunction with the CustomTypeProcessor which replaces
// field references
bean.getTypeParameters().clear();
}
});
return model;
}));
}
Aggregations