I'm getting started with the Swagger Editor and I'm a little confused on reusable definitions. As an example, I have a Task model defined as show below.
GET
The GET call will return all elements that are a part of the Task model.
POST
A POST call must specify task_list_id
, title
and display_order
. It may contain notes
, due
, assigned_id
and parent_id
. No other elements should be sent from the Task object.
PATCH
A PATCH call would not send in the ident
as that would be part of the path URL, but it would send in one or more of the other elements.
If completed
is specified then completor_id
should also be specified (I'm OK with this one just being specified in the comments of the PATCH method...
definitions:
Task:
properties:
ident:
type: integer
description: The SQL ident of the Task object
readOnly: true
task_list_id:
type: integer
description: The SQL ident of the Task List object this Task belongs to.
assigned_id:
type: integer
description: The SQL ident of the Person who this task is assigned to.
completor_id:
type: integer
description: The SQL ident of the Person who completed this task.
created:
type: integer
description: The UTC epoch time this Task was created.
completed:
type: integer
description: The UTC epoch time this Task was completed.
due:
type: integer
description: The UTC epoch time this Task will be due.
title:
type: string
description: The details of the Task
notes:
type: string
description: Extra notes to clarify the Task requirements.
display_order:
type: integer
description: The order that this task should be displayed in user visible lists.
parent_id:
type: integer
description: The SQL ident of the Task that this is a sub-Task of.