<div dir="ltr"><br><div class="gmail_quote"><div dir="ltr"><div>Hi Juan,<br><br></div><div>The way to specify the contract look pretty clean and nice.<br>I would love to read a few words about the big picture. What is the final scenario?<br></div><div><div><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Mon, Oct 26, 2015 at 4:03 PM, Juan Hernández <span dir="ltr">&lt;<a href="mailto:jhernand@redhat.com" target="_blank">jhernand@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello,<br>
<br>
I will soon merge the following patches that introduce a new way to<br>
specify the contracts of the RESTAPI:<br>
<br>
  restapi: Introduce metamodel<br>
  <a href="https://gerrit.ovirt.org/45852" rel="noreferrer" target="_blank">https://gerrit.ovirt.org/45852</a><br>
<br>
  restapi: Use metamodel<br>
  <a href="https://gerrit.ovirt.org/46478" rel="noreferrer" target="_blank">https://gerrit.ovirt.org/46478</a><br>
<br>
  restapi: Generate JAX-RS interfaces from model<br>
  <a href="https://gerrit.ovirt.org/47337" rel="noreferrer" target="_blank">https://gerrit.ovirt.org/47337</a><br>
<br></blockquote><div><br></div></span><div>Looks pretty much like we are replacing one way of annotating things with another way of specifying things.<br></div><div>Could you elaborate what the benefit of that way of description is?<br><br></div><div>How would I customize endpoints with e.g. @Gzip annotations? Would I at the end still have my JAX-RS annotates resource classes?<br></div><div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
These patches introduce a new &quot;metamodel&quot; concept, and move the current<br>
specification of the RESTAPI based on XML schema and JAX-RS interfaces<br>
to a new &quot;model&quot; built on the new metamodel.<br>
 </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
What does this mean for you in practical terms? Currently when you want<br>
to introduce or modify one of the data types used by the RESTAPI you<br>
start by modifying the XML schema. Once the patches are merged the XML<br>
schema will never be touched, as it will be automatically generated from<br>
the &quot;model&quot;. For example, imagine that you need to add a new &quot;color&quot;<br>
attribute to the &quot;VM&quot; entity. To do so with the new model you will have<br>
to modify the following file, which is the specification of the &quot;Vm&quot;<br>
entity, written as a Java interface:<br>
<br>
<br>
<a href="https://gerrit.ovirt.org/#/c/46478/16/backend/manager/modules/restapi/model/src/main/java/types/Vm.java" rel="noreferrer" target="_blank">https://gerrit.ovirt.org/#/c/46478/16/backend/manager/modules/restapi/model/src/main/java/types/Vm.java</a><br>
<br>
In that interface you will have to add a line like this:<br>
<br>
  String color();<br>
<br>
Note that this Java interface is just the specification of the entity,<br>
it won&#39;t be used at all during runtime. Instead of that the XML schema<br>
will be generated from it, and then Java will be generated from the XML<br>
schema, as we do today (this will change in the future, but not yet).<br>
<br>
Same for the services. If you want to add a new &quot;paint&quot; action to the<br>
&quot;Vm&quot; resource then you won&#39;t modify the JAX-RS interfaces, instead of<br>
that you will modify the following file, which is the specification of<br>
the &quot;Vm&quot; service, written as a Java interface:<br>
<br>
<br>
<a href="https://gerrit.ovirt.org/#/c/47337/6/backend/manager/modules/restapi/model/src/main/java/services/VmService.java" rel="noreferrer" target="_blank">https://gerrit.ovirt.org/#/c/47337/6/backend/manager/modules/restapi/model/src/main/java/services/VmService.java</a><br>
<br>
In that interface you will need to add a sub-interface representing the<br>
action:<br>
<br>
  interface Paint {<br>
  }<br>
<br>
The JAX-RS interface will be generated from that. Currently these<br>
sub-interfaces are empty. In the future they will contain the<br>
specifications of the parameters (currently in the rsdl_metadata.yml file).</blockquote></div></div></div><div class="gmail_quote"><div><div class="h5"> <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
These changes will currently affect only the specification of the<br>
RESTAPI, not the implementation, so in in the &quot;Backend*Resource&quot; classes<br>
things won&#39;t change yet.<br>
<br></blockquote><div><br></div></div></div><div>Currently I do not really understand where we are going here. Are we trying to get rid of rdsl?<br><br></div><div>So basically two questions:<br><br></div><div>1) What is the final goal?<br></div><div>2)
 What speaks agains using Hibernate validator on Daos in combination 
with JAX-RS annotated resources (and just removing all interfaces, as 
far as I can see we only have one implementation per endpoint) and 
creating all schemas and clients through SWAGGER tooling?<br> </div><span class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
If you have doubts, please let me know.<br>
<br>
Regards,<br>
Juan Hernandez<br>
<span><font color="#888888"><br>
--<br>
Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta<br>
3ºD, 28016 Madrid, Spain<br>
Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L.<br>
_______________________________________________<br>
Devel mailing list<br>
<a href="mailto:Devel@ovirt.org" target="_blank">Devel@ovirt.org</a><br>
<a href="http://lists.ovirt.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.ovirt.org/mailman/listinfo/devel</a></font></span></blockquote></span></div><br></div><div class="gmail_extra">Thanks,<br><br></div><div class="gmail_extra">Roman<br></div></div></div></div>
</div><br></div>