Shane,

Thanks for this suggestion.

I did not know about Sagger/OpenAPI, so thanks for the heads-up on
that.  I'll do a bit of reading and thinking on it.  Like 87% or
more of programmers today I'm interested in REST.  Lately I've been
trying to learn how to implement REST CRUD (create, read, update,
delete) applications with flask and flask-restful in Python and with
the Cowboy Web server in Erlang.  My dream is to be able to get
Raspberry Pi computers to talk to and control one another using HTTP
and REST.  I've become infected with the IoT that people are talking
about, I suppose.

With respect to gDS and Django, we're generating a model for the
Django ORM.  I suppose that we could look at the various definitions
in that generated model as specifications of a separate resources.
So, that could be our connection to REST.

If that makes sense, then we can ask: What would we in the way of
producing a REST API that aligns with that generated Django model?

However, while the Django model that we generate can be interpreted
as a definition of a resource, in contrast, OpenAPI guides you to
define an API, that is, a set of operations on that resource.  So, a
first question is: How do we get from the first (the definition of a
resource) to the second (a description of a set of operations on
that resource)?  Hmmm.

Perhaps we could make the assumption that each resource (each model
defined in the generated `model.py`) would have, by default,  the
standard set of CRUD operations on it, specifically: create,
read/get, update, and delete).  But, if that is our assumption, that
the API would be very predictable, not to mention, repetitive, and
I'm not sure how valuable it would be to generate it.  What do you
think?

As you can easily see, I'm groping here, and any suggestions or
guidance you can give me will be welcomed.

I've cloned the specification from:
https://github.com/OAI/OpenAPI-Specification.git.

The specification (I'm reading version 2.0, now, and will look for
version 3.0 later) seems to say that in addition to specifying an
API for accessing these objects, we'd also generate a description of
the underlying resources, that is the Django models.

So, I suppose, while we are generating `model.py` and `form.py`, we
could generate an additional file containing the OpenAPI
specification of the models.  Perhaps, it would be a description of
the data structures represented in JSON.  Is that along the lines of
what you had in mind?

I'll study and think a bit more, and will report back later.

Dave

On Tue, Apr 04, 2017 at 05:46:27PM +1000, Shane Rigby wrote:
> Hi Dave,
> 
> I continue to play around with GenerateDS and the Django models it
> generates.
> 
> Have you had, or heard of anyone that has successfully used swagger 3 (now
> https://www.openapis.org/) to document the Django interface? This would be
> of massive benefit.
> 
> Regards,
> 
> Shane

-- 

Dave Kuhlman
http://www.davekuhlman.org

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to