Skip to content
This repository has been archived by the owner on Mar 18, 2019. It is now read-only.

Unable to retrieve schema #127

Closed
gmeans opened this issue Apr 10, 2017 · 2 comments
Closed

Unable to retrieve schema #127

gmeans opened this issue Apr 10, 2017 · 2 comments

Comments

@gmeans
Copy link

gmeans commented Apr 10, 2017

coreapi command line client 1.0.6

I've got DRF based API I was trying to work w/ using the new core api client. When trying to get the schema using the CLI I receive the following:

coreapi get http://localhost:8000/docs/
Traceback (most recent call last):
  File "/usr/local/bin/coreapi", line 11, in <module>
    sys.exit(client())
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/coreapi_cli/main.py", line 145, in get
    doc = client.get(url, force_codec=force_codec)
  File "/usr/local/lib/python2.7/site-packages/coreapi/client.py", line 136, in get
    return transport.transition(link, decoders, force_codec=force_codec)
  File "/usr/local/lib/python2.7/site-packages/coreapi/transports/http.py", line 380, in transition
    result = _decode_result(response, decoders, force_codec)
  File "/usr/local/lib/python2.7/site-packages/coreapi/transports/http.py", line 294, in _decode_result
    result = codec.load(response.content, **options)
  File "/usr/local/lib/python2.7/site-packages/coreapi/codecs/base.py", line 24, in load
    return self.decode(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/coreapi/codecs/corejson.py", line 306, in decode
    doc = _primative_to_document(data, base_url)
  File "/usr/local/lib/python2.7/site-packages/coreapi/codecs/corejson.py", line 234, in _primative_to_document
    content = _get_content(data, base_url=url)
  File "/usr/local/lib/python2.7/site-packages/coreapi/codecs/corejson.py", line 132, in _get_content
    for key, value in item.items()
  File "/usr/local/lib/python2.7/site-packages/coreapi/codecs/corejson.py", line 133, in <dictcomp>
    if key not in ('_type', '_meta')
  File "/usr/local/lib/python2.7/site-packages/coreapi/codecs/corejson.py", line 276, in _primative_to_document
    content = _get_content(data, base_url=base_url)
  File "/usr/local/lib/python2.7/site-packages/coreapi/codecs/corejson.py", line 132, in _get_content
    for key, value in item.items()
  File "/usr/local/lib/python2.7/site-packages/coreapi/codecs/corejson.py", line 133, in <dictcomp>
    if key not in ('_type', '_meta')
  File "/usr/local/lib/python2.7/site-packages/coreapi/codecs/corejson.py", line 267, in _primative_to_document
    for item in fields if isinstance(item, dict)
  File "/usr/local/lib/python2.7/site-packages/coreapi/codecs/corejson.py", line 58, in _get_schema
    return decode_schema_from_corejson(schema_data)
  File "/usr/local/lib/python2.7/site-packages/coreapi/codecs/corejson.py", line 48, in decode_schema_from_corejson
    return schema_cls(title=title, description=description)
TypeError: __init__() takes exactly 2 arguments (1 given)

I thought maybe it was because I didn't have a description set in my include_docs_urls call, but setting that didn't help.

@dkvdm
Copy link

dkvdm commented May 3, 2017

See #122

@tomchristie
Copy link
Contributor

Closed as per #122.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants