Springboot Archetype - YAML doesn't have definitions

135 views
Skip to first unread message

Thaxton Mauzy

unread,
Dec 10, 2021, 8:32:53 AM12/10/21
to Kogito development mailing list
I'm really new to all of this but hopefully someone is willing to help with a small question: I'm trying to generate the maven spring-boot project from the latest archetype (found here):
$ mvn archetype:generate \ -DarchetypeGroupId=org.kie.kogito \ -DarchetypeArtifactId=kogito-spring-boot-archetype \ -DgroupId=org.acme -DartifactId=sample-kogito \ -DarchetypeVersion=1.13.0.Final \ -Dversion=1.0-SNAPSHOT

And it works fine, except that the object definitions are not included in the api-docs YAML.

But when Matteo does this in his March 2021 video, the definitions are included there on the swagger-ui.html page and I assume they are in the api-docs YAML.

I noticed he was using -DarchetypeArtifactId=kogito-springboot-archetype (no "-" between spring and boot) and Version = 2.0.0-SNAPSHOT...did something change between the Artifact Id change and the version that would cause the Definitions to not be included in the generated api-docs YAML?  I see some issues logged for something similar on the Quarkus side, but I don't see anything for the Spring-Boot side...

Thanks in advance for any help anyone can provide!  There is so much great content for Kogito - very exciting!

-Thaxton Mauzy

Ricardo Zanini

unread,
Dec 10, 2021, 9:28:59 AM12/10/21
to Kogito development mailing list
Hi!

What do you mean by "And it works fine, except that the object definitions are not included in the api-docs YAML."?

Can you share the generated project?

--
Zanini


--
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/287d909b-87ff-48b4-a8c6-a4d489a3cdbcn%40googlegroups.com.

Thaxton Mauzy

unread,
Dec 12, 2021, 8:03:21 PM12/12/21
to Kogito development mailing list
Thank you so much for the response!

Here is the project generated fresh from the archetype:

And here is the YAML in question that is generated by swagger:

The problem is that the $ref path for dmnDefinitions.json isn't valid, which might be an easy fix...but I would actually expect the parameters for the REST operations to be included inline in the YAML under the components heading.

Much like this YAML has a components > schema entry for input and output parameters like Quote and QuoteResponse

Does that make sense?


Ricardo Zanini

unread,
Dec 28, 2021, 2:33:07 PM12/28/21
to Kogito development mailing list, Matteo Mortari
Thaxton,

I've tried with the latest (1.14.1), and my generated OpenAPI definition is exactly the same as yours. And the UI is working fine, with all the data structure well defined in the request form:

{
Violation*{
Codestring
Datestring($date)
TypetViolation__TypestringEnum:
Speed Limitnumber
Actual Speednumber
}
Driver*{
Namestring
Agenumber
Statestring
Citystring
Pointsnumber
}
}

Can you please clarify when you say that the path for the schema is wrong? 

You can see the schema here: http://localhost:8080/dmnDefinitions.json#/definitions/OutputSet (just append the path in the ap URL).

I can't speak for DMN, so I'm not sure if they changed something in the Swagger generation for SB. But looking as an outsider, in this case, it seems fine to me.

@Matteo Mortari do you have any hints? :)

Cheers!
--
Zanini


Matteo Mortari

unread,
Dec 28, 2021, 5:10:46 PM12/28/21
to Kogito development mailing list
Hi Thaxton,
I'm a bit confused about what is allegedly "not working" please?

I've checked out your git repo also on this end, and much like Ricardo experienced, everything seems to be working as expected.
Swagger-ui working.
OpenAPI correctly generated.
$ref in OpenAPI resolving correctly per Swagger/OAS specification --please notice it is completely valid by OAS to have reference on JSON Schema such as "$ref":"/dmnDefinitions.json etc

There is nothing specific to DMN here, just standard OpenAPI (Swagger).

Maybe by "not working" you actually meant to obtain a definition more adherent to your specific use-case, expectations, completely dereferenced ?
You can achieve it via standard swagger-cli for instance by bundling and dereference

It would produce as attached. Was this what you were looking for?

Please notice Swagger-UI tools and the likes, normally do these operations internally, by navigating $ref(s) per the OAS Specification, that is the reason why from your "GUI experience" it is seamless, but if you download the OAS manually you need to re-enact the same logic; the swagger-cli can be a handy tool to avoid doing those operations manually or instead of hand-coding.

Hope this helps, let us know.
MM

--
out.yaml

francisco boato

unread,
Jan 27, 2022, 8:38:03 AM1/27/22
to Kogito development mailing list
Hello, is it possibile to configure KOGITO to generate the code without the creation of an static resource (in this case dmnDefinitions.json) ? it could work using references (but inside the the same OpenAPi root or "main" file)  because this  auto-generated  static resource is causing some problems during deploy.

Francisco.

Matteo Mortari

unread,
Jan 27, 2022, 9:15:37 AM1/27/22
to Kogito development mailing list
Hi Francisco

> because this  auto-generated  static resource is causing some problems during deploy

You are likely hitting either of the problems we detected with:

One I already fixed and backported too, the other Toshiya has been working on it and that requires some bugfixing in the underlying Quarkus actually.

My suggestion is to use a previous Kogito+Quarkus version, or a version where the problem is solved, or apply the documented workaround from the JIRAs.

If you are using instead Kogito+SpringBoot, or you are experiencing another issue not documented in those jiras, please report the details of the issue you are facing --so we can understand more.

Hope this helps,
MM

Thaxton Mauzy

unread,
Feb 16, 2022, 7:28:07 AM2/16/22
to Kogito development mailing list
I just wanted to close this out and say thanks to everyone for their help! The problem ended up being an issue with the consuming application and its ability to parse a YAML. So bottom line: the Spring Boot Maven Archetype is a great place to start for a rules or process project!

Thanks,
Thaxton

Reply all
Reply to author
Forward
0 new messages