Forum Discussion

SWaggerMD's avatar
SWaggerMD
Occasional Contributor
4 years ago

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.

  • SWaggerMD's avatar
    SWaggerMD
    Occasional Contributor

    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's avatar
      frantuma
      Staff

      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's avatar
        SWaggerMD
        Occasional Contributor

        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.