I am using swagger for my REST API documentation.  
Like 

GET
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Get User")
@PermitAll
@Path("/users/{userId}")
@ApiResponses(value = {
        @ApiResponse(code = HttpStatus.OK_200, message = "User", response = 
User.class),
        @ApiResponse(code = HttpStatus.FORBIDDEN_403, message = "You are not 
authorised"),
        @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "User Not 
Found!"),
})
public User getUser(@PathParam("userId") String userId) {
}


I want to return a sample(mock) User object created by me. I can always add 
that code in my actual controller function till the time i write actual 
implementation, but that wont be a clean solution and also i want to have 
my mock responses working parallely with actual response.

I went through the swagger-core documentation and found that there's way to 
have mock requests(through @Example annotation) but not mock responses.

Is there a way to do it.?


On Thursday, 22 December 2016 21:29:12 UTC+5:30, Ron wrote:
>
> “swagger” doesn’t do anything really – it depends on the library you use 
> and its capabilities.
>
>  
>
>  
>
>  
>
> *From: *simarpreet via Swagger <[email protected] 
> <javascript:>>
> *Reply-To: *"[email protected] <javascript:>" <
> [email protected] <javascript:>>
> *Date: *Thursday, 22 December 2016 at 2:44
> *To: *Swagger <[email protected] <javascript:>>
> *Subject: *Can I return mock(sample) JSON responses using swagger?
>
>  
>
> I am using swagger bundle in my dropwizard application. The requirement is 
> that I want to send sample responses to incoming requests. Those sample 
> responses will be created by me. 
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Swagger" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to