Comments (8)
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.
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.
Thanks, yup looks like those are currently missing from the document and need to be included.
from python-client.
Hello, is there a fast solution to have DRF working without the cori-api patch?
from python-client.
Building against #126 will temporarily solve this issue until the next release of coreapi has been released.
from python-client.
Closed via #135
from python-client.
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.
Update CoreAPI to 2.3.1.
from python-client.
Related Issues (20)
- Unable to specify arbitrary query parameters HOT 3
- Unable to specify type for list elements HOT 1
- HTTPTransport ignores credentials HOT 2
- Merge environment settings for SSL requests HOT 2
- Is it possible to set a timeout? HOT 3
- Proxy settings in session instances not honored. HOT 2
- Please add license
- [version-3] No replacement for `coreschema.render_to_form` HOT 1
- [version-3] 'CoreJSONCodec' object has no attribute 'dump' HOT 1
- CamelCase CoreJSON Codec for easier integration with non-Python clients HOT 3
- Remove dependency on itypes or take over maintenance HOT 2
- Document Field.schema HOT 3
- Add entrypoint to pass SSL verification option HOT 1
- Getting continous requests.exceptions.ConnectionError
- Use of codecs and codec plugins is very confusing
- No License HOT 2
- How to show the differences between schema versions?
- OSError: Invalid cross-device link
- License mismatch betweend BSD2c and BSD3c HOT 1
- generated python code doesn't work HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-client.