-
Notifications
You must be signed in to change notification settings - Fork 127
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
Show All Objects that have annotation @ApiObject? #223
Comments
The See But I agree that detecting more types would be nice. However I'm not sure whether it should support ALL of the annotated things. public class HttpResult {
private String msg;
private Integer code;
@APIDynamicType({FooBar.class, AnyBar.class, FourtyTwo.class, MyDataContainer.class})
private Object data;
} This would allow the user to see what can actually be in there instead of just |
@ST-DDT I have a question, why only small different between has or not has |
I find it strange that even with the annotation, it does not appear in JsonDoc. I mean, if the developer made the effort to put the annotation |
I also have this question. |
Example fix: Add the following to AbstractSpringJSONDocScanner#jsondocObjects() [...]
for (final Method method : methodsAnnotatedWith) {
buildJSONDocObjectsCandidates(candidates, method.getReturnType(), method.getGenericReturnType(),
this.reflections);
final Integer requestBodyParameterIndex = JSONDocUtils.getIndexOfParameterWithAnnotation(method,
RequestBody.class);
if (requestBodyParameterIndex != -1) {
candidates.addAll(
buildJSONDocObjectsCandidates(candidates, method.getParameterTypes()[requestBodyParameterIndex],
method.getGenericParameterTypes()[requestBodyParameterIndex], this.reflections));
}
}
// NEWLY ADDED - START
candidates.addAll(this.reflections.getTypesAnnotatedWith(ApiObject.class, true));
// NEWLY ADDED - END
// This is to get objects' fields that are not returned nor part of the
// body request of a method, but that are a field
// of an object returned or a body of a request of a method
for (final Class<?> clazz : candidates) {
appendSubCandidates(clazz, subCandidates, this.reflections);
}
[...] |
Now, JSONDoc only care that the objects with annotation
ApiPathParam
,ApiQueryParam
,ApiBodyObject
,ApiResponseObject
.If my custom object not use those annotations, I will not get JSONDoc for it.
In my team, HTTP API's
ApiResponseObject
is:JSONDoc not support my custom object by
HttpResult.data
property.So I had modfied JSONDoc to support all objects that have annotation
ApiObject
, and use it in my team.Would I can commit it?
The text was updated successfully, but these errors were encountered: