cancel
Showing results for 
Search instead for 
Did you mean: 

Need help - Swagger CodeGen ?

SWaggerMD
Occasional Contributor

Need help - Swagger CodeGen ?

Thanks for providing Swagger CodeGen and reviewing my thread.

 

*** Swagger version 2.0 ***

 

I have created server and client modules in Python. I am able to view the API in a web browser using the Swagger editor for my yml file.

 

In this mode,

parameters:

            $ref: "#/definitions/Image" is not getting resolved.

 

I followed the steps from the generated README doc and installed the server & client modules in Ubuntu.

 

When I invoke python3 -m swagger_server to run the server, I receive the following error: name 'Image' is not defined.

 

I am trying to load in a set of PNG files as an input for the server, but I am unsure of how to do this with my yml file (with the required reference command for my image object) and generated scripts from the swagger editor.

 

As the swagger editor generates a large amount of python scripts and files, how do I add the required functionality to these files?

 

Thanks for your guidance.

6 REPLIES 6
frantuma
Staff

Re: Need help - Swagger CodeGen ?

@SWaggerMD 

 

Can you share the OpenAPI document triggering the error?

SWaggerMD
Occasional Contributor

Re: Need help - Swagger CodeGen ?

Thanks for looking into this issue. I am using the Pet Store example which can be found on the Swagger Editor website, which shows the API file being inputted and the resulting API in the Swagger UI :

 

https://editor.swagger.io/

 

I am trying to extend this demo to include pet images (in PNG format), a list of the inputted files, and characteristics about them

 

I tried to run the Python Client generated from the Swagger editor, but I am getting the following error:

 

Failed to establish a new connection: [errno 113] no route to host

 

Is it possible to do this with the Python Client provided in the Swagger editor, or do I need to use another language like Golang instead?

 

I have looked online for some tutorial pieces (both on YouTube and other forums) which explain the purpose of the API client and its usability, but I have not found any which give a suitable explanation.

 

Thanks for your guidance.

 

 

 

 

frantuma
Staff

Re: Need help - Swagger CodeGen ?

Still some points are not fully clear:

 

* are you using the 2.x or 3.x petstore sample?

* have you modified the sample to include pet images (in PNG format), a list of the inputted files, and characteristics about them? If so, please share the modified spec

* are you getting errors with the server or with the client?

SWaggerMD
Occasional Contributor

Re: Need help - Swagger CodeGen ?

Thanks for your questions. Here are my answers.

 

* are you using the 2.x or 3.x petstore sample?

 

As per https://editor.swagger.io/  it shows swagger: "2.0"

 

* have you modified the sample to include pet images (in PNG format), a list of the inputted files, and characteristics about them?  If so, please share the modified spec .

 

I did not . I am not sure, what kind of modifications and where to make. That was the reason , I opened this thread. I did not find suitable guidance posted through tutorials about making such changes. If you have any suggestions, please let me know.

 

* are you getting errors with the server or with the client?

N/A

 

Thanks for your guidance/help.

frantuma
Staff

Re: Need help - Swagger CodeGen ?

It's still unclear to me what is your issue / question.

 

I understood you were facing errors with the generated code, but from your last answer it seems you asked for guidance in modfying/implementing some own OpenAPI spec in some way.

 

If that is the case, and your interest is understanding how OpenAPI works, I would suggest going through some available docs, e.g. https://swagger.io/docs/specification/about/

SWaggerMD
Occasional Contributor

Re: Need help - Swagger CodeGen ?

Thanks again.

 

I did reply to your question. I did report a error received, when I try to follow the steps provided in README doc of Client generation with Python. I raised two issues in this thread,

1) Swagger Client Generated code throwing error
2) Extend the functionality of Generated Pet store application to add pet images, list , characteristics.

 

As per https://editor.swagger.io/  it shows swagger: "2.0"

I tried to run the Python Client generated from the Swagger editor, but I am getting the following error:

 

Failed to establish a new connection: [errno 113] no route to host

 

Is it possible to do this with the Python Client provided in the Swagger editor, or do I need to use another language like Golang instead?

 

I have looked online for some tutorial pieces (both on YouTube and other forums) which explain the purpose of the API client and its usability, but I have not found any which give a suitable explanation.

 

Thanks for your guidance.

New Here?
Join us and watch the welcome video: