Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #9328
Closed
Open
Issue created Apr 23, 2021 by Administrator@rootContributor1 of 6 checklist items completed1/6 checklist items

[BUG] ValidateTask does not work under Gradle 7.0

Created by: ilya40umov

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

ValidateTask stops working if gradle version is upgraded to 7.0.

The following task definition works under 6.8.3, but fails under 7.0:

val validateOpenApi by registering(ValidateTask::class) {
    group = "verification"
    description = "Validate openapi.yaml"
    recommend.set(true)
    input = "$rootDir/openapi.yaml"
}
val check by registering {
    dependsOn(validateOpenApi)
}

Here is the output:

* What went wrong:
Some problems were found with the configuration of task ':validateOpenApi' (type 'ValidateTask').
  - Type 'ValidateTask' property 'inputSpec' of mutable type 'org.gradle.api.provider.Property' is writable.

    Reason: Properties of type 'org.gradle.api.provider.Property' are already mutable.

    Possible solution: Remove the 'setInputSpec' method.

    Please refer to https://docs.gradle.org/7.0/userguide/validation_problems.html#mutable_type_with_setter for more details about this problem.
  - Type 'ValidateTask' property 'recommend' of mutable type 'org.gradle.api.provider.Property' is writable.

    Reason: Properties of type 'org.gradle.api.provider.Property' are already mutable.

    Possible solution: Remove the 'setRecommend' method.

    Please refer to https://docs.gradle.org/7.0/userguide/validation_problems.html#mutable_type_with_setter for more details about this problem.
openapi-generator version

id("org.openapi.generator") version "5.1.0" apply false

Suggest a fix

Apparently the following properties of ValidateTask should not be declared as var as they are already mutable properties anyway:

@get:InputFile
@PathSensitive(PathSensitivity.RELATIVE)
var inputSpec = project.objects.property<String>()

@Optional
@Input
var recommend = project.objects.property<Boolean?>()
Assignee
Assign to
Time tracking