Giter Club home page Giter Club logo

Comments (8)

sebastibe avatar sebastibe commented on August 18, 2024 1

In the meantime, should we patch coreschema.Enum: 'enum' as coreschema.String: 'enum' in the corejson codec? This would make the clients works with API exposing Enums while currently I imagine everyone using 2.3.0 with DRF 3.6 and choices field must have this error.

from python-client.

MattFisher avatar MattFisher commented on August 18, 2024 1

Updated from DRF 3.5.3 to 3.6.2 but have had to roll back to 3.5.4 because of this issue (and the model_field used before defined error in 3.6.0 and 3.6.1).

from python-client.

tomchristie avatar tomchristie commented on August 18, 2024

Thanks, yup looks like those are currently missing from the document and need to be included.

from python-client.

ozw1z5rd avatar ozw1z5rd commented on August 18, 2024

Hello, is there a fast solution to have DRF working without the cori-api patch?

from python-client.

dkvdm avatar dkvdm commented on August 18, 2024

Building against #126 will temporarily solve this issue until the next release of coreapi has been released.

from python-client.

tomchristie avatar tomchristie commented on August 18, 2024

Closed via #135

from python-client.

kiruh avatar kiruh commented on August 18, 2024

I've met the same problem. What can I do to solve it?

Here are the versions of packages that I use:

coreapi==2.2.4
coreapi-cli==1.0.6
coreschema==0.0.4
djangorestframework==3.6.3

Here's the error I get

$ coreapi get http://127.0.0.1:8000/schema/ --debug
> GET /schema/ HTTP/1.1
> Accept-Encoding: gzip, deflate
> Connection: keep-alive
> Accept: application/coreapi+json, application/vnd.coreapi+json, */*
> Authorization: Basic a2lyaWxsOnFhendzeGVkY3IxMjM=
> Host: 127.0.0.1
> User-Agent: coreapi
< 200 OK
< Allow: GET, HEAD, OPTIONS
< Content-Length: 17858
< Content-Type: application/coreapi+json
< Date: Mon, 24 Jul 2017 20:40:06 GMT
< Server: WSGIServer/0.1 Python/2.7.12
< Vary: Accept, Cookie
< X-Frame-Options: SAMEORIGIN
< 
< /* Response ... */

Traceback (most recent call last):
  File "/home/kirill/testdrf/env/bin/coreapi", line 11, in <module>
    sys.exit(client())
  File "/home/kirill/testdrf/env/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/kirill/testdrf/env/local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/kirill/testdrf/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/kirill/testdrf/env/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/kirill/testdrf/env/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/kirill/testdrf/env/local/lib/python2.7/site-packages/coreapi_cli/main.py", line 201, in get
    doc = client.get(url, force_codec=force_codec)
  File "/home/kirill/testdrf/env/local/lib/python2.7/site-packages/coreapi/client.py", line 131, in get
    return transport.transition(link, decoders, force_codec=force_codec)
  File "/home/kirill/testdrf/env/local/lib/python2.7/site-packages/coreapi/transports/http.py", line 332, in transition
    result = _decode_result(response, decoders, force_codec)
  File "/home/kirill/testdrf/env/local/lib/python2.7/site-packages/coreapi/transports/http.py", line 249, in _decode_result
    result = codec.load(response.content, **options)
  File "/home/kirill/testdrf/env/local/lib/python2.7/site-packages/coreapi/codecs/base.py", line 24, in load
    return self.decode(*args, **kwargs)
  File "/home/kirill/testdrf/env/local/lib/python2.7/site-packages/coreapi/codecs/corejson.py", line 306, in decode
    doc = _primative_to_document(data, base_url)
  File "/home/kirill/testdrf/env/local/lib/python2.7/site-packages/coreapi/codecs/corejson.py", line 234, in _primative_to_document
    content = _get_content(data, base_url=url)
  File "/home/kirill/testdrf/env/local/lib/python2.7/site-packages/coreapi/codecs/corejson.py", line 132, in _get_content
    for key, value in item.items()
  File "/home/kirill/testdrf/env/local/lib/python2.7/site-packages/coreapi/codecs/corejson.py", line 133, in <dictcomp>
    if key not in ('_type', '_meta')
  File "/home/kirill/testdrf/env/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 "/home/kirill/testdrf/env/local/lib/python2.7/site-packages/coreapi/codecs/corejson.py", line 132, in _get_content
    for key, value in item.items()
  File "/home/kirill/testdrf/env/local/lib/python2.7/site-packages/coreapi/codecs/corejson.py", line 133, in <dictcomp>
    if key not in ('_type', '_meta')
  File "/home/kirill/testdrf/env/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 "/home/kirill/testdrf/env/local/lib/python2.7/site-packages/coreapi/codecs/corejson.py", line 58, in _get_schema
    return decode_schema_from_corejson(schema_data)
  File "/home/kirill/testdrf/env/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've tries it with:

coreapi==2.2.4
coreapi-cli==1.0.2
coreschema==0.0.4
djangorestframework==3.5.4

But it didn't help me at all.

from python-client.

dkvdm avatar dkvdm commented on August 18, 2024

Update CoreAPI to 2.3.1.

from python-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.