-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
Cyclic gradle task dependency if build configured to include openapi specification file in the build artifact #28
Comments
@bnasslahsen @kpramesh2212 @zendern Please let me know if you were able to achieve something similar. |
@tbadgu So just to make sure i understand you want to be able to
Out of curiosity, what is the use case for including it in the artifact directly?? You can access it via the spring boot app at |
@zendern Than you for your prompt response. Use case for the spec file to be included in the build artifact is so that i can use it with atlassian open api request validator for request/response validations based on the specs. Gradle dependency: com.atlassian.oai:swagger-request-validator-springmvc:2.10.1 Code snippet for configuring the validator: @Configuration
@EnableWebMvc
@Profile("!generateSpec")
public class OpenApiValidatorConfig implements WebMvcConfigurer {
private final OpenApiValidationInterceptor validationInterceptor;
public OpenApiValidatorConfig() throws IOException {
final EncodedResource specResource = new EncodedResource(
new ClassPathResource("openapi.json"),
"UTF-8");
this.validationInterceptor = new OpenApiValidationInterceptor(specResource);
}
@Bean
public Filter validationFilter() {
return new OpenApiValidationFilter(
true,
true
);
}
@Override
public void addInterceptors(final InterceptorRegistry registry) {
registry.addInterceptor(validationInterceptor);
}
} |
@tbadgu Idk if i have a good answer for you. Since this plugin relies on the app being up Im not sure how to remove that dependency exactly. But I have probably what you could at best call a hack around the problem.
And that allows me to run something like so And what it does is it generates the normal bootJar, the normal open api does, then expands the bootJar that was created, copies over the openapi.json file to the expanded bootJar location and then repackages it all back up into a jar file that is something that can be started and run. Not ideal but might be the best workaround option for now ¯_(ツ)_/¯ As for thoughts on the plugin maybe there is some sort of alias/copy of the original |
Could you use the I am not an expert on gradle however and I wasn't able to quickly find a way to do that with gradle, so that might not be possible. Since you asked for use cases: I want to use the json file to generate API classes for my angular frontend (see https://www.npmjs.com/package/ng-openapi-gen if you want to know more). So this means I would like to:
|
Yup I have written a proposal to use bootRun task. Hopefully we will try an release a new version once the proposal goes through. |
Using
I could not get the suggested hack to work. This is caused by the JAR created by
Which causes Gradle's |
What is the status, is there any further progress on this? |
Hi, What is the status of the proposal? It is a big issue for us, and I would prefer not to fork this project. |
By the end of this week. A new release, will be planned. |
@bnasslahsen Thanks for the reply. Is there anywhere I can follow the planned release content? |
You subscribe to github notifications... |
Hi again @bnasslahsen. |
The resolution of this ticket is not yet complete. We wait for the |
Hello @bnasslahsen, it's me again :-D |
Gradle build file has "$buildDir/docs" path where the spec file will be generated by the plugin configured to be included into build artifact as follows:
But since forkedSpringBootRun task has a dependency on bootJar task there is no clean way we can incorporate the openapi specification file into the build artifact due to cyclic dependency.
Circular dependency between the following tasks:
Is there any way this can be achieved?
Please let me know if anymore details are required.
The text was updated successfully, but these errors were encountered: