springdoc-openapi-gradle-plugin
springdoc-openapi-gradle-plugin copied to clipboard
Is there any way to set it so that the output file is overwritten when you build?
Is there any way to set it so that the output file is overwritten when you build? I use this:
openApi {
outputFileName.set("openapi.yaml")
}
I noticed that it won't overwrite the yaml file if there is already one there with the same name.
Is there any way to set it so that the output file is overwritten when you build? I use this:
openApi { outputFileName.set("openapi.yaml") }
I noticed that it won't overwrite the yaml file if there is already one there with the same name.
I would like the same feature. I assume it is not possible because documentation states that Springdoc outputs are only available at runtime, but it would be pretty awesome to have it. By the way, I am not able to get the spec file in yaml format. Yaml format seems only available when it is already provided that way from the generated documentation and I am not able to configure it like that
+1
The task caching is a bit too optimistic and seems to rely on a clean to have run beforehand to clear the build folder. This of course doesn't work if you're not writing to the build folder and/or not removing the file on a clean .
Potentially the task should either:
- simply just be an untracked task and always run,
- or check if the input jar used by forkedSpringBootRun has changed or not
Adding this gradle block will override generateOpenApiDocs
to be an untracked task and always run.
tasks {
generateOpenApiDocs {
doNotTrackState("https://github.com/springdoc/springdoc-openapi-gradle-plugin/issues/131")
}
}
Have a try with the following Gradle script:
tasks.named('generateOpenApiDocs') {
outputs.upToDateWhen {
false
}
}
I created a pull request to use the inputs for the OpenAPI generation task to be the same as for the Spring Boot task. This will regenerate the OpenAPI if and only if the source files of the application change (but not if for example the tests change). See https://github.com/springdoc/springdoc-openapi-gradle-plugin/pull/147
@waterdrake,
https://github.com/springdoc/springdoc-openapi-gradle-plugin/pull/147 should resolve the issue.