File: openapi.yml.template

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