import requests
import yaml

data = yaml.load(requests.get("https://raw.githubusercontent.com/OCDX/ocdx/master/docs/jsonschema.yaml").text)
import jinja2

template = jinja2.Template("""
## {{ title }}

### Cardinality
{% if repeatable %}repeatable{% endif %}
{% if required %}required{% endif %}

### Type
{{ type }}
""")
def build_doc(doc):
    output = ""
    for key, prop in doc['properties'].items():
        data = {
            'title': key,
            'repeatable': prop['type'] == 'array',
            'required': key in doc['required'],
            'type': prop['type']
        }
        output += template.render(data)
        if 'items' in prop:
            for _, item in prop['items']:
                print(item)
                output += '\n' + build_doc(item)
        if 'properties' in prop:
            print(type(prop['properties']))

            output += '\n'.join([build_doc(p) for p in prop['properties']])
    return output

build_doc(data)

ValueErrorTraceback (most recent call last)
<ipython-input-42-e6c0d926948b> in <module>()
     19     return output
     20 
---> 21 build_doc(data)
     22 
     23 

<ipython-input-42-e6c0d926948b> in build_doc(doc)
     10         output += template.render(data)
     11         if 'items' in prop:
---> 12             for _, item in prop['items']:
     13                 print(item)
     14                 output += '\n' + build_doc(item)

ValueError: too many values to unpack (expected 2)