Skip to content

Commit

Permalink
chore: update docusaurus template
Browse files Browse the repository at this point in the history
Signed-off-by: aeneasr <[email protected]>
  • Loading branch information
aeneasr committed May 29, 2020
1 parent 368f073 commit 9cfd885
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 31 deletions.
14 changes: 11 additions & 3 deletions docs/.widdershins/templates/main.dot
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
{{? data.api.info.description}}{{=data.api.info.description}}{{?}}

> You are viewing REST API documentation. This documentation is auto-generated from a swagger specification which
import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'

:::info

You are viewing REST API documentation. This documentation is auto-generated from a swagger specification which
itself is generated from annotations in the source code of the project. It is possible that this documentation includes
bugs and that code samples are incomplete or wrong.
>
> If you find issues in the respective documentation, please do not edit the

If you find issues in the respective documentation, please do not edit the
Markdown files directly (as they are generated) but raise an issue on the project's GitHub presence instead. This documentation
will improve over time with your help! If you have ideas how to improve this part of the documentation, feel free to
share them in a [GitHub issue](https://github.com/ory/docs/issues/new) any time.

:::

{{? data.api.components && data.api.components.securitySchemes }}
{{#def.security}}
{{?}}
Expand All @@ -17,6 +24,7 @@ share them in a [GitHub issue](https://github.com/ory/docs/issues/new) any time.
{{ data.resource = data.resources[r]; }}

<a id="{{=data.title_prefix+'-'+data.utils.slugify(r)}}"></a>

## {{= r}}

{{? data.resource.description }}{{= data.resource.description}}{{?}}
Expand Down
44 changes: 17 additions & 27 deletions docs/.widdershins/templates/operation.dot
Original file line number Diff line number Diff line change
Expand Up @@ -56,27 +56,18 @@ Accept: {{=data.produces[0]}}{{?}}
{{? data.options.codeSamples || data.operation["x-code-samples"] }}
#### Code samples

<div class="tabs" id="tab-{{=data.operation.operationId}}">
<nav class="tabs-nav">
<ul class="nav nav-tabs au-link-list au-link-list--inline">
<li class="nav-item"><a class="nav-link active" role="tab" href="#tab-{{=data.operation.operationId}}-shell">Shell</a></li>
<li class="nav-item"><a class="nav-link" role="tab" href="#tab-{{=data.operation.operationId}}-go">Go</a></li>
<li class="nav-item"><a class="nav-link" role="tab" href="#tab-{{=data.operation.operationId}}-node">Node.js</a></li>
<li class="nav-item"><a class="nav-link" role="tab" href="#tab-{{=data.operation.operationId}}-java">Java</a></li>
<li class="nav-item"><a class="nav-link" role="tab" href="#tab-{{=data.operation.operationId}}-python">Python</a></li>
<li class="nav-item"><a class="nav-link" role="tab" href="#tab-{{=data.operation.operationId}}-ruby">Ruby</a></li>
</ul>
</nav>
<div class="tab-content">
<div class="tab-pane active" role="tabpanel" id="tab-{{=data.operation.operationId}}-shell">
<Tabs groupId="code-samples" defaultValue="shell"
values={[{label: 'Shell', value: 'shell'}, {label: 'Go', value: 'go'}, {label: 'Node', value: 'node'},
{label: 'Java', value: 'java'}, {label: 'Python', value: 'python'}, {label: 'Ruby', value: 'ruby'}]}>
<TabItem value="shell">

```shell
curl -X {{=data.methodUpper}} {{=data.url}}{{=data.requiredQueryString}}{{?data.allHeaders.length}} \{{?}}
{{~data.allHeaders :p:index}} -H '{{=p.name}}: {{=p.exampleValues.object}}'{{?index < data.allHeaders.length-1}} \{{?}}{{~}}
```

</div>
<div class="tab-pane" role="tabpanel" id="tab-{{=data.operation.operationId}}-go">
</TabItem>
<TabItem value="go">

```go
package main
Expand All @@ -103,10 +94,10 @@ func main() {{{?data.allHeaders.length}}
}
```

</div>
<div class="tab-pane" role="tabpanel" id="tab-{{=data.operation.operationId}}-node">
</TabItem>
<TabItem value="node">

```nodejs
```javascript
const fetch = require('node-fetch');
{{?data.bodyParameter.present}}const input = '{{=data.bodyParameter.exampleValues.json}}';{{?}}
{{?data.allHeaders.length}}const headers = {
Expand All @@ -124,8 +115,8 @@ fetch('{{=data.url}}{{=data.requiredQueryString}}', {
})
```

</div>
<div class="tab-pane" role="tabpanel" id="tab-{{=data.operation.operationId}}-java">
</TabItem>
<TabItem value="java">

```java
// This sample needs improvement.
Expand All @@ -150,8 +141,8 @@ in.close();
System.out.println(response.toString());
```

</div>
<div class="tab-pane" role="tabpanel" id="tab-{{=data.operation.operationId}}-python">
</TabItem>
<TabItem value="python">

```python
import requests
Expand All @@ -169,8 +160,8 @@ r = requests.{{=data.method.verb}}(
print r.json()
```

</div>
<div class="tab-pane" role="tabpanel" id="tab-{{=data.operation.operationId}}-ruby">
</TabItem>
<TabItem value="ruby">

```ruby
require 'rest-client'
Expand All @@ -188,7 +179,6 @@ result = RestClient.{{=data.method.verb}} '{{=data.url}}',
p JSON.parse(result)
```

</div>
</div>
</div>
</TabItem>
</Tabs>
{{?}}
5 changes: 4 additions & 1 deletion docs/.widdershins/templates/parameters.def
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<a id="{{=data.operationUniqueSlug}}-parameters"></a>
##### Parameters

#### Parameters

|Parameter|In|Type|Required|Description|
|---|---|---|---|---|
{{~ data.parameters :p}}|{{=p.name}}|{{=p.in}}|{{=p.safeType}}|{{=p.required}}|{{=p.shortDesc || 'none'}}|
{{~}}

{{? data.longDescs }}

##### Detailed descriptions

{{~ data.parameters :p}}{{? p.shortDesc !== p.description}}
**{{=p.name}}**: {{=p.description}}{{?}}
{{~}}
Expand Down

0 comments on commit 9cfd885

Please sign in to comment.