Hi Jim,
You certainly should be able to do that. It seems like there were slight
changes between Swagger 2.0.0/2.0.1 releases with respect to handling context
id,
that's why the OpenApiCustomizedResource is not finding one. What you could do
right now, as a workaround, is to override this method:
public OpenAPIConfiguration customize(final OpenAPIConfiguration
configuration) {
final OpenAPIConfiguration config = super.customize(configuration);
final OpenAPI oas = config.getOpenAPI();
// you code here
return config;
}
It seems to work fine. We'll be working on a proper fix, but it may take some
time since the way Swagger manages configuration / models is very different now.
Thank you.
Best Regards,
Andriy Redko
JT> Hi,
JT> Is it possible to use a customizer to modify the OpenApi data in the
JT> same way that it is with a Swagger Customizer?
JT> I have this:
JT> @Bean
JT> @Autowired
JT> public OpenApiFeature openApiFeature(MyOpenApiCustomizer customizer) {
JT> OpenApiFeature feature = new OpenApiFeature();
JT> feature.setVersion("1.0.0");
JT> feature.setLicense("");
JT> feature.setLicenseUrl("");
JT> feature.setSupportSwaggerUi(true);
JT> feature.setScan(true);
JT> feature.setCustomizer(customizer);
JT> feature.setTitle("Service API");
JT> feature.setDescription("The service does stuff\n");
JT> return feature;
JT> }
JT> Where MyOpenApiCustomizer just overrides one customize method:
JT> @Override
JT> public void customize(OpenAPI oas) {
JT> super.customize(oas);
JT> StringBuilder builder = new StringBuilder();
JT> builder.append(oas.getInfo().getDescription());
JT> builder.append("More docs");
JT> oas.getInfo().description(builder.toString());
JT> }
JT> I'm getting the standard openapi.json data out, but my customizer isn't
JT> being called at all.
JT> In OpenApiCustomizedResource it's looking for an OpenApiContext with a
JT> CXF ID, but not finding one.
JT> What's wrong?
JT> Thanks
JT> Jim