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

[BUG] [gradle] Tasks that inherit ValidateTask will fail if recommend is not assigned. #6371

Closed
5 of 6 tasks
doyasu24 opened this issue May 19, 2020 · 4 comments · Fixed by #16580
Closed
5 of 6 tasks

Comments

@doyasu24
Copy link
Contributor

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

I am using the openapi-generator-gradle-plugin.
I've noticed that the default value doesn't work well with ValidateTask.
I tried the samples in this repository and the problem was reproduced.

Although recommend has a default value, tasks that inherit ValidateTask will fail if recommend is not assigned.
https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator-gradle-plugin#openapivalidate

task validateGoodSpec(type: org.openapitools.generator.gradle.plugin.tasks.ValidateTask){
    inputSpec = "$rootDir/petstore-v3.0.yaml".toString()
//	recommend = true
//      recommend = false
}
openapi-generator version

I have tried with 4.3.0 and 4.3.1.

OpenAPI declaration file content or url

https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator-gradle-plugin/samples/local-spec/petstore-v3.0.yaml

Command line used for generation

./gradlew validateGoodSpec
./gradlew -PopenApiGeneratorVersion=4.3.0 validateGoodSpec
./gradlew -PopenApiGeneratorVersion=4.3.1 validateGoodSpec

Steps to reproduce

I clone this repository and exec validateGoodSpec.

git clone git@github.com:OpenAPITools/openapi-generator.git
cd openapi-generator/modules/openapi-generator-gradle-plugin/samples/local-spec
./gradlew validateGoodSpec

> Task :validateGoodSpec FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':validateGoodSpec'.
> No value has been specified for this provider.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 895ms
1 actionable task: 1 executed

I have explicitly assigned true or false to recommend.
Then the task was successful.

> Task :validateGoodSpec
Validating spec /****/openapi-generator/modules/openapi-generator-gradle-plugin/samples/local-spec/petstore-v3.0.yaml
Spec is valid.

BUILD SUCCESSFUL in 1s
1 actionable task: 1 executed
Related issues/PRs

#4643
#5183

Suggest a fix

I think it should be set default value before get is called at

@auto-labeler
Copy link

auto-labeler bot commented May 19, 2020

👍 Thanks for opening this issue!
🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.

@mrworkman
Copy link

Just ran into this too. Would be nice if the docs said recommend is required in this case.

@doyasu24
Copy link
Contributor Author

doyasu24 commented Jun 14, 2022

This issue was fixed by the following commit.
e4c858c
#6716

@doyasu24
Copy link
Contributor Author

still reproduced in v7.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants