Skip to content
This repository was archived by the owner on Aug 26, 2024. It is now read-only.

Commit f416cad

Browse files
committed
Version 0.1.3
1 parent fcd7d62 commit f416cad

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

raml_codec/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from raml_codec.encode import encode_raml
44

55

6-
__version__ = "0.1.2"
6+
__version__ = "0.1.3"
77

88

99
class RAMLCodec(BaseCodec):

raml_codec/decode.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ def expand_schema(schema):
6161
name=key,
6262
location='form',
6363
required=schema_properties.get('required', key in schema_required),
64-
description=schema_properties[key].get('description')
64+
description=schema_properties[key].get('description', '')
6565
))
6666
return fields
6767

6868
# If the schema is not type="object", then return a single field.
69-
return coreapi.Field(name='data', location='body', required=True)
69+
return coreapi.Field(name='data', location='body', required=True, description=schema.get('description', ''))
7070

7171

7272
def decode_raml(bytestring, base_url=None):
@@ -82,19 +82,19 @@ def decode_raml(bytestring, base_url=None):
8282
encoding = ''
8383

8484
for param in resource.uri_params or []:
85-
field = coreapi.Field(param.name, param.required, location='path')
85+
field = coreapi.Field(param.name, param.required, location='path', description=param.description)
8686
fields.append(field)
8787

8888
for param in resource.query_params or []:
89-
field = coreapi.Field(param.name, param.required, location='query')
89+
field = coreapi.Field(param.name, param.required, location='query', description=param.description)
9090
fields.append(field)
9191

9292
if resource.body:
9393
body = resource.body[0]
9494
encoding = body.mime_type
9595

9696
for form_param in body.form_params or []:
97-
field = coreapi.Field(param.name, param.required, location='form')
97+
field = coreapi.Field(param.name, param.required, location='form', description=param.description)
9898
fields.append(field)
9999

100100
if body.schema:
@@ -105,8 +105,13 @@ def decode_raml(bytestring, base_url=None):
105105
url=resource.absolute_uri,
106106
action=resource.method.lower(),
107107
encoding=encoding,
108-
fields=fields
108+
fields=fields,
109+
title=resource.display_name,
110+
description=str(resource.description) if resource.description else ''
109111
)
110112
content[resource.display_name] = link
111113

112-
return coreapi.Document(title=raml.title, url=base_url, content=content)
114+
description = ''
115+
if raml.documentation:
116+
description = str(raml.documentation[0].content)
117+
return coreapi.Document(title=raml.title, url=base_url, content=content, description=description, media_type='application/raml+yaml')

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def get_package_data(package):
6262
packages=get_packages('raml_codec'),
6363
package_data=get_package_data('raml_codec'),
6464
install_requires=[
65-
'coreapi',
65+
'coreapi>=2.1.0',
6666
'ramlfications'
6767
],
6868
classifiers=[

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy