Can you clarify some points regarding RESTful services and code generation?

I struggled with understanding a few points that I continue to read regarding RESTful services. I hope someone can help clarify.

1a) There seems to be a general aversion to generated code when talking about RESTful services.

1b) The argument that if you use WADL to generate a client for a RESTful service when the service changes is also your client code.

Why I don’t understand: do you reference WADL and use the generated code, or did you manually extract the data from the RESTful answer and match it with your user interface (or what you do with them) if something changes in the base service it seems it is equally likely that the code will be broken in both cases. For example, if data returns changes from FirstName and LastName to FullName, in both cases you will have to update your code to capture a new field and possibly handle it differently.

2) The argument that RESTful services do not need WADL, because the return types must be well-known MIME types, and you should already know how to handle them.

Why I do not understand this: Is it expected that for each "type" of data returned by the service, there will be a unique MIME type? If so, does this mean that the RESTful service consumer should read the RFC to determine the structure of the returned data, how to use each field, etc.?

I read a lot trying to figure this out for myself, so I hope someone can provide concrete examples and real scenarios.

+5
source share
2 answers

. , 5 , . , (, ), , .

, , :

RESTafarians ?

: (+ ) .

. (WADL) . , , . (IMHO ).

REST . Hypermedia - . . HATEOAS

"", , , . , " ", ( ) . , . ( -/ /). , "" .

, " ". - ? URI , , Amazon S3.

, (), , Atom -. , (link + forms + data - hypermedia) , .

, :): . -, WADL, /. , . (, ). FirstName + LastName FullName , First + Last FullName .

: REST ( - GET, PUT, POST, DELETE + ) .

, , " " : WADL WSDL () " - (WSDL + SOAP)" /RPC, REST. REST , RPC, .

: , .

+4

API. .

, (: ), . .

, WADL - . , . , API.

1.0 , . 1.1, .

, , WADL . API. . , . .

, WADL mime.

WADL . JAXB JSON bean.

WADL, , . .

var obj = jQuery.parseJSON( '{ "": "" }); alert (obj.name === "John" );

, .

0

All Articles