You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[] [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
I want to use uniqueItems: true in my spec, but the generated python-flask code won't run. It throws a ModuleNotFoundError when looking for openapi_server.models.set.Set.
Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/tmp/openapi_server/__main__.py", line 5, in <module>
from openapi_server import encoder
File "/tmp/openapi_server/encoder.py", line 4, in <module>
from openapi_server.models.base_model_ import Model
File "/tmp/openapi_server/models/__init__.py", line 6, in <module>
from openapi_server.models.name import Name
File "/tmp/openapi_server/models/name.py", line 9, in <module>
from openapi_server.models.set import Set
ModuleNotFoundError: No module named 'openapi_server.models.set'
openapi-generator version
5.0.1 - based on what it says during startup
OpenAPI declaration file content or url
openapi: 3.0.1info:
title: yooneekcontact:
email: [email protected]license:
name: MITversion: 1.0.0components:
schemas:
Name:
type: objectproperties:
id:
type: stringparts:
type: arrayuniqueItems: trueitems:
type: stringsecuritySchemes:
basic:
type: httpscheme: basicpaths:
/name/{name_id}:
summary: Operations on a nameget:
summary: Get an nameoperationId: get_nameparameters:
- name: name_idin: pathdescription: ID of name to getrequired: trueschema:
type: stringresponses:
200:
description: successful operationcontent:
application/json:
schema:
$ref: '#/components/schemas/Name'
Generation Details
Not sure what "generation details" means - unless it's how I generated the spec above? This was part of a much larger spec for which I'm trying to generate a POC service. This project has been a huge help, thanks!
Can you please use the same spec and test with the python client generator as well? If it works (output looks to you), then we can plot the fix from the python client generator to python-flask server generator.
Good idea, I should have thought of that for the op. It doesn't error out, but it doesn't seem to apply the constraint. Using the python generator on the yaml above:
IPython 7.19.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import openapi_client.models
In [2]: n = openapi_client.models.Name(id='id#1', parts=['same', 'same'])
In [3]: n
Out[3]: {'id': 'id#1', 'parts': ['same', 'same']}
In [4]: type(n)
Out[4]: openapi_client.model.name.Name
In [5]: n.openapi_types
Out[5]: {'id': (str,), 'parts': ([str],)}
In [6]: n.validations
Out[6]: {('parts',): {}}
Bug Report Checklist
Description
I want to use
uniqueItems: true
in my spec, but the generated python-flask code won't run. It throws a ModuleNotFoundError when looking for openapi_server.models.set.Set.openapi-generator version
5.0.1 - based on what it says during startup
OpenAPI declaration file content or url
Generation Details
Not sure what "generation details" means - unless it's how I generated the spec above? This was part of a much larger spec for which I'm trying to generate a POC service. This project has been a huge help, thanks!
Steps to reproduce
Save the above yaml to
openapi.yaml
and runnpx @openapitools/openapi-generator-cli generate -i openapi.yaml -g python-flask
Related issues/PRs
I couldn't find anything that seems closely related
Suggest a fix
Seems like the models.set module just isn't included? Hopefully it's a simple oversight...
The text was updated successfully, but these errors were encountered: