<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
As I mentioned, we just discovered all handlers along with their
urls (Tornado pre-processed url regexps so this was bit easier) and
all models (we used Django). Based on this we set up a handler that
generated Swagger JSON file according to this schema<br>
<br>
<a class="moz-txt-link-freetext" href="https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md">https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md</a><br>
<br>
Swagger UI was told to use the URL of this handler as the feed of
the spec and that's basically all. We didn't implement auth since we
wanted the docs to be widely visible. We did have Basic Auth though
but that was on nginx side which stood in front of the whole API.<br>
<br>
P.<br>
<br>
<div class="moz-cite-prefix">On 12/01/2014 08:00 PM, Dmitriy Shulyak
wrote:<br>
</div>
<blockquote
cite="mid:CAP2-cGf78VOxZsCo+ks01yrvmfice6A7rRUrt3qtFoZZwzydKg@mail.gmail.com"
type="cite">
<div dir="ltr">Swagger is not related to test improvement, but we
started to discuss it here so..
<div><br>
</div>
<div>@<span
style="font-family:arial,sans-serif;font-size:13.3333339691162px;white-space:nowrap">Przemyslaw</span><span
style="font-family:arial,sans-serif;font-size:13.3333339691162px;font-weight:bold;white-space:nowrap">,
</span><span
style="font-family:arial,sans-serif;font-size:13.3333339691162px;white-space:nowrap">how
hard it will be to integrate it with nailgun rest api
(web.py and handlers hierarchy)?</span></div>
<div><span
style="font-family:arial,sans-serif;font-size:13.3333339691162px;white-space:nowrap">Also
is there any way to use auth with swagger?</span></div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Mon, Dec 1, 2014 at 1:14 PM,
Przemyslaw Kaminski <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:pkaminski@mirantis.com" target="_blank">pkaminski@mirantis.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>
<div class="h5"> <br>
<div>On 11/28/2014 05:15 PM, Ivan Kliuk wrote:<br>
</div>
<blockquote type="cite"> Hi, team!<br>
<br>
Let me please present ideas collected during the
unit tests improvement meeting:<br>
1) Rename class ``Environment`` to something more
descriptive<br>
2) Remove hardcoded self.clusters[0], e.t.c from
``Environment``. Let's use parameters instead<br>
3) run_tests.sh should invoke alternate syncdb() for
cases where we don't need to test migration
procedure, i.e. create_db_schema()<br>
4) Consider usage of custom fixture provider. The
main functionality should combine loading from
YAML/JSON source and support fixture inheritance<br>
5) The project needs in a document(policy) which
describes:<br>
- Tests creation technique;<br>
- Test categorization (integration/unit) and
approaches of testing different code base<br>
- <br>
6) Review the tests and refactor unit tests as
described in the test policy<br>
7) Mimic Nailgun module structure in unit tests<br>
8) Explore <a moz-do-not-send="true"
href="http://swagger.io/" target="_blank">Swagger
tool</a><br>
</blockquote>
<br>
</div>
</div>
Swagger is a great tool, we used it in my previous job. We
used Tornado, attached some hand-crafted code to
RequestHandler class so that it inspected all its
subclasses (i.e. different endpoint with REST methods),
generated swagger file and presented the Swagger UI (<a
moz-do-not-send="true"
href="https://github.com/swagger-api/swagger-ui"
target="_blank">https://github.com/swagger-api/swagger-ui</a>)
under some /docs/ URL.<br>
What this gave us is that we could just add YAML
specification directly to the docstring of the handler
method and it would automatically appear in the UI. It's
worth noting that the UI provides an interactive form for
sending requests to the API so that tinkering with the API
is easy [1].<br>
<br>
[1]
<a moz-do-not-send="true"
href="https://www.dropbox.com/s/y0nuxull9mxm5nm/Swagger%20UI%202014-12-01%2012-13-06.png?dl=0"
target="_blank">https://www.dropbox.com/s/y0nuxull9mxm5nm/Swagger%20UI%202014-12-01%2012-13-06.png?dl=0</a><span
class="HOEnZb"><font color="#888888"><br>
<br>
P.<br>
<br>
</font></span>
<blockquote type="cite"><span class="">
<pre cols="72">--
Sincerely yours,
Ivan Kliuk</pre>
<br>
<fieldset></fieldset>
<br>
</span><span class="">
<pre>_______________________________________________
OpenStack-dev mailing list
<a moz-do-not-send="true" href="mailto:OpenStack-dev@lists.openstack.org" target="_blank">OpenStack-dev@lists.openstack.org</a>
<a moz-do-not-send="true" href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a>
</pre>
</span></blockquote>
<br>
</div>
<br>
_______________________________________________<br>
OpenStack-dev mailing list<br>
<a moz-do-not-send="true"
href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
<a moz-do-not-send="true"
href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev"
target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
<br>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
OpenStack-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a>
<a class="moz-txt-link-freetext" href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a>
</pre>
</blockquote>
<br>
</body>
</html>