Skip to content

Commit

Permalink
docs: Document endpoint to link two series
Browse files Browse the repository at this point in the history
Closes getpatchwork#506

Signed-off-by: andrepapoti <[email protected]>
  • Loading branch information
andrepapoti committed Dec 3, 2024
1 parent 2b2859c commit 702fb25
Show file tree
Hide file tree
Showing 4 changed files with 3,425 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/api/schemas/generate-schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
yaml = None

ROOT_DIR = os.path.dirname(os.path.realpath(__file__))
VERSIONS = [(1, 0), (1, 1), (1, 2), (1, 3), None]
LATEST_VERSION = (1, 3)
VERSIONS = [(1, 0), (1, 1), (1, 2), (1, 3), (1, 4), None]
LATEST_VERSION = (1, 4)


def generate_schemas():
Expand Down
66 changes: 65 additions & 1 deletion docs/api/schemas/latest/patchwork.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ info:
license:
name: GPL v2 License
url: https://www.gnu.org/licenses/gpl-2.0.html
version: '1.3'
version: '1.4'
paths:
/api:
get:
Expand Down Expand Up @@ -1223,6 +1223,42 @@ paths:
$ref: '#/components/schemas/Error'
tags:
- series
patch:
summary: Link series to set a relationship between them
description: |
Apply a partial update to a Series, where only a few fields of the model are allowed:
- previous_series: Set the provided series as coming before the one specified by the id;
- subsequent_series: Set the provided series as coming after the one specified by the id;
- required_series: Set the provided series as requirements for one specified by the id;
- required_by_series: Set the series specified by the id as a requirement for the provided ones.
operationId: series_link
responses:
'200':
description: 'Updated series'
content:
application/json:
schema:
$ref: '#/components/schemas/Series'
'400':
description: 'Bad request'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: 'Forbidden'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: 'Not found'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
tags:
- series
/api/users:
get:
summary: List users.
Expand Down Expand Up @@ -2605,6 +2641,34 @@ components:
$ref: '#/components/schemas/PatchEmbedded'
readOnly: true
uniqueItems: true
previous_series:
title: Previous series
type: array
items:
$ref: '#/components/schemas/Series'
readOnly: true
uniqueItems: true
subsequent_series:
title: Subsequent series
type: array
items:
$ref: '#/components/schemas/Series'
readOnly: true
uniqueItems: true
required_series:
title: Required series
type: array
items:
$ref: '#/components/schemas/Series'
readOnly: true
uniqueItems: true
required_by_series:
title: Required by series
type: array
items:
$ref: '#/components/schemas/Series'
readOnly: true
uniqueItems: true
User:
type: object
title: User
Expand Down
68 changes: 68 additions & 0 deletions docs/api/schemas/patchwork.j2
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,44 @@ paths:
$ref: '#/components/schemas/Error'
tags:
- series
{% if version >= (1, 4) %}
patch:
summary: Link series to set a relationship between them
description: |
Apply a partial update to a Series, where only a few fields of the model are allowed:
- previous_series: Set the provided series as coming before the one specified by the id;
- subsequent_series: Set the provided series as coming after the one specified by the id;
- required_series: Set the provided series as requirements for one specified by the id;
- required_by_series: Set the series specified by the id as a requirement for the provided ones.
operationId: series_link
responses:
'200':
description: 'Updated series'
content:
application/json:
schema:
$ref: '#/components/schemas/Series'
'400':
description: 'Bad request'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: 'Forbidden'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: 'Not found'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
tags:
- series
{% endif %}
/api/{{ version_url }}users:
get:
summary: List users.
Expand Down Expand Up @@ -2699,6 +2737,36 @@ components:
$ref: '#/components/schemas/PatchEmbedded'
readOnly: true
uniqueItems: true
{% if version >= (1, 4) %}
previous_series:
title: Previous series
type: array
items:
$ref: '#/components/schemas/Series'
readOnly: true
uniqueItems: true
subsequent_series:
title: Subsequent series
type: array
items:
$ref: '#/components/schemas/Series'
readOnly: true
uniqueItems: true
required_series:
title: Required series
type: array
items:
$ref: '#/components/schemas/Series'
readOnly: true
uniqueItems: true
required_by_series:
title: Required by series
type: array
items:
$ref: '#/components/schemas/Series'
readOnly: true
uniqueItems: true
{% endif %}
User:
type: object
title: User
Expand Down
Loading

0 comments on commit 702fb25

Please sign in to comment.