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

Commit 27f4f6e

Browse files
Version 2.3.2 (Compat with API Star schemas)
1 parent e0eca9d commit 27f4f6e

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

coreapi/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from coreapi.document import Array, Document, Link, Object, Error, Field
55

66

7-
__version__ = '2.3.1'
7+
__version__ = '2.3.2'
88
__all__ = [
99
'Array', 'Document', 'Link', 'Object', 'Error', 'Field',
1010
'Client',

coreapi/codecs/corejson.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,16 @@
3232

3333

3434
def encode_schema_to_corejson(schema):
35-
type_id = SCHEMA_CLASS_TO_TYPE_ID.get(schema.__class__, 'anything')
35+
if hasattr(schema, 'typename'):
36+
type_id = schema.typename
37+
else:
38+
type_id = SCHEMA_CLASS_TO_TYPE_ID.get(schema.__class__, 'anything')
3639
retval = {
3740
'_type': type_id,
3841
'title': schema.title,
3942
'description': schema.description
4043
}
41-
if isinstance(schema, coreschema.Enum):
44+
if hasattr(schema, 'enum'):
4245
retval['enum'] = schema.enum
4346
return retval
4447

0 commit comments

Comments
 (0)