Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schemas for classes in dependency JARs never generated #1321

Closed
sidohin-felix opened this issue Nov 27, 2022 · 2 comments · Fixed by #1342 or #1352
Closed

Schemas for classes in dependency JARs never generated #1321

sidohin-felix opened this issue Nov 27, 2022 · 2 comments · Fixed by #1342 or #1352
Labels
bug Something isn't working plugin/gradle
Milestone

Comments

@sidohin-felix
Copy link

sidohin-felix commented Nov 27, 2022

Hello,

Not sure if this is a bug or a configuration issue, but I am trying to use the gradle plugin with a vanilla microprofile project (simple WAR generated and loaded into a TomEE instance). I have run into the following issue:

Let's assume a library A is included as compileOnly and some object MyObject from A is used either as a request body or response. Basically:

public Response appendNetwork(@RequestBody MyObject myObject) throws Exception {
        //do stuff with my object here.
        return Response.ok().build();
    }

When I run the gradle task below everything gets generated correctly except the schema for MyObject which results in the following errors in the debug [io.smallrye.openapi.runtime.scanner] SROAP04005: Could not find schema class in index: MyObject (assume that MyObject is included correctly as some com.mypackage.whatever.MyObject)

generateOpenApiSpec {
    outputDirectory = new File(this.getProjectDir().toString() + "/src/main/resources/openapi")
    scanDependenciesDisable = false
}

Is this a limitation or am I missing some configuration here?

As a possible hint when using the 'io.swagger.core.v3.swagger-gradle-plugin' version '2.1.11' the same problem surfaces but it can be mitigated with the following configuration of the plugin, in which case MyObject is indeed found and correctly included as a schema in the OpenAPI specification:

resolve {
    outputFileName = 'api'
    outputFormat = 'YAML'
    prettyPrint = 'TRUE'
    classpath = sourceSets.main.output + configurations.compileClasspath
    buildClasspath = classpath
}
@MikeEdgar MikeEdgar added the bug Something isn't working label Dec 5, 2022
@Hes-Siemelink
Copy link

Having a similar problem in gradle 7.5.1 when declaring dependencies like this:

dependencies {
  api project(":core:domain-classes")

where core/domain-classes is a source directory in the same repo.

The plugin can't find the domain classes and doesn't generate JSON schema for them. It only works if start copying the domain classes into the API project that has the plugin configured on it.

MikeEdgar added a commit to MikeEdgar/smallrye-open-api that referenced this issue Jan 7, 2023
Fixes smallrye#1321

Signed-off-by: Michael Edgar <michael@xlate.io>
MikeEdgar added a commit to MikeEdgar/smallrye-open-api that referenced this issue Jan 7, 2023
Fixes smallrye#1321

Signed-off-by: Michael Edgar <michael@xlate.io>
@MikeEdgar MikeEdgar added this to the 3.1.2 milestone Jan 8, 2023
@MikeEdgar MikeEdgar reopened this Jan 12, 2023
@MikeEdgar MikeEdgar modified the milestones: 3.1.2, 3.1.3 Jan 13, 2023
MikeEdgar added a commit to MikeEdgar/smallrye-open-api that referenced this issue Jan 13, 2023
MikeEdgar added a commit to MikeEdgar/smallrye-open-api that referenced this issue Jan 13, 2023
@sidohin-felix
Copy link
Author

Confirmed for me as well. Indeed all the objects are now generated!

MikeEdgar added a commit to MikeEdgar/smallrye-open-api that referenced this issue Jan 13, 2023
MikeEdgar added a commit to MikeEdgar/smallrye-open-api that referenced this issue Jan 16, 2023
MikeEdgar added a commit to MikeEdgar/smallrye-open-api that referenced this issue Jan 17, 2023
MikeEdgar added a commit that referenced this issue Jan 20, 2023
…es (#1352)

Fixes #1321

Signed-off-by: Michael Edgar <michael@xlate.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working plugin/gradle
Projects
None yet
3 participants