From ef55117fc834c19d1ba8487957e753db5e5ed1e5 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Sun, 21 Jan 2024 10:34:41 +0000 Subject: [PATCH] openapi: Fix issues with events API The previous_delegate and current_delegate fields are nullable. Signed-off-by: Stephen Finucane --- docs/api/schemas/latest/patchwork.yaml | 16 ++++++++++++++-- docs/api/schemas/patchwork.j2 | 16 ++++++++++++++-- docs/api/schemas/v1.0/patchwork.yaml | 16 ++++++++++++++-- docs/api/schemas/v1.1/patchwork.yaml | 16 ++++++++++++++-- docs/api/schemas/v1.2/patchwork.yaml | 16 ++++++++++++++-- docs/api/schemas/v1.3/patchwork.yaml | 16 ++++++++++++++-- patchwork/tests/api/test_event.py | 6 +----- 7 files changed, 85 insertions(+), 17 deletions(-) diff --git a/docs/api/schemas/latest/patchwork.yaml b/docs/api/schemas/latest/patchwork.yaml index 2d60a2c3..7bed5451 100644 --- a/docs/api/schemas/latest/patchwork.yaml +++ b/docs/api/schemas/latest/patchwork.yaml @@ -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: | diff --git a/docs/api/schemas/patchwork.j2 b/docs/api/schemas/patchwork.j2 index 7d41cec2..8b56a90b 100644 --- a/docs/api/schemas/patchwork.j2 +++ b/docs/api/schemas/patchwork.j2 @@ -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: | diff --git a/docs/api/schemas/v1.0/patchwork.yaml b/docs/api/schemas/v1.0/patchwork.yaml index ba326fc4..1f92590b 100644 --- a/docs/api/schemas/v1.0/patchwork.yaml +++ b/docs/api/schemas/v1.0/patchwork.yaml @@ -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: | diff --git a/docs/api/schemas/v1.1/patchwork.yaml b/docs/api/schemas/v1.1/patchwork.yaml index 8b3245a0..14b6de28 100644 --- a/docs/api/schemas/v1.1/patchwork.yaml +++ b/docs/api/schemas/v1.1/patchwork.yaml @@ -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: | diff --git a/docs/api/schemas/v1.2/patchwork.yaml b/docs/api/schemas/v1.2/patchwork.yaml index f4dcb827..7135a20f 100644 --- a/docs/api/schemas/v1.2/patchwork.yaml +++ b/docs/api/schemas/v1.2/patchwork.yaml @@ -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: | diff --git a/docs/api/schemas/v1.3/patchwork.yaml b/docs/api/schemas/v1.3/patchwork.yaml index 1b8b1819..7ad6129b 100644 --- a/docs/api/schemas/v1.3/patchwork.yaml +++ b/docs/api/schemas/v1.3/patchwork.yaml @@ -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: | diff --git a/patchwork/tests/api/test_event.py b/patchwork/tests/api/test_event.py index f36bdd2d..890d449c 100644 --- a/patchwork/tests/api/test_event.py +++ b/patchwork/tests/api/test_event.py @@ -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 @@ -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 = {}