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
Ability to add custom ApiDescriptions not described via request mappings #1335
Comments
This would be a nice feature thanks for reporting. Would you like to take a stab at a PR? |
I'm in the same context. Has the PR been prepared? |
Was forced to does this @Override
@SuppressWarnings("unchecked")
public void apply(ApiListingContext apiListingContext) {
ApiListingBuilder builder = apiListingContext.apiListingBuilder();
Field field = ReflectionUtils.findField(builder.getClass(), "apis");
ReflectionUtils.makeAccessible(field);
Object value = Optional.ofNullable(ReflectionUtils.getField(field, builder)).orElse(Collections.emptyList());
List<ApiDescription> apis = (List<ApiDescription>) value;
List<ApiDescription> newApis = new ArrayList<>(apis);
newApis.addAll(additionalOperations);
builder.apis(newApis);
} Hope this feature will be in the next release |
Does anybody work on this? Or I can take a look at this feature? |
@batalkin that would be awesome. Let me know what you're plans are just to make sure its in line with the direction of the library and Id be happy to answer any questions you might have |
I'm using springfox-swagger2 v2.4.0 in a project that uses Spring OAuth2 authentication flow.
My swagger config looks like this:
Now I want to document OAuth endpoints. I don't like what is generated by default for this endpoints and I can't modify this, because controllers that serve oauth endpoints are part of spring-security-oauth2 library.
So, I thought that I can add custom operation into swagger by extending ApiListingBuilderPlugin.
I created this
@Bean
Overall it's doing what I need, but the problem is that it overrides all api listing generated by
springfox.documentation.spring.web.scanners.ApiListingScanner
, so resultingapi-docs
json contains only/oauth/token
api operation, that was described manually inOAuthApiListing
.I'm not sure if this is correct way to add some documented operation into swagger. So, please, point me out if there is other way.
Thanks.
The text was updated successfully, but these errors were encountered: