sanic-org / sanic-openapi

Easily document your Sanic API with a UI
https://sanic-openapi.readthedocs.io/
MIT License
505 stars 107 forks source link

sanic_openapi AttributeError: __abstractmethods__ #191

Closed beruhan closed 3 years ago

beruhan commented 4 years ago

Describe the bug After I upgrade my sanic to 20.6.3 and sanic-openapi to 0.6.2,It failed to start,It maybe some bug in new sanic-openapi

error messages I used 4 workers,the error message as follows:

[2020-09-25 20:04:59 +0800] [3934] [INFO] Goin' Fast @ http://0.0.0.0:8000
Process ForkProcess-3:
Traceback (most recent call last):
  File "/usr/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/usr/lib/python3.6/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.6/dist-packages/sanic/server.py", line 891, in serve
    trigger_events(after_start, loop)
  File "/usr/local/lib/python3.6/dist-packages/sanic/server.py", line 691, in trigger_events
    result = event(loop)
  File "/usr/local/lib/python3.6/dist-packages/sanic_openapi/swagger.py", line 196, in build_spec
    if route_spec.produces
  File "/usr/local/lib/python3.6/dist-packages/sanic_openapi/doc.py", line 197, in serialize_schema
    return List(schema).serialize()
  File "/usr/local/lib/python3.6/dist-packages/sanic_openapi/doc.py", line 111, in serialize
    items = serialize_schema(self.items[0])
  File "/usr/local/lib/python3.6/dist-packages/sanic_openapi/doc.py", line 186, in serialize_schema
    return Object(schema).serialize()
  File "/usr/local/lib/python3.6/dist-packages/sanic_openapi/doc.py", line 134, in __init__
    definitions[register_as] = (self, self.definition)
  File "/usr/local/lib/python3.6/dist-packages/sanic_openapi/doc.py", line 143, in definition
    {key: getattr(self.cls, key) for key in dir(self.cls)}.items(),
  File "/usr/local/lib/python3.6/dist-packages/sanic_openapi/doc.py", line 143, in <dictcomp>
    {key: getattr(self.cls, key) for key in dir(self.cls)}.items(),
AttributeError: __abstractmethods__
Process ForkProcess-1:
Traceback (most recent call last):
  File "/usr/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/usr/lib/python3.6/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.6/dist-packages/sanic/server.py", line 891, in serve
    trigger_events(after_start, loop)
  File "/usr/local/lib/python3.6/dist-packages/sanic/server.py", line 691, in trigger_events
    result = event(loop)
  File "/usr/local/lib/python3.6/dist-packages/sanic_openapi/swagger.py", line 196, in build_spec
    if route_spec.produces
  File "/usr/local/lib/python3.6/dist-packages/sanic_openapi/doc.py", line 197, in serialize_schema
    return List(schema).serialize()
  File "/usr/local/lib/python3.6/dist-packages/sanic_openapi/doc.py", line 111, in serialize
    items = serialize_schema(self.items[0])
  File "/usr/local/lib/python3.6/dist-packages/sanic_openapi/doc.py", line 186, in serialize_schema
    return Object(schema).serialize()
  File "/usr/local/lib/python3.6/dist-packages/sanic_openapi/doc.py", line 134, in __init__
    definitions[register_as] = (self, self.definition)
  File "/usr/local/lib/python3.6/dist-packages/sanic_openapi/doc.py", line 143, in definition
    {key: getattr(self.cls, key) for key in dir(self.cls)}.items(),
  File "/usr/local/lib/python3.6/dist-packages/sanic_openapi/doc.py", line 143, in <dictcomp>
    {key: getattr(self.cls, key) for key in dir(self.cls)}.items(),
AttributeError: __abstractmethods__
Process ForkProcess-4:
Traceback (most recent call last):
  File "/usr/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/usr/lib/python3.6/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.6/dist-packages/sanic/server.py", line 891, in serve
    trigger_events(after_start, loop)
  File "/usr/local/lib/python3.6/dist-packages/sanic/server.py", line 691, in trigger_events
    result = event(loop)
  File "/usr/local/lib/python3.6/dist-packages/sanic_openapi/swagger.py", line 196, in build_spec
    if route_spec.produces
  File "/usr/local/lib/python3.6/dist-packages/sanic_openapi/doc.py", line 197, in serialize_schema
    return List(schema).serialize()
  File "/usr/local/lib/python3.6/dist-packages/sanic_openapi/doc.py", line 111, in serialize
    items = serialize_schema(self.items[0])
  File "/usr/local/lib/python3.6/dist-packages/sanic_openapi/doc.py", line 186, in serialize_schema
    return Object(schema).serialize()
  File "/usr/local/lib/python3.6/dist-packages/sanic_openapi/doc.py", line 134, in __init__
    definitions[register_as] = (self, self.definition)
  File "/usr/local/lib/python3.6/dist-packages/sanic_openapi/doc.py", line 143, in definition
    {key: getattr(self.cls, key) for key in dir(self.cls)}.items(),
  File "/usr/local/lib/python3.6/dist-packages/sanic_openapi/doc.py", line 143, in <dictcomp>
    {key: getattr(self.cls, key) for key in dir(self.cls)}.items(),
AttributeError: __abstractmethods__
Process ForkProcess-2:
Traceback (most recent call last):
  File "/usr/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/usr/lib/python3.6/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.6/dist-packages/sanic/server.py", line 891, in serve
    trigger_events(after_start, loop)
  File "/usr/local/lib/python3.6/dist-packages/sanic/server.py", line 691, in trigger_events
    result = event(loop)
  File "/usr/local/lib/python3.6/dist-packages/sanic_openapi/swagger.py", line 196, in build_spec
    if route_spec.produces
  File "/usr/local/lib/python3.6/dist-packages/sanic_openapi/doc.py", line 197, in serialize_schema
    return List(schema).serialize()
  File "/usr/local/lib/python3.6/dist-packages/sanic_openapi/doc.py", line 111, in serialize
    items = serialize_schema(self.items[0])
  File "/usr/local/lib/python3.6/dist-packages/sanic_openapi/doc.py", line 186, in serialize_schema
    return Object(schema).serialize()
  File "/usr/local/lib/python3.6/dist-packages/sanic_openapi/doc.py", line 134, in __init__
    definitions[register_as] = (self, self.definition)
  File "/usr/local/lib/python3.6/dist-packages/sanic_openapi/doc.py", line 143, in definition
    {key: getattr(self.cls, key) for key in dir(self.cls)}.items(),
  File "/usr/local/lib/python3.6/dist-packages/sanic_openapi/doc.py", line 143, in <dictcomp>
    {key: getattr(self.cls, key) for key in dir(self.cls)}.items(),
AttributeError: __abstractmethods__
[2020-09-25 20:04:59 +0800] [3934] [INFO] Server Stopped

Environment (please complete the following information):

Additional context

Requirement already up-to-date: sanic-openapi in /usr/local/lib/python3.6/dist-packages (0.6.2)
Requirement already satisfied, skipping upgrade: sanic>=18.12.0 in /usr/local/lib/python3.6/dist-packages (from sanic-openapi) (20.6.3)
Requirement already satisfied, skipping upgrade: aiofiles>=0.3.0 in /usr/local/lib/python3.6/dist-packages (from sanic>=18.12.0->sanic-openapi) (0.4.0)
Requirement already satisfied, skipping upgrade: websockets<9.0,>=8.1 in /usr/local/lib/python3.6/dist-packages (from sanic>=18.12.0->sanic-openapi) (8.1)
Requirement already satisfied, skipping upgrade: ujson>=1.35; sys_platform != "win32" and implementation_name == "cpython" in /usr/local/lib/python3.6/dist-packages (from sanic>=18.12.0->sanic-openapi) (2.0.3)
Requirement already satisfied, skipping upgrade: httpx==0.11.1 in /usr/local/lib/python3.6/dist-packages (from sanic>=18.12.0->sanic-openapi) (0.11.1)
Requirement already satisfied, skipping upgrade: httptools>=0.0.10 in /usr/local/lib/python3.6/dist-packages (from sanic>=18.12.0->sanic-openapi) (0.0.13)
Requirement already satisfied, skipping upgrade: uvloop>=0.5.3; sys_platform != "win32" and implementation_name == "cpython" in /usr/local/lib/python3.6/dist-packages (from sanic>=18.12.0->sanic-openapi) (0.12.1)
Requirement already satisfied, skipping upgrade: multidict<5.0,>=4.0 in /usr/local/lib/python3.6/dist-packages (from sanic>=18.12.0->sanic-openapi) (4.5.2)
Requirement already satisfied, skipping upgrade: rfc3986<2,>=1.3 in /usr/local/lib/python3.6/dist-packages (from httpx==0.11.1->sanic>=18.12.0->sanic-openapi) (1.4.0)
Requirement already satisfied, skipping upgrade: certifi in /usr/lib/python3/dist-packages (from httpx==0.11.1->sanic>=18.12.0->sanic-openapi) (2018.1.18)
Requirement already satisfied, skipping upgrade: hstspreload in /usr/local/lib/python3.6/dist-packages (from httpx==0.11.1->sanic>=18.12.0->sanic-openapi) (2020.9.25)
Requirement already satisfied, skipping upgrade: sniffio==1.* in /usr/local/lib/python3.6/dist-packages (from httpx==0.11.1->sanic>=18.12.0->sanic-openapi) (1.1.0)
Requirement already satisfied, skipping upgrade: chardet==3.* in /usr/lib/python3/dist-packages (from httpx==0.11.1->sanic>=18.12.0->sanic-openapi) (3.0.4)
Requirement already satisfied, skipping upgrade: urllib3==1.* in /usr/local/lib/python3.6/dist-packages (from httpx==0.11.1->sanic>=18.12.0->sanic-openapi) (1.25.9)
Requirement already satisfied, skipping upgrade: h11<0.10,>=0.8 in /usr/local/lib/python3.6/dist-packages (from httpx==0.11.1->sanic>=18.12.0->sanic-openapi) (0.9.0)
Requirement already satisfied, skipping upgrade: idna==2.* in /usr/lib/python3/dist-packages (from httpx==0.11.1->sanic>=18.12.0->sanic-openapi) (2.6)
Requirement already satisfied, skipping upgrade: h2==3.* in /usr/local/lib/python3.6/dist-packages (from httpx==0.11.1->sanic>=18.12.0->sanic-openapi) (3.2.0)
Requirement already satisfied, skipping upgrade: contextvars>=2.1; python_version < "3.7" in /usr/local/lib/python3.6/dist-packages/contextvars-2.4-py3.6.egg (from sniffio==1.*->httpx==0.11.1->sanic>=18.12.0->sanic-openapi) (2.4)
Requirement already satisfied, skipping upgrade: hpack<4,>=3.0 in /usr/local/lib/python3.6/dist-packages (from h2==3.*->httpx==0.11.1->sanic>=18.12.0->sanic-openapi) (3.0.0)
Requirement already satisfied, skipping upgrade: hyperframe<6,>=5.2.0 in /usr/local/lib/python3.6/dist-packages (from h2==3.*->httpx==0.11.1->sanic>=18.12.0->sanic-openapi) (5.2.0)
Requirement already satisfied, skipping upgrade: immutables>=0.9 in /usr/local/lib/python3.6/dist-packages (from contextvars>=2.1; python_version < "3.7"->sniffio==1.*->httpx==0.11.1->sanic>=18.12.0->sanic-openapi) (0.12)
stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is incorrect, please respond with an update. Thank you for your contributions.