You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
java-micronaut-server And generateControllerAsAbstract=true Results in "class not found" Errors
I opted to not create a [BUG] issue, since the java-micronaut-server is still listed as a Beta version.
While working on a short article that leverages and OpenAPI specification to build services, I was able to successfully use Spring Boot and Quarkus. The final article of my series focused on Micronaut and I was excited to see that an OpenAPI generator exists for this framework.
By default, the 7.12.0 version of the generator ends up creating a DefaultController which is a class. I eventually discovered the generateControllerAsAbstract=true configuration option which did introduce the AbstractDefaultController however, with this change in place I started seeing "class not found" errors. What surprised me is that errors pointed to HttpStatusException and HttpStatus - both of which were in the class path and available in my local IntelliJ instance. If I were to switch back to generateControllerAsAbstract=false, the errors went away.
I also noticed that if I provided my own api, model and invoker packages, the AbstractDefaultController appeared to ignore these settings and created the class in the org.openapitools package.
If interested, here's the OpenAPI Specification that I have been using for my articles:
openapi: 3.0.0info:
title: Motivational Quotes APIdescription: An API that provides motivational quotes.version: 1.0.0servers:
- url: https://api.example.comdescription: Production serverpaths:
/quotes:
get:
summary: Get all motivational quotesoperationId: getAllQuotesresponses:
'200':
description: A list of motivational quotescontent:
application/json:
schema:
type: arrayitems:
$ref: '#/components/schemas/Quote'/quotes/random:
get:
summary: Get a random motivational quoteoperationId: getRandomQuoteresponses:
'200':
description: A random motivational quotecontent:
application/json:
schema:
$ref: '#/components/schemas/Quote'/quotes/{id}:
get:
summary: Get a motivational quote by IDoperationId: getQuoteByIdparameters:
- name: idin: pathrequired: trueschema:
type: integerresponses:
'200':
description: A motivational quotecontent:
application/json:
schema:
$ref: '#/components/schemas/Quote''404':
description: Quote not foundcomponents:
schemas:
Quote:
type: objectrequired:
- id
- quoteproperties:
id:
type: integerquote:
type: string
I opted to go a different direction for the article, but I wanted to log this ticket, in case it provides value for someone else in the future.
Have a really great day!
The text was updated successfully, but these errors were encountered:
java-micronaut-server And generateControllerAsAbstract=true Results in "class not found" Errors
While working on a short article that leverages and OpenAPI specification to build services, I was able to successfully use Spring Boot and Quarkus. The final article of my series focused on Micronaut and I was excited to see that an OpenAPI generator exists for this framework.
By default, the 7.12.0 version of the generator ends up creating a
DefaultController
which is a class. I eventually discovered thegenerateControllerAsAbstract=true
configuration option which did introduce theAbstractDefaultController
however, with this change in place I started seeing "class not found" errors. What surprised me is that errors pointed toHttpStatusException
andHttpStatus
- both of which were in the class path and available in my local IntelliJ instance. If I were to switch back togenerateControllerAsAbstract=false
, the errors went away.I also noticed that if I provided my own api, model and invoker packages, the
AbstractDefaultController
appeared to ignore these settings and created the class in theorg.openapitools
package.Here is my
build.gradle
file:If interested, here's the OpenAPI Specification that I have been using for my articles:
I opted to go a different direction for the article, but I wanted to log this ticket, in case it provides value for someone else in the future.
Have a really great day!
The text was updated successfully, but these errors were encountered: