swagger-api / swagger-api/swagger-codegen

How do I fix the issues of Swagger Generated code (Python), when I run locally?

Open
#11,090 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Thanks for reviewing my threads.

For the reference, I used this Swagger Demo yaml spec (pet store) to understand REST Api and generated swagger server using swagger editor online, which basically create server code artifacts nicely for Python Flask server, Python client . I want to run/test generated swagger server code together. But when I tried to run this from python terminal locally, I had following error:

{
  "detail": "The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.",
  "status": 404,
  "title": "Not Found",
  "type": "about:blank"
}

I can't run swagger server which is generated based on Demo Api specification file from swagger editor. I did not see any additional directions in READMED doc produced during generation.

Are there any documentation to understand this process better ?

why? what's the solution to run swagger server locally?

I did try of using different host and post but still can't open swagger server. any idea about this?posted

I find these issues raised in many places years ago, but no solutions posted for it.

Is this a bug or outstanding issue with swagger?

Swagger-codegen version 2.0
[Pet Demo YAML]

[(https://editor.swagger.io)]

Command line used for generation
pip3 install -r requirements.txt
python3 -m swagger_server
Steps to reproduce

**The above steps produce the reported error**

Suggest a fix/enhancement

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the generated README and the documented command, then reproduce the 404 using the Pet Demo YAML and the Python module invocation described in the issue. Check which generated server URL or route is expected, and document the local startup and request steps so the server can be run and tested successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
flask, openapi, python
Domain
api, backend, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.