swagger-api / swagger-api/swagger-codegen
[python-flask] __init__.py contains NUL characters
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
When generating for python-flask, swagger_server/__init__.py contains four NUL characters that cause the following error:
% python -m swagger_server
Traceback (most recent call last):
File ".../python3.10/runpy.py", line 187, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File ".../python3.10/runpy.py", line 146, in _get_module_details
return _get_module_details(pkg_main_name, error)
File ".../python3.10/runpy.py", line 110, in _get_module_details
__import__(pkg_name)
ValueError: source code string cannot contain null bytes
Swagger-codegen version
swagger-codegen: stable 3.0.46 (installed via Homebrew)
OS: Mac OS Ventura 13.4
Swagger declaration file content or url
Any declaration file works.
openapi: '3.0.2'
info:
title: Test
version: '1.0'
servers:
- url: https://api.server.test/v1
paths:
/method1:
post:
summary: Method 1
responses:
'200':
description: OK
Command line used for generation
swagger-codegen generate -i test.yml -l python-flask -o .
Steps to reproduce
Just try to run the app as usual.
Related issues/PRs
Searched; none found.
Suggest a fix/enhancement
TBD
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the supplied OpenAPI YAML and swagger-codegen generate -i test.yml -l python-flask -o ., then inspect the generated swagger_server/__init__.py and the python-flask generator template that produces it. Done means the generated file contains no NUL characters and python -m swagger_server starts without the reported ValueError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- flask, python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100