You may want to take a look at FastAPI[1], it already does more or less
what you ask for.

There is no need for it to be part of the Python core, it's fine as it is
as a package.

[1] https://fastapi.tiangolo.com/

On Fri, 6 Aug 2021 at 17:39, Vaideeswaran Ganesan <vaid...@gmail.com> wrote:

> OpenAPI (https://spec.openapis.org/oas/latest.html) is an emerging
> standard for defining RESTful interfaces.
> OpenAPI is supported by swagger - which provides tools to convert an
> OpenAPI spec into python code (for both backend as well as client).
>
> The proposition I have is to make OpenAPI native to python.  Essentially,
> this involves some of the following:
> 1. OpenAPI provides definitions of objects, arrays, structures, primitive
> types, collections etc.
> 2. OpenAPI supports object creation (HTTPS POST), object modification
> (PUT), object deletion (DELETE) and object retrieval (GET).
> 3. OpenAPI also supports operations for collections (add to collection,
> remove from collection and modify collection)
> 4. OpenAPI also supports methods and allows parameters to be passed to
> these APIs.
>
> The Native Python implementation would load in OpenAPI specification and
> provide native Python experience as follows:
> 1. Primitive types are mapped to python primitive types
> 2. Objects and structures are treated as classes or dicts wrapped.  The
> field names in the Spec are accessible.
> 3. Arrays and Collections are mapped to python lists.
> 4. URLs are converted into object structure.
> 5.  Python inspection methods (__getattr__, __setattr__, __new__, __del__
> and others) of this model is changed to manipulate the fetched objects
> dynamically
>
> Parts of this implementations are found in various places : sushy
> (OpenStack) etc.
> However, having a more organized approach would make life easier.
>
> Swagger has a tool that can generate the code.  But this means that every
> time a specification changes you need to ship a new python library.
> The methodology presented not require any addition python libraries - the
> tool can download from the REST end point.
>
> By making OpenAPI native to python, we would avoid cumbersome handling of
> request codes etc. and make it as you we are accessing native objects.
> I can provide more details and a reference implementation I am working on.
>
> Wanted to know if this is worthy to be submitted as PEP!
> _______________________________________________
> Python-ideas mailing list -- python-ideas@python.org
> To unsubscribe send an email to python-ideas-le...@python.org
> https://mail.python.org/mailman3/lists/python-ideas.python.org/
> Message archived at
> https://mail.python.org/archives/list/python-ideas@python.org/message/5DBYKAEXM2Z3UQZGORXMBQTBN22RQPLT/
> Code of Conduct: http://python.org/psf/codeofconduct/
>


-- 
Gustavo J. A. M. Carneiro
Gambit Research
"The universe is always one step beyond logic." -- Frank Herbert
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/HFUX7E7DEF6M4VHQOUYYVIKKHUGK7HD5/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to