5GC_APIs icon indicating copy to clipboard operation
5GC_APIs copied to clipboard

server generate for flask (python)

Open totaluserkksssssks opened this issue 5 years ago • 4 comments

hi, is it possible to generate server file for flask?

https://jdegre.github.io/5GC_APIs/editor/?url=https://raw.githubusercontent.com/jdegre/5GC_APIs/master/TS29122_NIDD.yaml

totaluserkksssssks avatar May 29 '19 21:05 totaluserkksssssks

Hi @totaluserkksssssks, you may want to have a look at projects such as swagger-api/swagger-codegen or OpenAPITools/openapi-generator. Both claim to support python/flask for generation of server stubs.

The server-side generators included in the Swagger Editor apparently do not support python/flask for OpenAPI 3, and they only support it for Swagger 2.

jdegre avatar May 30 '19 11:05 jdegre

Hi, I pushed here sample project to generate the code from this repository by using OpenAPITools/openapi-generator. However some generators are not mature yet for OpenAPI 3.

For python flask generated code I have reported this issue https://github.com/OpenAPITools/openapi-generator/issues/6483 and also encountered this problem https://github.com/OpenAPITools/openapi-generator/issues/3345.

H21lab avatar Jun 04 '20 06:06 H21lab

In my experience using Python with these specs, the code generated by swagger and openapi-generator (its "bastard" fork) was only useful to get to "Hello World". Implementing actual Network Functions goes far beyond.

I would recommend choosing the REST framework that better fits your project, then adding a OpenAPI validation+normalization "middleware" layer. In my project we had to develop mostly from scratch due to the lack of stable libraries back in 2018.

With Python the biggest challenge is HTTP/2. A reverse-proxy can solve the server side. For the client side there is a nice clean Python binding for Nginx's nghttp2 library called pynghttp2.

gatopeich avatar Jun 10 '20 11:06 gatopeich

Hello,

At b<>com, we also work with OpenAPITools/openapi-generator in order to generate producer and consumer source code from 3GPP 5GC OpenAPI files. Please visit our web site https://5g.labs.b-com.com/ for more information. Some information about source code generation is available in presentation slides done at OSA workshops. Feel free to contact us.

tnmtechnologies avatar Nov 03 '20 11:11 tnmtechnologies