Generating Python client with valid docstrings
I'm using the currently latest swagger-codegen-cli-3.0.26.jarto generate Python client for my API. Then, I'm using Sphinxa to generate the client API reference in HTML format. The toolset invocation is pretty standard: sphinx-apidoc -f -o docs-python\_modules -e -P python\myclient docs-python\make.bat clean docs-python\make.bat html with a bunch of extensions in my `conf.py` for Sphinx: extensions = [ 'sphinx.ext.napoleon', 'sphinx.ext.autodoc', 'sphinx.ext.autosummary', 'sphinx.ext.coverage' ] The `make.bat html` command outputs lots of warnings like these: WARNING: Block quote ends without a blank line; unexpected unindent. WARNING: Unexpected indentation. I noticed the generator outputs docstrings which are not entirely valid. It also includes lots of the directives like `# noqa: E501` which are dedicated for the Python linters. Is there any way to control the docstring flavour or format that `swagger-codegen` outputs? If the above looks like a bug, is https://github.com/swagger-api/swagger-codegen the right place to report it?Python Client for Shopware 6
Good Day, i have generated a python client via theswagger-codegen-cli docker image in my GitLab ci pipline for a Shopware 6 shop. The problem i encounter is that every endpoint returns empty data, but the strange part is that when i debug the client i can see the data via the inspector but then in one step befor the data is returned it tries todeserializethe data and it returns a dictonary without any data inside. return_data=response_data if_preload_content: #deserializeresponsedata ifresponse_type: return_data=self.deserialize(response_data,response_type) This is from the __call_api() function. When i inspect response_data i can see it contains the data i need but deserialize() return this: {'data': None, 'included': None, 'links': None, 'meta': None} i know i could set the parameter _preload_content to false but then i get the raw request response as a byte string and that kind of defeats the purpose of using a swagger client. Who should i contact or ask about this? Is it a problem of the specs from my shop? Is the codegen not working correctly? Or is the python generator from swagger the problem? What should i provide here so someone can help or point me in the right direction?Swagger OpenAPI3 POST Array of images and media file together
I am using the swagger python-flask framework to create an OpenAPI 3 API which needs to do the following: 1. Upload a video file 2. Upload an array of images 3. Upload extra string data. I can successfully upload a single file successfully using: MyFileUploadAPI: post: operationId: my_file_upload requestBody: content: multipart/form-data: schema: $ref: '#/components/schemas/videofile' components: schemas: videofile: type: object properties: upload: type: string format: binary # This works fine def my_file_upload(videofile): file_name = videofile.filename And I can upload an array of images and other data using: MyMultipleImagesUploadAPI: post: operationId: multiple_files requestBody: content: application/json: schema: $ref: '#/components/schemas/multiplefiles' components: schemas: multiplefiles: type: object properties: Images: items: $ref: '#/components/schemas/MyImage' TotalCount: type: integer # This works fine def multiple_files(body): if connexion.request.is_json: body = multiplefiles.from_dict(connexion.request.get_json()) images = body._images count = body._totalcount Now I wish to combine the two together (Video upload + Multiple images + extra data) So I have did the following: /MyEverythingAPI: post: operationId: video_multiple_images requestBody: content: multipart/form-data: schema: $ref: '#/components/schemas/everything' components: schemas: everything: type: object properties: Video: type: string format: binary Images: type: array items: $ref: '#/components/schemas/MyImage' TotalCount: type: integer # This has issues def video_multiple_images(body, video_clip, **kwargs): #body = {'images': ['[object File]'], 'totalcount': 2} uploaded_file_name = video_clip.filename Now there are 2 issues that I see that are just not correct: Issue 1. The video_clip was not getting passed through to the function video_multiple_images. I debugged and tracked it down and saw that it was not getting added because there were no **kwargs added to my function signature. When I added the**kwargs then the video file started to get passed through. This post helped me solve that part: https://github.com/zalando/connexion/pull/753/files I can live with this issue but would like to know why this is the case. Issue 2. The image array is coming through as [object File]''[Object File]'' etc. This post indicates that this is not supported in OpenAPI 3: In Swagger openapi v3.0.0, facing issue in multiple file uploads So how can I pass a video file + an array of images?1.4KViews0likes0CommentsWhich library to use to implement OpenAPI
hello, I'm going to implement many new web microservices. I'm discovering OpenAPI (YAML/JSON Schema), and and I'm enthusiastic about it. But I'm lost in the existing libraries implementing it. I would like to use Python and I'm familar with flask; but then... what do you think of: connexion: https://github.com/zalando/connexion flasgger: https://github.com/flasgger/flasgger swagger-ui: https://pypi.org/project/swagger-ui-py flask-swagger-ui: https://pypi.org/project/flask-swagger-ui flask-restplus: https://flask-restplus.readthedocs.io/en/stable flask-rest-api: https://flask-rest-api.readthedocs.io/en/stable flask-restful: https://flask-restful.readthedocs.io/en/latest/ can you guide me to use the right promising libraries, with large communities. Many thanks. GuillaumeSwagger Python Flask server sluggish over HTTPS
I have a swagger openapi v3 python flask generated REST API server. I have just added HTTPS support to it and have used a self signed cert as follows. CERTIFICATE_FILE = '/cert/server-cert.pem' KEY_FILE = '/cert/server-key.pem' def main(): app = connexion.App(__name__, specification_dir='./swagger/') app.app.json_encoder = encoder.JSONEncoder app.add_api('swagger.yaml', arguments={'title': 'My API'}, pythonic_params=True) CORS(app.app) app.run(port=8080, debug=True, ssl_context=(CERTIFICATE_FILE, KEY_FILE)) I assess the swagger UI as follows: https://10.190.111.23:8080/ui/ I notice that very often there is a very long rersponse time when the swagger UI loads in the web browser and lots of times it does not load at all and simply times out. If I do not use HTTPS then it loads fine every time. Why could this be?