Skip to content

Commit

Permalink
chore: add operation template
Browse files Browse the repository at this point in the history
  • Loading branch information
stfsy committed Apr 26, 2022
1 parent 3165ccd commit 30c4137
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions templates/operation.dot
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{{= data.tags.section }}

{{ data.methodUpper = data.method.verb.toUpperCase(); }}
{{ data.normalizedPath = data.method.path.substring(1).replaceAll(/\\/g, '-').replace(/\{/g, '').replace(/\}/g, '').replace(/\_/g, '-').replace(/\//g, '-'); }}
{{ data.url = data.utils.slashes(data.baseUrl + data.method.path); }}
{{ data.parameters = data.operation.parameters; }}
{{ data.enums = []; }}
Expand All @@ -11,17 +12,25 @@

#### {{= data.methodUpper}} {{=data.method.path}}

{{ data.security = data.operation.security ? data.operation.security : data.api.security; }}
{{? data.security && data.security.length }}
{{#def.authentication}}
{{??}}
{{#def.authentication_none}}
{{?}}

{{? data.operation.summary && !data.options.tocSummary}}*{{= data.operation.summary }}*{{?}}

{{? data.operation.description}}{{= data.operation.description }}{{?}}

{{? data.options.codeSamples || data.operation["x-code-samples"] }}

##### Examples [#{{=data.method.verb}}-{{=data.normalizedPath}}-examples]
{{= data.utils.getCodeSamples(data) }}
{{?}}

{{? data.operation.requestBody}}
<h3 id="{{=data.operationUniqueSlug}}-body">Body</h3>
##### Body [#{{=data.method.verb}}-{{=data.normalizedPath}}-body]

{{? data.bodyParameter.exampleValues.description }}
> {{= data.bodyParameter.exampleValues.description }}
Expand All @@ -38,11 +47,8 @@

{{#def.callbacks}}

{{ data.security = data.operation.security ? data.operation.security : data.api.security; }}
{{? data.security && data.security.length }}
{{#def.authentication}}
{{??}}
{{#def.authentication_none}}
{{?}}
<br/>

---

{{= data.tags.endSection }}

0 comments on commit 30c4137

Please sign in to comment.