Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please output the schema name that is giving error #605

Open
Nafyaz opened this issue May 23, 2024 · 0 comments
Open

Please output the schema name that is giving error #605

Nafyaz opened this issue May 23, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@Nafyaz
Copy link

Nafyaz commented May 23, 2024

I got Unable to render schema and I had to tweak the library code to find out which of my 20+ schemas is causing the problem. By tweaking, I mean just printing out schemas in swagger.py's serialize_definitions(self) to until I receive an error. It would be less frustrating if the library directly told the name of my schema.

Here is the full traceback:

Unable to render schema
Traceback (most recent call last):
  File "/home/ve/lib/python3.12/site-packages/flask_restx/api.py", line 571, in __schema__
    self._schema = Swagger(self).as_dict()
                   ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ve/lib/python3.12/site-packages/flask_restx/swagger.py", line 304, in as_dict
    "definitions": self.serialize_definitions() or None,
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ve/lib/python3.12/site-packages/flask_restx/swagger.py", line 661, in serialize_definitions
    print(model.__schema__)
          ^^^^^^^^^^^^^^^^
  File "/home/ve/lib/python3.12/site-packages/flask_restx/model.py", line 68, in __schema__
    schema = self._schema
             ^^^^^^^^^^^^
  File "/home/ve/lib/python3.12/site-packages/flask_restx/model.py", line 151, in _schema
    properties[name] = field.__schema__
                       ^^^^^^^^^^^^^^^^
  File "/home/ve/lib/python3.12/site-packages/werkzeug/utils.py", line 107, in __get__
    value = self.fget(obj)  # type: ignore
            ^^^^^^^^^^^^^^
  File "/home/ve/lib/python3.12/site-packages/flask_restx/fields.py", line 217, in __schema__
    return not_none(self.schema())
                    ^^^^^^^^^^^^^
  File "/home/ve/lib/python3.12/site-packages/flask_restx/fields.py", line 442, in schema
    enum = self._v("enum")
           ^^^^^^^^^^^^^^^
  File "/home/ve/lib/python3.12/site-packages/flask_restx/fields.py", line 213, in _v
    return value() if callable(value) else value
           ^^^^^^^
TypeError: EnumType.__call__() missing 1 required positional argument: 'value'
@Nafyaz Nafyaz added the enhancement New feature or request label May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant