blob: 3d089b910ea5323a973ded2b68a864c3cda9d5fc [file] [log] [blame]
swagger: "2.0"
info:
title: "XOS REST APIs"
description: "XOS - REST API Docs"
version: "1.0.0"
contact:
email: "cord-dev@opencord.org"
{#tags:#}
{#{%- for object in proto.messages %}#}
{#- name: "{{ xproto_unquote(xproto_first_non_empty([object.options.app_label, object.options.name])) }}"#}
{# description: "{{ xproto_unquote(xproto_first_non_empty([object.options.app_label, object.options.name])) }} Models"#}
{# externalDocs:#}
{# description: "Find out more"#}
{# url: "https://guide.opencord.org/xos/core_models.html"#}
{#{% endfor %}#}
paths:
{%- for object in proto.messages %}
/xosapi/v1/{{ xproto_unquote(xproto_first_non_empty([object.options.name, object.options.app_label, options.name, context.app_label])) }}/{{ xproto_pluralize(object) | lower }}/:
get:
tags:
- "{{ xproto_unquote(xproto_first_non_empty([object.options.app_label, object.options.name])) }}"
summary: "List {{xproto_pluralize(object)}}"
responses:
200:
description: OK
401:
description: "Unauthorized"
403:
description: "Forbidden"
500:
description: "Internal Server Error"
post:
tags:
- "{{ xproto_unquote(xproto_first_non_empty([object.options.app_label, object.options.name])) }}"
summary: "Create {{object.name}}"
parameters:
- in: "body"
name: "body"
description: "{{object.name}} model properties"
required: true
schema:
$ref: "#/definitions/{{object.name}}"
responses:
200:
description: OK
401:
description: "Unauthorized"
403:
description: "Forbidden"
500:
description: "Internal Server Error"
/xosapi/v1/{{ xproto_unquote(xproto_first_non_empty([object.options.name, object.options.app_label, options.name, context.app_label])) }}/{{ xproto_pluralize(object) | lower }}/{id}:
get:
tags:
- "{{ xproto_unquote(xproto_first_non_empty([object.options.app_label, object.options.name])) }}"
summary: "Get {{object.name}}"
parameters:
- in: "path"
name: "id"
description: "ID of {{ object.name }} to return"
required: true
type: "integer"
format: "int64"
responses:
200:
description: OK
401:
description: "Unauthorized"
403:
description: "Forbidden"
500:
description: "Internal Server Error"
put:
tags:
- "{{ xproto_unquote(xproto_first_non_empty([object.options.app_label, object.options.name])) }}"
summary: "Get {{object.name}}"
parameters:
- in: "path"
name: "id"
description: "ID of {{ object.name }} to return"
required: true
type: "integer"
format: "int64"
responses:
200:
description: OK
401:
description: "Unauthorized"
403:
description: "Forbidden"
500:
description: "Internal Server Error"
delete:
tags:
- "{{ xproto_unquote(xproto_first_non_empty([object.options.app_label, object.options.name])) }}"
summary: "Delete {{object.name}}"
parameters:
- in: "path"
name: "id"
description: "ID of {{ object.name }} to return"
required: true
type: "integer"
format: "int64"
responses:
200:
description: OK
401:
description: "Unauthorized"
403:
description: "Forbidden"
500:
description: "Internal Server Error"
{% endfor %}
definitions:
{%- for object in proto.messages %}
{{ object.name }}:
type: "object"
properties:
{%- for f in object.fields %}
{{ f.name }}:
type: {{ xproto_type_to_swagger_type(f) }}
{%- if xproto_field_to_swagger_enum(f) %}
enum:
{%- for e in xproto_field_to_swagger_enum(f) %}
- {{ e }}
{%- endfor %}
{%- endif %}
{%- if f.options.help_text %}
description: "{{ xproto_unquote(f.options.help_text) }}"
{% endif %}
{%- endfor %}
{% endfor %}