Skip to content

Commit

Permalink
render schema format, api host, schemes and basePath
Browse files Browse the repository at this point in the history
  • Loading branch information
m8rge committed Nov 8, 2016
1 parent acb9ab1 commit 035a89d
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/swagger/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ class Schema extends Object
*/
public $title;

/**
* @var string
*/
public $format;

/**
* @var string
*/
Expand Down
10 changes: 10 additions & 0 deletions src/swagger/Swagger.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ class Swagger extends Object
*/
public $basePath;

/**
* @var string
*/
public $host;

/**
* @var string[]
*/
public $schemes;

/**
* @var string[]
*/
Expand Down
17 changes: 14 additions & 3 deletions src/views/include.twig
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@
{% endfor %}

{% endif %}{#api.produces#}
{% if api.schemes %}
**Schemes**: `{{ api.schemes|join(', ') }}`
{% endif %}

{% if api.host %}
**Host**: `{{ api.host }}`
{% endif %}

{% if api.basePath %}
**Base path**: `{{ api.basePath }}`
{% endif %}
{% if api.securityDefinitions %}
{% for title, securityScheme in api.securityDefinitions %}
### Authorization: {{ title }}
Expand Down Expand Up @@ -49,10 +60,10 @@ Type |{% if securityScheme.type == 'apiKey' %} Name | In |{% endif %} Descriptio
{# #################################################################################### #}

{% macro renderFields(model) %}
Name | Type | Description
--- | --- | ---
Name | Type | Format | Description
--- | --- | --- | ---
{% for name, schema in model.properties %}
{{ name }}{% if name in model.required %}<span title="required" class="required">&nbsp;*&nbsp;</span>{% endif %} | {{ schema }} | {{ schema.description|multilineInTable }}{{ _self.enum(schema.enum) }}
{{ name }}{% if name in model.required %}<span title="required" class="required">&nbsp;*&nbsp;</span>{% endif %} | {{ schema }} | {{ schema.format }}{{ _self.enum(schema.enum) }} | {{ schema.description|multilineInTable }}
{% endfor %}
{% endmacro %}

Expand Down
3 changes: 3 additions & 0 deletions src/views/slate.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
---
title: {{ api.info.title }} {{ api.info.version }}

toc_footers:
- <a href='http://github.com/tripit/slate'>Documentation Powered by Slate</a>

search: true
---

Expand Down

0 comments on commit 035a89d

Please sign in to comment.