@RemoteMethod(method=POST, path="/user/createWithArray") public Ok createUsers( @Body( description="List of user objects" ) User[] users ) throws InvalidUsername, IdConflict, NotAcceptable, UnsupportedMediaType;
/** * Returns <jk>true</jk> if the specified annotation contains all default values. * * @param a The annotation to check. * @return <jk>true</jk> if the specified annotation contains all default values. */ public static boolean empty(Body a) { if (a == null) return true; return allEmpty(a.description(), a.example(), a.examples(), a.api(), a.value()) && allFalse(a.required()) && empty(a.schema()); }
@RemoteMethod(method=PUT, path="/pet/{petId}") public Ok updatePet( @Body( description="Pet object that needs to be added to the store" ) UpdatePet pet ) throws IdNotFound, NotAcceptable, UnsupportedMediaType;
/** * Returns <jk>true</jk> if the specified annotation contains all default values. * * @param a The annotation to check. * @return <jk>true</jk> if the specified annotation contains all default values. */ public static boolean empty(Body a) { if (a == null) return true; return allEmpty(a.description(), a.example(), a.examples(), a.api(), a.value()) && allFalse(a.required()) && empty(a.schema()); }
@Body public static class B05 { private String s; public B05(Reader in) throws Exception { this.s = IOUtils.read(in); } @Override public String toString() { return s; } } }
/** * Returns <jk>true</jk> if the specified annotation contains all default values. * * @param a The annotation to check. * @return <jk>true</jk> if the specified annotation contains all default values. */ public static boolean empty(Body a) { if (a == null) return true; return allEmpty(a.description(), a.example(), a.examples(), a.api(), a.value()) && allFalse(a.required()) && empty(a.schema()); }
@RemoteMethod /* method and path inferred from method name */ public long postPet( @Body( description="Pet object to add to the store" ) CreatePet pet ) throws IdConflict, NotAcceptable, UnsupportedMediaType;
private ObjectMap merge(ObjectMap om, Body a) throws ParseException { if (empty(a)) return om; om = newMap(om); if (a.value().length > 0) om.putAll(parseMap(a.value())); if (a.api().length > 0) om.putAll(parseMap(a.api())); return om .appendSkipEmpty("description", resolve(a.description())) .appendSkipEmpty("x-example", resolve(a.example())) .appendSkipEmpty("x-examples", parseMap(a.examples())) .appendSkipFalse("required", a.required()) .appendSkipEmpty("schema", merge(om.getObjectMap("schema"), a.schema())) ; }
@RemoteMethod public Ok postUser( @Body( description="Created user object" ) User user ) throws InvalidUsername, IdConflict, NotAcceptable, UnsupportedMediaType;
private ObjectMap merge(ObjectMap om, Body a) throws ParseException { if (empty(a)) return om; om = newMap(om); if (a.value().length > 0) om.putAll(parseMap(a.value())); if (a.api().length > 0) om.putAll(parseMap(a.api())); return om .appendSkipEmpty("description", resolve(a.description())) .appendSkipEmpty("x-example", resolve(a.example())) .appendSkipEmpty("x-examples", parseMap(a.examples())) .appendSkipFalse("required", a.required()) .appendSkipEmpty("schema", merge(om.getObjectMap("schema"), a.schema())) ; }
@RestMethod( summary="Overwrite the JSON-Schema document", description="Replaces the schema document with the specified content, and then mirrors it as the response." ) public JsonSchema put(@Body JsonSchema schema) throws Exception { this.schema = schema; return schema; } }
private ObjectMap merge(ObjectMap om, Body a) throws ParseException { if (empty(a)) return om; om = newMap(om); if (a.value().length > 0) om.putAll(parseMap(a.value())); if (a.api().length > 0) om.putAll(parseMap(a.api())); return om .appendSkipEmpty("description", resolve(a.description())) .appendSkipEmpty("x-example", resolve(a.example())) .appendSkipEmpty("x-examples", parseMap(a.examples())) .appendSkipFalse("required", a.required()) .appendSkipEmpty("schema", merge(om.getObjectMap("schema"), a.schema())) ; }
@RestMethod( summary="Overwrite the sample ATOM feed", description="Replaces the feed with the specified content, and then mirrors it as the response." ) public Feed put(@Body Feed feed) throws Exception { this.feed = feed; return feed; } }
@RemoteMethod(method=PUT, path="/pet/{petId}") public Ok updatePet( @Body( description="Pet object that needs to be added to the store" ) UpdatePet pet ) throws IdNotFound, NotAcceptable, UnsupportedMediaType;
@Body public static class B01 { private String val; public B01(String val) { this.val = val; } @Override public String toString() { return val; } } @RestMethod(name=PUT, path="/Bean")
@Body public static class B02 { public String f1; } @RestMethod(name=PUT, path="/BeanList")
@Body({ "description:'a\nb',", "required:true,", "schema:{type:'string'},", "x-example:'\\'a\\'',", "x-examples:{foo:'bar'}" }) public static class SA02 { public SA02(String x) {} } @RestMethod