{% macro endpoints_start() %} {% endmacro %} {% macro endpoints_end() %}
{% endmacro %} {% macro endpoint(resource, label) %} {{ section_name(label) }}{{ url_template(resource) }} View Documentation {% endmacro %} {% macro resource_url(resource) -%} {{ url('static_api:resource', resource.plural) }} {%- endmacro %} {% macro endpoint_view(resource) %} {{ absolute_url(resource_url(resource)) }} {% endmacro %} {% macro endpoint_doc(resource) %} {{ absolute_url(resource_url(resource) + '?_doc=1') }} {% endmacro %} {% macro section_name(name) -%}

{{ name }}

{%- endmacro %} {% macro errors_start() %} {% endmacro %} {% macro error(code, msg) -%}
  • {{ code }} {{ msg }}
  • {%- endmacro %} {% macro schema_link(name) -%} {{ name }}.json {%- endmacro %} {% macro params_start() %} {% endmacro %} {% macro params_end() %}
    {% endmacro %} {% macro param(name, description, default=None, value=None) -%} {{ name|escape }}{{ description }}{% if default %} Default: {{ default }}.{% elif value %} Value: {{ value }}.{% endif %} {%- endmacro %} {% macro url_template(resource) -%}

    {schema}://{host}{{ resource_url(resource) }}

    {%- endmacro %} {% macro notes_start() %} {% endmacro %} {% macro notes_end() %} {% endmacro %} {% macro note(text) %}

    {{ text }}

    {% endmacro %} {% macro examples_start() %} {% endmacro %} {% macro examples_end() %}
    {% endmacro %} {% macro example(resource, description, params) %} {{ description }}{{ resource_url(resource) + '?' + params.strip('?') }} {% endmacro %} {% macro schema_field(value) -%} {{ value }} {%- endmacro -%} {% macro schema_type(definition) -%} {% if 'oneOf' in definition and definition|length == 1 %} {% for schema in definition['oneOf'] %} {{ schema_type_one(schema) }}{% if not loop.last %} or {% endif %} {% endfor %} {% else %} {{ schema_type_one(definition) }} {% endif %} {% endmacro %} {% macro schema_type_one(definition) -%} {% if definition['type'] %} {% if definition['type'] is string %} {{ definition['type'] }} {% else %} {{ ' or '.join(definition['type']) }} {% endif %} {% elif 'enum' in definition['type'] %} enum {% else %} unknown {% endif %} {%- endmacro %} {% macro schema_description(definition, name, prefix) -%} {% if 'oneOf' in definition and definition|length == 1 %} {% for schema in definition['oneOf'] %} {{ schema_description_one(schema, name, prefix) }} {% endfor %} {% else %} {{ schema_description_one(definition, name, prefix) }} {% endif %} {%- endmacro %} {% macro schema_description_one(definition, name, prefix) -%} {% if definition['enum'] %} {{ schema_enum(definition['enum']) }}
    {% endif %} {% if definition['description'] %} {{ definition['description'] }} {% endif %} {% if name %} {% if definition['type'] == 'object' or 'object' in definition['type'] %} {{ _render_schema_parsed(definition, 'Fields', prefix + '-' + name) }} {% elif definition['type'] == 'array' and definition['items'].get('type') == 'object' %} {{ _render_schema_parsed(definition['items'], 'Fields', prefix + '-' + name) }} {% endif %} {% endif %} {%- endmacro %} {% macro schema_enum(data) %} Available values: {% endmacro %} {% macro render_schema(schema_name) -%} {{ _render_schema_parsed(get_schema(schema_name).preresolved) }} {%- endmacro %} {% macro _render_schema_parsed(schema, label='Hierarchical fields definition', prefix='') -%}
    {% for name, definition in schema.get('properties', {})|dictsort %} {%- endfor %}
    FieldTypeDescription
    {{ schema_field(name) }} {{ schema_type(definition) }} {{ schema_description(definition, name, prefix) }}
    {%- endmacro %} {% macro render_schema_flatten(schema_name) -%} {% set schema=get_schema(schema_name).flat %}
    {% for name, field in schema|dictsort %} {% endfor %}
    FieldTypeDescription
    {{ schema_field(name) }} {{ schema_type(field) }} {{ schema_description(field) }}
    {%- endmacro %} {% macro idm_url(resource) %} User manual
    IDM {% endmacro %}