ply icon indicating copy to clipboard operation
ply copied to clipboard

Object of Type ? not injecting examples

Open notnigel opened this issue 10 months ago • 0 comments

If we have an object Page of type User. We cannot use the return type for the schema.

The schema response here should be a Page of type UsageDetailsResponse which should just pull the return type from the method. The Plyex plugin finishes without error but it puts an extra closing bracket in the generated spec that makes it invalid. Even though the plugin run is errorless, no examples are generated.

Model

public class User {
   private String name;

   public User(String name) {
      this.name = name;
}

Controller


@ApiResponse(responseCode = "200", useReturnTypeSchema = true, content = {@Content(schema = @Schema(implementation = void.class), mediaType = MediaType.APPLICATION_JSON_VALUE)})
@RestController
@RequestMapping("api/v1/users")
public class UserController {
    @GetMapping(
            value = "/iwhoami",
            produces = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<Page<User>> whoami(
            User user) {
                 return new ResponseEntity<>(HttpStatus.OK);
   }
}

notnigel avatar Apr 12 '24 20:04 notnigel