"Error while trying to generate OpenAPI"

14 views
Skip to first unread message

Amit Mor

unread,
Apr 8, 2021, 8:49:55 AMApr 8
to Kogito development mailing list
Hello!
I would be very thankful if I could be guided on resolving an error, stating at its top most stack "Error while trying to generate OpenAPI". I'm getting this when running Kogito 1.4.1.Final which is using Maven with quarkus:dev target on a project containing DMN models in the project resources, without any additional code:

2021-04-08 15:43:01,161 ERROR [org.kie.kog.cod.dec.DecisionCodegen] (build-3) Error while trying to generate OpenAPI specification for the DMN models: java.lang.IllegalStateException: Couldn't determine unique naming policy
        at org.kie.dmn.openapi.impl.DMNOASGeneratorImpl.determineNamingPolicy(DMNOASGeneratorImpl.java:94)
        at org.kie.dmn.openapi.impl.DMNOASGeneratorImpl.build(DMNOASGeneratorImpl.java:61)
        at org.kie.kogito.codegen.decision.DecisionCodegen.generateAndStoreRestResources(DecisionCodegen.java:127)
        at org.kie.kogito.codegen.decision.DecisionCodegen.generate(DecisionCodegen.java:115)
        at org.kie.kogito.codegen.decision.DecisionCodegen.generate(DecisionCodegen.java:63)
        at org.kie.kogito.codegen.core.ApplicationGenerator.lambda$generateComponents$1(ApplicationGenerator.java:88)
        at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:271)
        at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
        at org.kie.kogito.codegen.core.ApplicationGenerator.generateComponents(ApplicationGenerator.java:89)
        at org.kie.kogito.codegen.core.ApplicationGenerator.generate(ApplicationGenerator.java:69)
        at org.kie.kogito.quarkus.common.deployment.KogitoAssetsProcessor.generateFiles(KogitoAssetsProcessor.java:108)
        at org.kie.kogito.quarkus.common.deployment.KogitoAssetsProcessor.generateModel(KogitoAssetsProcessor.java:84)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:920)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2415)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
        at java.base/java.lang.Thread.run(Thread.java:832)
        at org.jboss.threads.JBossThread.run(JBossThread.java:501)

Thank you,
Amit M.

Edoardo Vacchi

unread,
Apr 8, 2021, 8:53:58 AMApr 8
to Kogito development mailing list
hi, 
this error most likely means that you are trying to use 2 dmn files with the same name within the same project.

--
You received this message because you are subscribed to the Google Groups "Kogito development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kogito-developm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kogito-development/8575f739-27bc-45a6-9d37-f69a7010c0d3n%40googlegroups.com.

Amit Mor

unread,
Apr 8, 2021, 9:03:44 AMApr 8
to kogito-de...@googlegroups.com
 Thanks, I thought so too but see below:

grep -r -e "dmn:definitions"  ./src/main/resources | grep "name="


You received this message because you are subscribed to a topic in the Google Groups "Kogito development mailing list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kogito-development/GyiFJgKXzCA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kogito-developm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kogito-development/CACPHShzGVN6_T8ycv_sEOQN67Dra%2BGcSR2-5Qr%2BGM3XTcGdKGQ%40mail.gmail.com.

Michael Anstis

unread,
Apr 8, 2021, 9:17:53 AMApr 8
to Kogito development mailing list
cryptojacking and breach_costs_outside appear to have the same namespace and could be causing a conflict.



--

Michael Anstis

Principal Software Engineer

Red Hat

Matteo Mortari

unread,
Apr 8, 2021, 9:22:35 AMApr 8
to Kogito development mailing list
+1 to what Michael Anstis said,
and even more likely if both DMN models contained an ItemDefinition (type) with the same name.

The error you would experience is that the OpenAPI generator is not able to determine an unique name for the 2 ItemDefinitions (types), as you inadvertently are instructing them to share the same namespace?

It could be likely you copy-pasted a DMN model file, and started modify it?

Avoiding namespace clash would likely resolve your issue, if the above is the case (containing both ItemDefinition with the same name)

Hope this helps,
MM

Amit Mor

unread,
Apr 8, 2021, 11:13:19 AMApr 8
to kogito-de...@googlegroups.com
Thanks for your responses! 
As for your questions, it most likely has happened (copy-pasting of model files) by people here who are actually working on modeling, i.e. business people (I'm an engineer). I think that this might be a common-enough use case for a Kogito-UI feature which would allow to do 'save model as..' so that a new model would be created while avoiding naming and ID collisions. If it was possible, I'd suggest that the error raised could have spelled out which name/id had collided.

Again, thanks for the great work and help,
Amit M.

Michael Anstis

unread,
Apr 8, 2021, 12:02:01 PMApr 8
to Kogito development mailing list
If new models are created with the UI namespace will be unique.. unfortunately there's less we can do if somebody opens a DMN file with a text editor and changes things.

Regarding your proposal, if a DMN file is opened with our editor both the model name and namespace can be changed. However we could add a button to automatically populate the namespace with a UUID.

Please create a JIRA at https://issues.redhat.com/projects/KOGITO/issues describing the scenario and use case for consideration by the team responsible for maintaining the editor.

Matteo Mortari

unread,
Apr 12, 2021, 5:24:01 AMApr 12
to Kogito development mailing list
Hi Amit,

I second Michael's suggestion to file any JIRA reports that you see fit.

That said, specifically for:
> If it was possible, I'd suggest that the error raised could have spelled out which name/id had collided.

appreciated suggestion; the error message is currently being enhanced with:

The error message will contain the types and models information over the homonym ItemDefinitions clashing because of being defined under the same Namespace.

Hope this helps,
MM

Amit Mor

unread,
Apr 12, 2021, 5:49:12 AMApr 12
to kogito-de...@googlegroups.com
Thanks Matteo,
I am speechless by the responsiveness of the Kogito team and the rate in which the improvements "fly-into" the Kogito source. 9 months ago I made a decision to move my company to using Kogito (mainly for DMN) while it was on "preview" versions and I feel so lucky to have chosen such a great project to rely on.


Reply all
Reply to author
Forward
0 new messages