Skip to content

Commit

Permalink
openapi: Fix issues with events API
Browse files Browse the repository at this point in the history
The previous_delegate and current_delegate fields are nullable.

Signed-off-by: Stephen Finucane <stephen@that.guru>
  • Loading branch information
stephenfin committed Jan 21, 2024
1 parent 84ebc71 commit ef55117
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 17 deletions.
16 changes: 14 additions & 2 deletions docs/api/schemas/latest/patchwork.yaml
Expand Up @@ -2000,9 +2000,21 @@ components:
patch:
$ref: '#/components/schemas/PatchEmbedded'
previous_delegate:
$ref: '#/components/schemas/UserEmbedded'
title: Previous delegate
type:
- 'null'
- 'object'
oneOf:
- type: 'null'
- $ref: '#/components/schemas/UserEmbedded'
current_delegate:
$ref: '#/components/schemas/UserEmbedded'
title: Current delegate
type:
- 'null'
- 'object'
oneOf:
- type: 'null'
- $ref: '#/components/schemas/UserEmbedded'
EventCheckCreated:
title: Check create event
description: |
Expand Down
16 changes: 14 additions & 2 deletions docs/api/schemas/patchwork.j2
Expand Up @@ -2078,9 +2078,21 @@ components:
patch:
$ref: '#/components/schemas/PatchEmbedded'
previous_delegate:
$ref: '#/components/schemas/UserEmbedded'
title: Previous delegate
type:
- 'null'
- 'object'
oneOf:
- type: 'null'
- $ref: '#/components/schemas/UserEmbedded'
current_delegate:
$ref: '#/components/schemas/UserEmbedded'
title: Current delegate
type:
- 'null'
- 'object'
oneOf:
- type: 'null'
- $ref: '#/components/schemas/UserEmbedded'
EventCheckCreated:
title: Check create event
description: |
Expand Down
16 changes: 14 additions & 2 deletions docs/api/schemas/v1.0/patchwork.yaml
Expand Up @@ -1608,9 +1608,21 @@ components:
patch:
$ref: '#/components/schemas/PatchEmbedded'
previous_delegate:
$ref: '#/components/schemas/UserEmbedded'
title: Previous delegate
type:
- 'null'
- 'object'
oneOf:
- type: 'null'
- $ref: '#/components/schemas/UserEmbedded'
current_delegate:
$ref: '#/components/schemas/UserEmbedded'
title: Current delegate
type:
- 'null'
- 'object'
oneOf:
- type: 'null'
- $ref: '#/components/schemas/UserEmbedded'
EventCheckCreated:
title: Check create event
description: |
Expand Down
16 changes: 14 additions & 2 deletions docs/api/schemas/v1.1/patchwork.yaml
Expand Up @@ -1635,9 +1635,21 @@ components:
patch:
$ref: '#/components/schemas/PatchEmbedded'
previous_delegate:
$ref: '#/components/schemas/UserEmbedded'
title: Previous delegate
type:
- 'null'
- 'object'
oneOf:
- type: 'null'
- $ref: '#/components/schemas/UserEmbedded'
current_delegate:
$ref: '#/components/schemas/UserEmbedded'
title: Current delegate
type:
- 'null'
- 'object'
oneOf:
- type: 'null'
- $ref: '#/components/schemas/UserEmbedded'
EventCheckCreated:
title: Check create event
description: |
Expand Down
16 changes: 14 additions & 2 deletions docs/api/schemas/v1.2/patchwork.yaml
Expand Up @@ -1837,9 +1837,21 @@ components:
patch:
$ref: '#/components/schemas/PatchEmbedded'
previous_delegate:
$ref: '#/components/schemas/UserEmbedded'
title: Previous delegate
type:
- 'null'
- 'object'
oneOf:
- type: 'null'
- $ref: '#/components/schemas/UserEmbedded'
current_delegate:
$ref: '#/components/schemas/UserEmbedded'
title: Current delegate
type:
- 'null'
- 'object'
oneOf:
- type: 'null'
- $ref: '#/components/schemas/UserEmbedded'
EventCheckCreated:
title: Check create event
description: |
Expand Down
16 changes: 14 additions & 2 deletions docs/api/schemas/v1.3/patchwork.yaml
Expand Up @@ -2000,9 +2000,21 @@ components:
patch:
$ref: '#/components/schemas/PatchEmbedded'
previous_delegate:
$ref: '#/components/schemas/UserEmbedded'
title: Previous delegate
type:
- 'null'
- 'object'
oneOf:
- type: 'null'
- $ref: '#/components/schemas/UserEmbedded'
current_delegate:
$ref: '#/components/schemas/UserEmbedded'
title: Current delegate
type:
- 'null'
- 'object'
oneOf:
- type: 'null'
- $ref: '#/components/schemas/UserEmbedded'
EventCheckCreated:
title: Check create event
description: |
Expand Down
6 changes: 1 addition & 5 deletions patchwork/tests/api/test_event.py
Expand Up @@ -6,8 +6,6 @@
from django.test import override_settings
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APITestCase


from patchwork.models import Event
from patchwork.tests.api import utils
Expand All @@ -21,10 +19,8 @@
from patchwork.tests.utils import create_state


# FIXME(stephenfin: This should inherit from 'utils.APITestCase', but we need
# to fix our schema to work with recent versions of openapi_core
@override_settings(ENABLE_REST_API=True)
class TestEventAPI(APITestCase):
class TestEventAPI(utils.APITestCase):
@staticmethod
def api_url(version=None):
kwargs = {}
Expand Down

0 comments on commit ef55117

Please sign in to comment.