Open haakobja opened 8 years ago
Looks like you already can do it!
https://github.com/kongchen/swagger-maven-plugin#excluding-certain-apimodelproperty-items
Yes, it does work for the objects returned from an endpoint. My case is that I want to exclude certain endpoints, not only their request/response objects.
I know some time had passed, but using @Api(hidden = true) should hide it. I used it in the whole class not in the function linked to an endpoint. Hope it helps.
Yes, I know about the @Api(hidden = true), but as you say, this works on classes, not methods.
I have tried to think about this, and it would be nice to use the security definitions to do this filtering. The pom-configuration could have a "include auth"-tag, where it would be possible to define the security definitions which should be output in the file.
Like this
<configuration>
<includeAuth>
<auth type="myBasic" />
<auth type="myOauth" scope="read" />
</includeAuth>
</configuration>
If it is used on a class like this
public class Endpoints {
@ApiOperation(
authorizations = {
@Authorization("myApiKey")
}
)
public Response securedWithAPIKey() {}
@ApiOperation(
authorizations = {
@Authorization("myOAuth", {@AuthorizationScope("read")})
}
)
public Response securedWithOauthRead() {}
@ApiOperation(
authorizations = {
@Authorization("myOAuth", {@AuthorizationScope("write")})
}
)
public Response securedWithOauthWrite(Input) {}
@ApiOperation(
authorizations = {
@Authorization("myBasic")
}
)
public Response securedWithBasic() {}
}
In this example, the securedWithBasic
and securedWithOauthRead
should be output in the swagger.yaml
I am also expecting the same behavior. In a class I would like to exclude few REST endpoints from the swagger generation. Because those endpoints are only for internal usage. Not for public usage.
Is there any progress or how to achieve this?
@APIOperation(hidden=true) with this annotation we can ignore the rest endpoints while generating Swagger
This works thanks @zarub2k :-)
@ApiOperation(value = "", hidden = true)
We are using swagger-maven-plugin to generate swagger documentation. we have the proper annotation for each class and respective method (all API). We are in the need of generating the swagger documentation, and it's generating with all my API's in a single document.
Requirement: Is that possible to generate two set of swagger documents based on the some categorization?Here i am trying to categorize with "public" and "private" As per https://github.com/kongchen/swagger-maven-plugin/blob/master/README.md, I have used apiModelPropertyAccessExclusions but it's not working.
@ApiModelProperty(name="addReport", access="public", hidden=true)
pom.xml::
<apiModelPropertyAccessExclusions>
<apiModelPropertyAccessExclusion>public</apiModelPropertyAccessExclusion>
</apiModelPropertyAccessExclusions>
It's not working as expected. Please help me out.
Looking for the same solution , the search is still on, I am not able to achieve this either
we would also love for a good way to generate public and private docs separately. we use the hidden flag on a lot of stuff. it'd be nice to simple have an option like "ignore hidden" which would include everyting.
Filtering/exclusion of endpoints should be allowed.
It would be nice to be able to filter which endpoints should be exported to Swagger.yaml using the
@ApiModelProperty(access="...")
annotation.Following is an example of my proposal:
POM:
This would produce two yaml-files, one including the
/path/goes/here
-GET and one excluding it