| 1 |
openapi: 3.0.0 |
| 2 |
info: |
| 3 |
title: {{napp.username}}/{{napp.name}} |
| 4 |
version: {{napp.version}} |
| 5 |
description: {{napp.description}} |
| 6 |
paths: |
| 7 |
{% for path, methods in paths.items() %} |
| 8 |
{{path}}: |
| 9 |
{% for method, method_info in methods.items() %} |
| 10 |
{{method}}: |
| 11 |
summary: {{method_info.summary}} |
| 12 |
description: {{method_info.description}} |
| 13 |
parameters: # If you have parameters in the URL |
| 14 |
- name: Parameter's name as in path. |
| 15 |
required: true |
| 16 |
description: Describe parameter here |
| 17 |
in: path |
| 18 |
{% if method == "post" %} |
| 19 |
requestBody: |
| 20 |
content: |
| 21 |
application/json: |
| 22 |
schema: |
| 23 |
properties: # What the user should post |
| 24 |
dpid: # "dpid" is just an example. Replace it. |
| 25 |
type: string |
| 26 |
description: Switch datapath ID. |
| 27 |
example: 00:...:01 |
| 28 |
{% endif %} |
| 29 |
responses: |
| 30 |
200: # You can add more responses |
| 31 |
description: Describe a successful call. |
| 32 |
content: |
| 33 |
application/json: # You can also use text/plain, for example |
| 34 |
schema: |
| 35 |
type: object # Adapt to your response |
| 36 |
properties: |
| 37 |
prop_one: |
| 38 |
type: string |
| 39 |
description: Meaning of prop_one |
| 40 |
example: an example of prop_one |
| 41 |
second_prop: |
| 42 |
type: integer |
| 43 |
description: Meaning of second_prop |
| 44 |
example: 42 |
| 45 |
{% endfor %} |
| 46 |
{% endfor %} |