swagger-api / swagger-api/swagger-codegen

NameError: name 'OneOfTransportInfoEndpoint' is not defined

Open
#10,560 0 comments 0 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

Hi, hoping someone can help with this error:

Description

I am getting the following error when trying to run the python swagger stub:

python3 -m swagger_server
Traceback (most recent call last):
  File "/home/john/anaconda3/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/john/anaconda3/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/john/api/stub/MecServiceMgmtApi/swagger_server/__main__.py", line 5, in <module>
    from swagger_server import encoder
  File "/home/john/api/stub/MecServiceMgmtApi/swagger_server/encoder.py", line 4, in <module>
    from swagger_server.models.base_model_ import Model
  File "/home/john/api/stub/MecServiceMgmtApi/swagger_server/models/__init__.py", line 50, in <module>
    from swagger_server.models.service_info import ServiceInfo
  File "/home/john/api/stub/MecServiceMgmtApi/swagger_server/models/service_info.py", line 18, in <module>
    from swagger_server.models.transport_info import TransportInfo  # noqa: F401,E501
  File "/home/john/api/stub/MecServiceMgmtApi/swagger_server/models/transport_info.py", line 20, in <module>
    class TransportInfo(Model):
  File "/home/john/api/stub/MecServiceMgmtApi/swagger_server/models/transport_info.py", line 25, in TransportInfo
    def __init__(self, id: TransportInfoId=None, name: TransportInfoName=None, description: TransportInfoDescription=None, type: TransportType=None, protocol: TransportInfoProtocol=None, version: TransportInfoVersion=None, endpoint: OneOfTransportInfoEndpoint=None, security: SecurityInfo=None, impl_specific_info: TransportInfoImplSpecificInfo=None):  # noqa: E501
NameError: name 'OneOfTransportInfoEndpoint' is not defined
Swagger-codegen version

swagger codegen: 3.0.24-SNAPSHOT
java: openjdk 11.0.9 2020-10-20

Command line used for generation

java -jar swagger-codegen-cli.jar generate -i json/MecServiceMgmtApi.json -l python-flask -o stub/MecServiceMgmtApi

OpenAPI JSON: https://forge.etsi.org/rep/mec/gs011-app-enablement-api

Steps to reproduce

python3 setup swagger_server

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 by reproducing the failure with the reported python3 -m swagger_server command and the supplied generation command. Inspect the generated swagger_server/models/transport_info.py, service_info.py, and models/__init__.py around OneOfTransportInfoEndpoint; done means the generated stub starts without this `NameError.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, python
Domain
api, backend, tooling
Issue type
Bug
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.