Which version of swagger-core do you use? And assuming it’s not the latest, can 
you try updating first?

 

 

 

From: <[email protected]> on behalf of sdav 
<[email protected]>
Reply-To: "[email protected]" 
<[email protected]>
Date: Tuesday, 23 August 2016 at 12:37
To: Swagger <[email protected]>
Subject: How to use @ExampleProperty.

 

Hi , 

 

I have checked the examples on github about @example property 
(https://github.com/swagger-api/swagger-core/blob/master/modules/swagger-jaxrs/src/test/java/io/swagger/resources/ClassWithExamplePost.java).
 I tried to implement the same on my api but i always get the error indicating 
that " @example is disallowed at this location " or "can not be resolved in to 
type".

 

 

@POST

@Produces({MediaType.APPLICATION_JSON})

@Consumes({MediaType.APPLICATION_JSON})

@ApiOperation(value="Creates new Data control")
@ApiImplicitParams({
@ApiImplicitParam(
paramType = "body",
name = "myPody",
dataType = "[Ljava.lang.String;",
examples = @Example(value = {
@ExampleProperty(mediaType="application/json", value="[\"a\",\"b\"]")}))
})

 

@ApiResponses(value = {

@ApiResponse(code = 403, message = "Invalid credentials"),

@ApiResponse(code = 404, message = "Invalid Request") })

 

public JsonObject create(@ApiParam(hidden=true)JsonObject request) {

log.info("create new data control");

JsonObject response = null;

try{..................................

...............................}

}

 

No matter where i use i get the same error. so can you please tell me what is 
the correct way of using the @example property?

-- 
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.

-- 
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