You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is my first swagger project, and trying to get a handle on this stuff.
I have an AppUser.java class that extends Persistent.java. I've got a AppUserRest.java class that currently has handlers for PUT and GET methods.
I have annotated AppUser with several things that shouldn't be shown, or are read-only, etc. The model and example class is shown properly in the UI documentation. It all works well UNTIL I specify a response type on the second @ApiOperation in the AppUserRest class, at which time it seems to completely ignore all annotations on AppUser, and spits out default model/example in both the GET and PUT documentation. Showing all hidden/read-only/write-only fields, etc.
I'm sure it's something simple that I'm missing being a new swagger-er. Tried with the swagger folks over in their chat, and they sent me your way. Hoping you can point me in the right direction, I've really enjoyed everything else about the ecosystem so far.
Thanks
AppUserRest.java
@RestController
public class AppUserRest {
private AppUserRepository appUserRepository;
@Autowired
AppUserService appUserService;
@ApiOperation(value = "Create new user", response = Long.class)
@RequestMapping(method = RequestMethod.PUT, value="/api/users")
public ResponseEntity newUser(@ApiParam(value="User object to create", required=true) @RequestBody AppUser newUser) {
newUser = appUserService.saveUser(newUser);
return new ResponseEntity(newUser.getId(), HttpStatus.CREATED);
}
@ApiOperation(value = "Find user by ID",
notes = "Retrieve a single user using their synthetic ID",
response = AppUser.class
)
@RequestMapping(method = RequestMethod.GET, value="/api/users/{id}")
public ResponseEntity<> getUser(@PathVariable("id") Long id) {
AppUser user = appUserService.getUser(id);
return new ResponseEntity<>(user, HttpStatus.OK);
}
}
The text was updated successfully, but these errors were encountered:
bfinleyui
changed the title
@ApiResponse
@ApiResponse "response" value causing docs to ignore model annotations
Apr 24, 2017
bfinleyui
changed the title
@ApiResponse "response" value causing docs to ignore model annotations
@ApiOperation "response" value causing docs to ignore model annotations
Apr 24, 2017
Java 8
Springfox 2.6.1
Spring boot
This is my first swagger project, and trying to get a handle on this stuff.
I have an AppUser.java class that extends Persistent.java. I've got a AppUserRest.java class that currently has handlers for PUT and GET methods.
I have annotated AppUser with several things that shouldn't be shown, or are read-only, etc. The model and example class is shown properly in the UI documentation. It all works well UNTIL I specify a response type on the second @ApiOperation in the AppUserRest class, at which time it seems to completely ignore all annotations on AppUser, and spits out default model/example in both the GET and PUT documentation. Showing all hidden/read-only/write-only fields, etc.
I'm sure it's something simple that I'm missing being a new swagger-er. Tried with the swagger folks over in their chat, and they sent me your way. Hoping you can point me in the right direction, I've really enjoyed everything else about the ecosystem so far.
Thanks
AppUserRest.java
AppUser.java
Persistent.java
The text was updated successfully, but these errors were encountered: