question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Gradle Plugin - configOptions unclear / inconsistent

See original GitHub issue

Bug Report Checklist

x

Couldn’t find a repo for the gradle plugin so I’m posting this here.

Description

The gradle plugin offers some configuration option. But it’s not clear what has to go where. The docs have an example:

openApiGenerate {
    generatorName = "kotlin"
    inputSpec = "$rootDir/specs/petstore-v3.0.yaml".toString()
    outputDir = "$buildDir/generated".toString()
    apiPackage = "org.openapi.example.api"
    invokerPackage = "org.openapi.example.invoker"
    modelPackage = "org.openapi.example.model"
    modelFilesConstrainedTo = [
            "Error"
    ]
    configOptions = [
        dateLibrary: "java8"
    ]
}

Why is dateLibrary nested inside configOptions or regardingly, why isn’t e.g. invokerPackage within configOptions, too? Both are listed in the same table [1] [2] captioned “config options”. So I’d expect all those settings to live within configOptions or none.

openapi-generator version

4.x & 5.0.0-beta2

Suggest a fix

I didn’t take a look at the other generators. Maybe I’m just blind and it’s stated somewhere.

My first shot to fix this would be to unnest configOptions so that above example becomes:

openApiGenerate {
    generatorName = "kotlin"
    inputSpec = "$rootDir/specs/petstore-v3.0.yaml".toString()
    outputDir = "$buildDir/generated".toString()
    apiPackage = "org.openapi.example.api"
    invokerPackage = "org.openapi.example.invoker"
    modelPackage = "org.openapi.example.model"
    modelFilesConstrainedTo = [
            "Error"
    ]
    dateLibrary = "java8"
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
black-snowcommented, Sep 28, 2020

I’m not doing anything with kotlin, it’s 100% java. All I did was picking the example from the docs.

My config looks like

openApiGenerate {
	generatorName = "java"
	library = "webclient"
	verbose = true
	validateSpec = true
	skipValidateSpec = false
	inputSpec = "$rootDir/src/main/resources/schema_oas3.yaml"
	outputDir = "$rootDir/../api"
	configOptions = [
		dateLibrary: "java8",
		openApiNullable: "true"
	]
	apiPackage = 'a.b.xyz.openapi'
	modelPackage = 'a.b.xyz.openapi.model'
	invokerPackage = 'a.b.xyz.openapi.client'
	groupId = 'a.b'
	id = 'xyz'
	version = '0.1'
}

My point was that it’s not clear to me what goes inside configOptions and what not, because openApiNullable is listed at the same level as e.g. apiPackage and not nested inside some configOptions.

0reactions
black-snowcommented, Oct 1, 2020

Awesome. Thanks for your efforts. I’ll close this specific issue then.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Generate Java Spring API from OpenAPI 3 - Stack Overflow
The problem seems to be in modelFilesConstrainedTo — it limits the classes to Error . Comment it out and it will work (classes...
Read more >
Changelog and Migration Guide - Detekt
Configuring reports in the Gradle plugin should be done at the task level instead of at the extension (or global) level. The previous...
Read more >
Configuration Options - OpenAPI Generator
The READMEs for the CLI, Gradle Plugin, Maven Plugin, and SBT Plugin may have top-level or tooling specific options which appear to duplicate...
Read more >
Bug listing with status UNCONFIRMED as at 2022/12/12 00 ...
Bug :128538 - "sys-apps/coreutils: /bin/hostname should be installed from coreutils not sys-apps/net-tools" status:UNCONFIRMED resolution: severity:enhancement ...
Read more >
Quarkus 2.x: Decomposed platform model proposal
If an app needs to add a platform extension that's not in the quarkus-bom, ... users as the Gradle plugin could enforce extension...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found