mcarleio / konvert

This kotlin compiler plugin is using KSP API and generates kotlin code to map one class to another
https://mcarleio.github.io/konvert/
Apache License 2.0
94 stars 8 forks source link

Improve error msg for PropertyMappingNotExistingException #83

Open MV-GH opened 4 months ago

MV-GH commented 4 months ago

Currently it is quite hard to find which mapping is throwing this exception.

For example

[ksp] io.mcarle.konvert.processor.exceptions.PropertyMappingNotExistingException: No property for valueParameter=banned_from_community existing in [PropertyMappingInfo(mappingParamName=d, sourceName=comment, targetName=comment, constant=null, expression=null, ignore=false, enableConverters=[], sourceData=SourceProperty(property=comment), isBasedOnAnnotation=false), PropertyMappingInfo(mappingParamName=d, sourceName=comment_reply, targetName=comment_reply, constant=null, expression=null, ignore=false, enableConverters=[], sourceData=SourceProperty(property=comment_reply), isBasedOnAnnotation=false), PropertyMappingInfo(mappingParamName=d, sourceName=community, targetName=community, constant=null, expression=null, ignore=false, enableConverters=[], sourceData=SourceProperty(property=community), isBasedOnAnnotation=false), PropertyMappingInfo(mappingParamName=d, sourceName=counts, targetName=counts, constant=null, expression=null, ignore=false, enableConverters=[], sourceData=SourceProperty(property=counts), isBasedOnAnnotation=false), PropertyMappingInfo(mappingParamName=d, sourceName=creator, targetName=creator, constant=null, expression=null, ignore=false, enableConverters=[], sourceData=SourceProperty(property=creator), isBasedOnAnnotation=false), PropertyMappingInfo(mappingParamName=d, sourceName=creator_banned_from_community, targetName=creator_banned_from_community, constant=null, expression=null, ignore=false, enableConverters=[], sourceData=SourceProperty(property=creator_banned_from_community), isBasedOnAnnotation=false), PropertyMappingInfo(mappingParamName=d, sourceName=creator_blocked, targetName=creator_blocked, constant=null, expression=null, ignore=false, enableConverters=[], sourceData=SourceProperty(property=creator_blocked), isBasedOnAnnotation=false), PropertyMappingInfo(mappingParamName=d, sourceName=my_vote, targetName=my_vote, constant=null, expression=null, ignore=false, enableConverters=[], sourceData=SourceProperty(property=my_vote), isBasedOnAnnotation=false), PropertyMappingInfo(mappingParamName=d, sourceName=post, targetName=post, constant=null, expression=null, ignore=false, enableConverters=[], sourceData=SourceProperty(property=post), isBasedOnAnnotation=false), PropertyMappingInfo(mappingParamName=d, sourceName=recipient, targetName=recipient, constant=null, expression=null, ignore=false, enableConverters=[], sourceData=SourceProperty(property=recipient), isBasedOnAnnotation=false), PropertyMappingInfo(mappingParamName=d, sourceName=saved, targetName=saved, constant=null, expression=null, ignore=false, enableConverters=[], sourceData=SourceProperty(property=saved), isBasedOnAnnotation=false), PropertyMappingInfo(mappingParamName=d, sourceName=subscribed, targetName=subscribed, constant=null, expression=null, ignore=false, enableConverters=[], sourceData=SourceProperty(property=subscribed), isBasedOnAnnotation=false)]
    at io.mcarle.konvert.processor.codegen.CodeGenerator.verifyPropertiesAndMandatoryParametersExist(CodeGenerator.kt:131)
    at io.mcarle.konvert.processor.codegen.CodeGenerator.generateCode(CodeGenerator.kt:73)
    at io.mcarle.konvert.processor.konvert.KonverterCodeGenerator.generateMappingCode(KonverterCodeGenerator.kt:110)
    at io.mcarle.konvert.processor.konvert.KonverterCodeGenerator.access$generateMappingCode(KonverterCodeGenerator.kt:22)
    at io.mcarle.konvert.processor.konvert.KonverterCodeGenerator$generate$1$1$1$1.invoke(KonverterCodeGenerator.kt:75)
    at io.mcarle.konvert.processor.konvert.KonverterCodeGenerator$generate$1$1$1$1.invoke(KonverterCodeGenerator.kt:40)
    at io.mcarle.konvert.converter.api.config.ConfigurationKt.withIsolatedConfiguration(Configuration.kt:54)
    at io.mcarle.konvert.processor.konvert.KonverterCodeGenerator$generate$1.invoke(KonverterCodeGenerator.kt:40)

I have to look quite a while from the thousand mappings I have to find one which is throwing this.

i would like to see

banned_from_community field missing at Mapping FQDN.Person.banned_from_community to FQDN2.Person