modelix / modelix.core

Mostly model related components
Apache License 2.0
6 stars 9 forks source link

Deserialize throws RuntimeException if no api was generated for language #1

Closed FChris closed 1 year ago

FChris commented 1 year ago

Deserialize Method in IConceptReferenceSerializer throws RuntimeException if a language is missing. This results in a long debugging turnover time when multiple languages are missing because you have to add each language individually. Ideally you get a list of all missing languages at once.

(originally opened here https://github.com/modelix/api-gen/issues/16)

Relevant Stacktrace: java.lang.RuntimeException: No deserializer found for: mps:0e530434-6261-4ef4-98d8-ebfa2f94dde0/5601080448567809140 at org.modelix.model.lazy.IConceptReferenceSerializer$Companion.deserialize(IConceptReferenceSerializer.kt:61) at MPSRemoteNode.getConcept(MPSRemoteNode.kt:20) at org.modelix.mps.apigen.runtime.MPSLanguageRegistry$Companion.getInstance(Language.kt:36) at some.path.web.dashboard.routes.ComponentsKt.softwareComponents(Components.kt:384) at some.path.web.dashboard.routes.ComponentsKt$listSoftwareComponents$1.invokeSuspend(Components.kt:30) at some.path.web.dashboard.routes.ComponentsKt$listSoftwareComponents$1.invoke(Components.kt) at some.path.web.dashboard.routes.ComponentsKt$listSoftwareComponents$1.invoke(Components.kt) at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:248) at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:116) at io.ktor.util.pipeline.SuspendFunctionGun.execute(SuspendFunctionGun.kt:136) at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:78) at io.ktor.routing.Routing.executeResult(Routing.kt:155) at io.ktor.routing.Routing.interceptor(Routing.kt:39) at io.ktor.routing.Routing$Feature$install$1.invokeSuspend(Routing.kt:107) at io.ktor.routing.Routing$Feature$install$1.invoke(Routing.kt) at io.ktor.routing.Routing$Feature$install$1.invoke(Routing.kt) at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:248) at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:116) at io.ktor.util.pipeline.SuspendFunctionGun.execute(SuspendFunctionGun.kt:136) at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:78) at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$2.invokeSuspend(DefaultEnginePipeline.kt:127) at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$2.invoke(DefaultEnginePipeline.kt) at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$2.invoke(DefaultEnginePipeline.kt) at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:248) at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:116) at io.ktor.util.pipeline.SuspendFunctionGun.execute(SuspendFunctionGun.kt:136) at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:78) at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1.invokeSuspend(NettyApplicationCallHandler.kt:123) at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1.invoke(NettyApplicationCallHandler.kt) at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1.invoke(NettyApplicationCallHandler.kt) at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55) at kotlinx.coroutines.BuildersKt__Builders_commonKt.startCoroutineImpl(Builders.common.kt:194) at kotlinx.coroutines.BuildersKt.startCoroutineImpl(Unknown Source) at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:134) at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56) at kotlinx.coroutines.BuildersKt.launch(Unknown Source) at io.ktor.server.netty.NettyApplicationCallHandler.handleRequest(NettyApplicationCallHandler.kt:43) at io.ktor.server.netty.NettyApplicationCallHandler.channelRead(NettyApplicationCallHandler.kt:34) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:61) at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:370) at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164) at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:503) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.ktor.server.netty.EventLoopGroupProxy$Companion.create$lambda-1$lambda-0(NettyApplicationEngine.kt:251) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Thread.java:834)

https://github.com/modelix/modelix.core/blob/ecf625804b185251c357ad515ab6f4ff9a0aafaa/model-client/src/commonMain/kotlin/org/modelix/model/lazy/IConceptReferenceSerializer.kt#L61

nkoester commented 1 year ago

A possible direct fix for this could be by extending the MPSLanguageRegistry and adding a register function which does this analysis. Whether or not this should be a platform feature needs to be decided.

@slisson do you have an opinion on this?

Another side node @FChris: Please keep in mind that depending on the modelix version you use a fix in modelix will most likely not be back ported to old versions. You would have to migrate to the latest version in any case.

slisson commented 1 year ago

I don't know how to do that in the platform. The client code has to iterate over the model and collect the exceptions.

nkoester commented 1 year ago

The existing api-gen v1 will be replaced with a v2. There this issue will be fixed.

hubermanuel commented 1 year ago

Thank you for the update @nkoester Looking forward to test v2 in our project ;)

nkoester commented 1 year ago

The api-gen v2 fixes this issue. You can now transition to it.