From patchwork Tue Oct 30 11:19:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 990730 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42kptc3gcLz9s7T for ; Tue, 30 Oct 2018 22:20:56 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="K1IpaOl9"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42kptc2167zDrPq for ; Tue, 30 Oct 2018 22:20:56 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="K1IpaOl9"; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=that.guru (client-ip=185.234.75.18; helo=relay018.mxrelay.co; envelope-from=stephen@that.guru; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="K1IpaOl9"; dkim-atps=neutral Received: from relay018.mxrelay.co (relay018.mxrelay.co [185.234.75.18]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42kpsT5QqDzDrPq for ; Tue, 30 Oct 2018 22:19:57 +1100 (AEDT) Received: from filter002.mxroute.com (unknown [185.133.192.179]) by relay018.mxrelay.co (Postfix) with ESMTP id 2156A4056E for ; Tue, 30 Oct 2018 11:19:24 +0000 (UTC) Received: from one.mxroute.com (one.mxroute.com [195.201.59.211]) by filter002.mxroute.com (Postfix) with ESMTPS id E5FC53F547 for ; Tue, 30 Oct 2018 11:19:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=kpX+C3vZ53Pu2CGoOp/JNipAe5LYmqPd9mQ8piZ4Uk8=; b=K1IpaOl9YPDCNMfwSdHcH9kxTD zyRn90DA376URqAzF5YPje3pnj1TsfaYLPKcsFGPR1AMLvK1h5eXdGuUcor6xNjLlMUFn8eSOUSid SV+o0y6lOmB99I1bp6kCFIYXPUCCo/L36qVPZvnckmCO8etEELtlykcfaFaIFD7rMT+HN1rBItyaj 8aa/gEKLknYwQ29Kj+OjbS0y1jU1sEQOUouPtQ1CVXRlAsMXnzav9OyZPAv05Ac+IOOmUa7ot+JGR Cfe6DG1+ormAsRui61f/RCnOUryj9Al7skDn4h0TvkKL58tY70Hg5zJj5rI7VgmJEoozKp1GyVqFq fmxXzVQw==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH 01/17] REST: Add additional documentation Date: Tue, 30 Oct 2018 11:19:00 +0000 Message-Id: <20181030111916.7342-2-stephen@that.guru> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030111916.7342-1-stephen@that.guru> References: <20181030111916.7342-1-stephen@that.guru> X-AuthUser: stephen@that.guru X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" As noted in the Django REST Framework docs [1], views that support multiple methods can and should split their documentation using 'method:' style delimiters. Do just this. [1] https://www.django-rest-framework.org/topics/documenting-your-api/#documenting-your-views Signed-off-by: Stephen Finucane --- patchwork/api/check.py | 8 +++++++- patchwork/api/index.py | 1 + patchwork/api/patch.py | 10 +++++++++- patchwork/api/project.py | 11 ++++++++++- patchwork/api/user.py | 11 ++++++++++- 5 files changed, 37 insertions(+), 4 deletions(-) diff --git a/patchwork/api/check.py b/patchwork/api/check.py index 48019e72..4771455f 100644 --- a/patchwork/api/check.py +++ b/patchwork/api/check.py @@ -74,7 +74,13 @@ class CheckMixin(object): class CheckListCreate(CheckMixin, ListCreateAPIView): - """List or create checks.""" + """ + get: + List checks. + + post: + Create a check. + """ lookup_url_kwarg = 'patch_id' ordering = 'id' diff --git a/patchwork/api/index.py b/patchwork/api/index.py index 2266635c..45485c91 100644 --- a/patchwork/api/index.py +++ b/patchwork/api/index.py @@ -11,6 +11,7 @@ from rest_framework.views import APIView class IndexView(APIView): def get(self, request, *args, **kwargs): + """List API resources.""" return Response({ 'projects': reverse('api-project-list', request=request), 'users': reverse('api-user-list', request=request), diff --git a/patchwork/api/patch.py b/patchwork/api/patch.py index 6367dd5d..523378da 100644 --- a/patchwork/api/patch.py +++ b/patchwork/api/patch.py @@ -188,8 +188,16 @@ class PatchList(ListAPIView): class PatchDetail(RetrieveUpdateAPIView): - """Show a patch.""" + """ + get: + Show a patch. + + patch: + Update a patch. + put: + Update a patch. + """ permission_classes = (PatchworkPermission,) serializer_class = PatchDetailSerializer diff --git a/patchwork/api/project.py b/patchwork/api/project.py index 22fb1c4e..d7bb1f21 100644 --- a/patchwork/api/project.py +++ b/patchwork/api/project.py @@ -74,6 +74,15 @@ class ProjectList(ProjectMixin, ListAPIView): class ProjectDetail(ProjectMixin, RetrieveUpdateAPIView): - """Show a project.""" + """ + get: + Show a project. + + patch: + Update a project. + + put: + Update a project. + """ pass diff --git a/patchwork/api/user.py b/patchwork/api/user.py index e11bed4b..29944e22 100644 --- a/patchwork/api/user.py +++ b/patchwork/api/user.py @@ -48,6 +48,15 @@ class UserList(UserMixin, ListAPIView): class UserDetail(UserMixin, RetrieveUpdateAPIView): - """Show a user.""" + """ + get: + Show a user. + + patch: + Update a user. + + put: + Update a user. + """ pass From patchwork Tue Oct 30 11:19:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 990732 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42kpvn3cbVz9s7h for ; Tue, 30 Oct 2018 22:21:57 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="lSRapD9M"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42kpvn0HxQzF0yr for ; Tue, 30 Oct 2018 22:21:57 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="lSRapD9M"; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=that.guru (client-ip=185.234.75.2; helo=relay-direct2.mxroute.com; envelope-from=stephen@that.guru; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="lSRapD9M"; dkim-atps=neutral Received: from relay-direct2.mxroute.com (relay-direct2.mxroute.com [185.234.75.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42kpsW2nHKzDrPq for ; Tue, 30 Oct 2018 22:19:59 +1100 (AEDT) Received: from filter001.mxrelay.co (filter001.mxrelay.co [64.52.23.203]) by relay-direct2.mxroute.com (Postfix) with ESMTP id 696843F0FC for ; Tue, 30 Oct 2018 11:19:26 +0000 (UTC) Received: from one.mxroute.com (one.mxroute.com [195.201.59.211]) by filter001.mxrelay.co (Postfix) with ESMTPS id 7522D100065 for ; Tue, 30 Oct 2018 11:19:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=A/Tr6wH4tEEUKvTigwpuxbH0L9JDHSO4ISGi95w1vHg=; b=lSRapD9Meo3AOFXxZNL/gA6LRS 5e3zMWS/0VVTVCkWJpKE8zxykLhsJrKPaAdaaf5SAJS0rnZWzQQ56QH9cnrOKZWhtmDuaXPyjlN7a 4Wie3R+4C1FooFv8qzEsDF4r9uI6s7vlGb/tw06+W15aCQr+M6xATwJuqTfyMGzEqkgJFufdN/ZzG Q2YEBusFEfuQH8G8oKSpnztWX45dj6Tlw9ReSK3ypsE9jQiNxMkcrfV2dvnSpP15en9fbU5teoqoI UjqqNG0NRH3YjS4XkFlMum9Mem5JjZypMxZ0CEP596vgxQCzscW/CF+5D16/2IYXT91NqUJZyxvOt LZaiTP9g==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH 02/17] REST: Show 'web_url' in embedded series responses Date: Tue, 30 Oct 2018 11:19:01 +0000 Message-Id: <20181030111916.7342-3-stephen@that.guru> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030111916.7342-1-stephen@that.guru> References: <20181030111916.7342-1-stephen@that.guru> X-AuthUser: stephen@that.guru X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" Signed-off-by: Stephen Finucane Closes: #224 Fixes: 9c179bf4c ("REST: Add 'web_url' link to API responses") --- patchwork/api/embedded.py | 3 ++- releasenotes/notes/issue-224-8f1c4207aa273ac6.yaml | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/issue-224-8f1c4207aa273ac6.yaml diff --git a/patchwork/api/embedded.py b/patchwork/api/embedded.py index 83df0e50..72ffc68a 100644 --- a/patchwork/api/embedded.py +++ b/patchwork/api/embedded.py @@ -187,7 +187,8 @@ class SeriesSerializer(SerializedRelatedField): class Meta: model = models.Series - fields = ('id', 'url', 'date', 'name', 'version', 'mbox') + fields = ('id', 'url', 'web_url', 'date', 'name', 'version', + 'mbox') read_only_fields = fields versioned_field = { '1.1': ('web_url', ), diff --git a/releasenotes/notes/issue-224-8f1c4207aa273ac6.yaml b/releasenotes/notes/issue-224-8f1c4207aa273ac6.yaml new file mode 100644 index 00000000..f6e9ccaa --- /dev/null +++ b/releasenotes/notes/issue-224-8f1c4207aa273ac6.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + API resources with embedded series were not showing the ``web_url`` value + for these series. This is now shown. From patchwork Tue Oct 30 11:19:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 990743 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42kq1v1TbWz9s89 for ; Tue, 30 Oct 2018 22:27:15 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="XfX7Rgxa"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42kq1t2h8szDqfS for ; Tue, 30 Oct 2018 22:27:14 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="XfX7Rgxa"; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=that.guru (client-ip=185.234.75.10; helo=relay003.mxroute.com; envelope-from=stephen@that.guru; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="XfX7Rgxa"; dkim-atps=neutral Received: from relay003.mxroute.com (relay003.mxroute.com [185.234.75.10]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42kpsf4VhfzDsG1 for ; Tue, 30 Oct 2018 22:20:06 +1100 (AEDT) Received: from relay-ext2.mxrelay.co (relay-ext2.mxrelay.co [159.100.240.208]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay004.mxroute.com (Postfix) with ESMTPS id 0CFDE3F37D for ; Tue, 30 Oct 2018 11:19:34 +0000 (UTC) Received: from filter001.mxrelay.co (filter001.mxrelay.co [64.52.23.203]) by relay-ext2.mxrelay.co (Postfix) with ESMTP id 2EFF43FC3F for ; Tue, 30 Oct 2018 11:19:27 +0000 (UTC) Received: from one.mxroute.com (one.mxroute.com [195.201.59.211]) by filter001.mxrelay.co (Postfix) with ESMTPS id 131D510007F for ; Tue, 30 Oct 2018 11:19:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=MJ/2SYayCNny8YPr+l5gqjrgZEw1TdcjxoTxd3U3QIk=; b=XfX7Rgxaq8MKxxh18sE8Kx6IqQ XIe9JApkjfzu1lvC78hSFBaLFgJFy8VlO/q0yPOD1P6FXnOqqm5vL0+K+Xu4iinFCQMym4RQ2h1n4 RXLAhEzkZfVnNfmi4S8Nb1hx+hHCNWvz0C91D6hq9VcUhQN8hYqe7yKNun8i9/0l3pBCcuODdJUaP hxkQEWIT6jEaFOUfqO6wrj3XbTVTJdZY/EaMx4hajAAshC2t0rnGQ9/58C+9TomMegpyOFLg/HyDP vj1dYNlSbUv2JVWCDhphAoD/ZDcmsJaABT6Kqc/bcA8vc9nogl+sASgoJ+lXKl4p+jofbkGkCstgi 1vebx4ag==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH 03/17] REST: Ensure patch exists for check creation Date: Tue, 30 Oct 2018 11:19:02 +0000 Message-Id: <20181030111916.7342-4-stephen@that.guru> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030111916.7342-1-stephen@that.guru> References: <20181030111916.7342-1-stephen@that.guru> X-AuthUser: stephen@that.guru X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" Signed-off-by: Stephen Finucane Closes: #226 --- patchwork/api/check.py | 8 ++++- patchwork/tests/api/test_check.py | 31 ++++++++++++++++++- .../notes/issue-226-27ea72266d3ee9ac.yaml | 7 +++++ 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/issue-226-27ea72266d3ee9ac.yaml diff --git a/patchwork/api/check.py b/patchwork/api/check.py index 4771455f..0e35bd45 100644 --- a/patchwork/api/check.py +++ b/patchwork/api/check.py @@ -3,6 +3,8 @@ # # SPDX-License-Identifier: GPL-2.0-or-later +from django.http import Http404 +from django.shortcuts import get_object_or_404 from rest_framework.exceptions import PermissionDenied from rest_framework.generics import ListCreateAPIView from rest_framework.generics import RetrieveAPIView @@ -70,6 +72,10 @@ class CheckMixin(object): def get_queryset(self): patch_id = self.kwargs['patch_id'] + + if not Patch.objects.filter(pk=self.kwargs['patch_id']).exists(): + raise Http404 + return Check.objects.prefetch_related('user').filter(patch=patch_id) @@ -86,7 +92,7 @@ class CheckListCreate(CheckMixin, ListCreateAPIView): ordering = 'id' def create(self, request, patch_id, *args, **kwargs): - p = Patch.objects.get(id=patch_id) + p = get_object_or_404(Patch, id=patch_id) if not p.is_editable(request.user): raise PermissionDenied() request.patch = p diff --git a/patchwork/tests/api/test_check.py b/patchwork/tests/api/test_check.py index 783a6154..06255957 100644 --- a/patchwork/tests/api/test_check.py +++ b/patchwork/tests/api/test_check.py @@ -77,6 +77,12 @@ class TestCheckAPI(APITestCase): resp = self.client.get(self.api_url(), {'user': 'otheruser'}) self.assertEqual(0, len(resp.data)) + def test_list_invalid_patch(self): + """Ensure we get a 404 for a non-existent patch.""" + resp = self.client.get( + reverse('api-check-list', kwargs={'pk': '99999'})) + self.assertEqual(status.HTTP_404_NOT_FOUND, resp.status_code) + def test_detail(self): """Validate we can get a specific check.""" check = self._create_check() @@ -99,12 +105,21 @@ class TestCheckAPI(APITestCase): self.assertEqual(1, Check.objects.all().count()) self.assertSerialized(Check.objects.first(), resp.data) + def test_create_no_permissions(self): + """Ensure creations are rejected by standard users.""" + check = { + 'state': 'success', + 'target_url': 'http://t.co', + 'description': 'description', + 'context': 'context', + } + user = create_user() self.client.force_authenticate(user=user) resp = self.client.post(self.api_url(), check) self.assertEqual(status.HTTP_403_FORBIDDEN, resp.status_code) - def test_create_invalid(self): + def test_create_invalid_state(self): """Ensure we handle invalid check states.""" check = { 'state': 'this-is-not-a-valid-state', @@ -118,6 +133,20 @@ class TestCheckAPI(APITestCase): self.assertEqual(status.HTTP_400_BAD_REQUEST, resp.status_code) self.assertEqual(0, Check.objects.all().count()) + def test_create_invalid_patch(self): + """Ensure we handle non-existent patches.""" + check = { + 'state': 'success', + 'target_url': 'http://t.co', + 'description': 'description', + 'context': 'context', + } + + self.client.force_authenticate(user=self.user) + resp = self.client.post( + reverse('api-check-list', kwargs={'pk': '99999'}), check) + self.assertEqual(status.HTTP_404_NOT_FOUND, resp.status_code) + def test_update_delete(self): """Ensure updates and deletes aren't allowed""" check = self._create_check() diff --git a/releasenotes/notes/issue-226-27ea72266d3ee9ac.yaml b/releasenotes/notes/issue-226-27ea72266d3ee9ac.yaml new file mode 100644 index 00000000..8f891e04 --- /dev/null +++ b/releasenotes/notes/issue-226-27ea72266d3ee9ac.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + Showing checks for a non-existant patch was returning an empty response + instead of a HTTP 404. Similarly, attempting to create a new check against + this patch would result in a HTTP 5xx error instead of a HTTP 404. Both + issues are now resolved. From patchwork Tue Oct 30 11:19:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 990734 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42kpxN2YmWz9s8F for ; Tue, 30 Oct 2018 22:23:20 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="C+xleL9x"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42kpxM5JWkzDrSM for ; Tue, 30 Oct 2018 22:23:19 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="C+xleL9x"; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=that.guru (client-ip=185.234.75.14; helo=relay014.mxrelay.co; envelope-from=stephen@that.guru; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="C+xleL9x"; dkim-atps=neutral Received: from relay014.mxrelay.co (relay014.mxrelay.co [185.234.75.14]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42kpsX5jNQzDrRP for ; Tue, 30 Oct 2018 22:20:00 +1100 (AEDT) Received: from filter001.mxrelay.co (filter001.mxrelay.co [64.52.23.203]) by relay014.mxrelay.co (Postfix) with ESMTP id 2DF6B3F1C6 for ; Tue, 30 Oct 2018 11:19:27 +0000 (UTC) Received: from one.mxroute.com (one.mxroute.com [195.201.59.211]) by filter001.mxrelay.co (Postfix) with ESMTPS id 5571B1000C0 for ; Tue, 30 Oct 2018 11:19:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=c1i8T9ZHEeLD0vjsWGbmxLDi6L9Po7ChbLQzZn+PTPM=; b=C+xleL9xCW5dk76H+rgEQCFxJa u7ztw2zPIcWFs3bdyRTiZlqyGkTv2Zvz1JF8WFyOPERvFiNtHmM04hCd18ecqgjFebWe4EapWsY54 xkZnR056qDvt027x4oa16YKMmWvoloXK0wzB4FoUEeUyhdAl3pXaMGWf6GkmGma3ujRb6gTUq6boH Mz+eW4lh276wjP9K8ZFRY9xFKgXjawqIuGdWDfLYIIuhmdQWmUeRdq89p3OmdrTS9YP5rQiH/bbd1 aMqiZobH8Z0qIEi8kr5qipCKRbh1UaU0BBjHx545Dg6jBoc6PXPwESC0BQJ+GoFkfvNY8lcpYDDdt Kainq5UQ==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH 04/17] REST: Ensure submission exists for comment listing Date: Tue, 30 Oct 2018 11:19:03 +0000 Message-Id: <20181030111916.7342-5-stephen@that.guru> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030111916.7342-1-stephen@that.guru> References: <20181030111916.7342-1-stephen@that.guru> X-AuthUser: stephen@that.guru X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" Signed-off-by: Stephen Finucane Closes: #225 --- patchwork/api/comment.py | 5 +++++ patchwork/tests/api/test_comment.py | 13 +++++++++++++ releasenotes/notes/issue-225-94215600c1b23f6e.yaml | 6 ++++++ 3 files changed, 24 insertions(+) create mode 100644 releasenotes/notes/issue-225-94215600c1b23f6e.yaml diff --git a/patchwork/api/comment.py b/patchwork/api/comment.py index 214a9438..57b37111 100644 --- a/patchwork/api/comment.py +++ b/patchwork/api/comment.py @@ -5,6 +5,7 @@ import email.parser +from django.http import Http404 from rest_framework.generics import ListAPIView from rest_framework.serializers import SerializerMethodField @@ -12,6 +13,7 @@ from patchwork.api.base import BaseHyperlinkedModelSerializer from patchwork.api.base import PatchworkPermission from patchwork.api.embedded import PersonSerializer from patchwork.models import Comment +from patchwork.models import Submission class CommentListSerializer(BaseHyperlinkedModelSerializer): @@ -64,6 +66,9 @@ class CommentList(ListAPIView): lookup_url_kwarg = 'pk' def get_queryset(self): + if not Submission.objects.filter(pk=self.kwargs['pk']).exists(): + raise Http404 + return Comment.objects.filter( submission=self.kwargs['pk'] ).select_related('submitter') diff --git a/patchwork/tests/api/test_comment.py b/patchwork/tests/api/test_comment.py index a0aec594..06fe2de3 100644 --- a/patchwork/tests/api/test_comment.py +++ b/patchwork/tests/api/test_comment.py @@ -5,6 +5,7 @@ import unittest +from django.http import Http404 from django.conf import settings from django.urls import NoReverseMatch from django.urls import reverse @@ -61,6 +62,12 @@ class TestCoverComments(APITestCase): with self.assertRaises(NoReverseMatch): self.client.get(self.api_url(cover_obj, version='1.0')) + def test_list_invalid_cover(self): + """Ensure we get a 404 for a non-existent cover letter.""" + resp = self.client.get( + reverse('api-cover-comment-list', kwargs={'pk': '99999'})) + self.assertEqual(status.HTTP_404_NOT_FOUND, resp.status_code) + @unittest.skipUnless(settings.ENABLE_REST_API, 'requires ENABLE_REST_API') class TestPatchComments(APITestCase): @@ -99,3 +106,9 @@ class TestPatchComments(APITestCase): # check we can't access comments using the old version of the API with self.assertRaises(NoReverseMatch): self.client.get(self.api_url(patch_obj, version='1.0')) + + def test_list_invalid_patch(self): + """Ensure we get a 404 for a non-existent patch.""" + resp = self.client.get( + reverse('api-patch-comment-list', kwargs={'pk': '99999'})) + self.assertEqual(status.HTTP_404_NOT_FOUND, resp.status_code) diff --git a/releasenotes/notes/issue-225-94215600c1b23f6e.yaml b/releasenotes/notes/issue-225-94215600c1b23f6e.yaml new file mode 100644 index 00000000..035e38d8 --- /dev/null +++ b/releasenotes/notes/issue-225-94215600c1b23f6e.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Showing comments for a non-existant patch or cover letter was returning an + empty response instead of a HTTP 404. This issue is resolved for both + resources. From patchwork Tue Oct 30 11:19:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 990731 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42kpv9681Mz9s3C for ; Tue, 30 Oct 2018 22:21:25 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="YYZ/AYMS"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42kpv94XzKzF1Q6 for ; Tue, 30 Oct 2018 22:21:25 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="YYZ/AYMS"; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=that.guru (client-ip=185.234.75.13; helo=relay013.mxrelay.co; envelope-from=stephen@that.guru; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="YYZ/AYMS"; dkim-atps=neutral Received: from relay013.mxrelay.co (relay013.mxrelay.co [185.234.75.13]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42kpsV37BHzDqfS for ; Tue, 30 Oct 2018 22:19:58 +1100 (AEDT) Received: from filter002.mxroute.com (unknown [185.133.192.179]) by relay013.mxrelay.co (Postfix) with ESMTP id B97FE42DD8 for ; Tue, 30 Oct 2018 11:19:25 +0000 (UTC) Received: from one.mxroute.com (one.mxroute.com [195.201.59.211]) by filter002.mxroute.com (Postfix) with ESMTPS id 9B8E33F3DB for ; Tue, 30 Oct 2018 11:19:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=eYFssjY7jO42x364utAmyJ/hKmPElof1lUNNrLLJpdA=; b=YYZ/AYMSO7Ike2GPNfUQf1ZSce Innf4mtRLmnplKP4BUoTegeghUsVFConQzzAWZI4/FaRMFITbXKq6IOspjbGkz49m1SWgxmf039tn TAyXkS+QX37afkSVP77lHPkyN24MA59+pogCHQIlUSdByaCA5HoX6RhvnQZL5XuNMXwt922v+V+Tg lZnQCUziRyOUapD0gY4PTFWsrF0Yt6waYh443fZelG0sJ1JDWN8oa++8VhMprbMRZKR8TLeHB+1mX h8E4LVwto9LDz0j3ovLUBpX/I8nQWx/8lL/DyG5dT/litxZTRbTDnTPHWvoRqqwmPmI22d3Er9b3Y uGY3+P5g==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH 05/17] docs: Start documenting API using OpenAPI Date: Tue, 30 Oct 2018 11:19:04 +0000 Message-Id: <20181030111916.7342-6-stephen@that.guru> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030111916.7342-1-stephen@that.guru> References: <20181030111916.7342-1-stephen@that.guru> X-AuthUser: stephen@that.guru X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" When the REST API was first added, we attempted to document it using OpenAPI 2.0 (formerly Swagger). This was mostly never completed because (a) it was really tedious and (b) no one was that bothered. However, as we expand the range of clients for the REST API, having a well documented API becomes more and more of an asset. Start doing this by adding a brand new schema, this time using OpenAPI. This will entirely replace the older schema and, as such, is namespaced separately. We start by documenting '/' (i.e. the index) page and will add additional resources as we go. Signed-off-by: Stephen Finucane --- docs/api/schemas/patchwork.yaml | 76 +++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 docs/api/schemas/patchwork.yaml diff --git a/docs/api/schemas/patchwork.yaml b/docs/api/schemas/patchwork.yaml new file mode 100644 index 00000000..804d0c3f --- /dev/null +++ b/docs/api/schemas/patchwork.yaml @@ -0,0 +1,76 @@ +openapi: '3.0.0' +info: + title: Patchwork API + description: | + Patchwork is a web-based patch tracking system designed to facilitate the + contribution and management of contributions to an open-source project. + contact: + email: patchwork@lists.ozlabs.org + license: + name: GPL v2 License + url: https://www.gnu.org/licenses/gpl-2.0.html + version: '1.1' +paths: + /api/: + get: + description: List API resources. + operationId: api_list + parameters: [] + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/Index' + tags: + - api +components: + securitySchemes: + basicAuth: + type: http + scheme: basic + apiKeyAuth: + type: http + scheme: bearer + schemas: + Index: + type: object + properties: + bundles: + title: Bundles URL + type: string + format: uri + readOnly: true + covers: + title: Covers URL + type: string + format: uri + readOnly: true + events: + title: Events URL + type: string + format: uri + readOnly: true + patches: + title: Patches URL + type: string + format: uri + readOnly: true + people: + title: People URL + type: string + format: uri + readOnly: true + projects: + title: Projects URL + type: string + format: uri + readOnly: true + users: + title: Users URL + type: string + format: uri + readOnly: true +servers: +- url: 'https://patchwork.ozlabs.org/api/1.1' From patchwork Tue Oct 30 11:19:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 990733 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42kpwZ3Q75z9s7W for ; Tue, 30 Oct 2018 22:22:38 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="gDKAhp7u"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42kpwZ1RmlzDqfH for ; Tue, 30 Oct 2018 22:22:38 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="gDKAhp7u"; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=that.guru (client-ip=185.234.75.18; helo=relay018.mxrelay.co; envelope-from=stephen@that.guru; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="gDKAhp7u"; dkim-atps=neutral Received: from relay018.mxrelay.co (relay018.mxrelay.co [185.234.75.18]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42kpsW75BszDqfS for ; Tue, 30 Oct 2018 22:19:59 +1100 (AEDT) Received: from filter002.mxroute.com (unknown [185.133.192.179]) by relay018.mxrelay.co (Postfix) with ESMTP id 71BE14056F for ; Tue, 30 Oct 2018 11:19:27 +0000 (UTC) Received: from one.mxroute.com (one.mxroute.com [195.201.59.211]) by filter002.mxroute.com (Postfix) with ESMTPS id 4EEB73F3DB for ; Tue, 30 Oct 2018 11:19:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=33MCpOorRkdfOxwofR+/bNJpcJyfXa4mWZooEIrDDXw=; b=gDKAhp7u6I3QOtAIZnKdWx13VO 80u8MS9jbGsPCwqTrHutbW+jv0Fe3nw4eyDock2uHH8NmosaCIrMTHnSQwDaOdF3mpI0fb4bJ59Ts BfTor7QRC354M6lexXdHB7Qr9Mr3O2YtuN6/7GRcRUHW6WW27gxr0k710q68Rnb0EsgpSb491oydy FiWvYxQBSyCkbZ4z2xRwFsCFnCuDZcpqIE4o2HLbfkOUvJwXCx0H9HEBBwHQf7OTnFlUun28WbC0s MlowIbaKTpvczkMG0o1geyPJBOoLJ1TV8IOGkPwTW2YqbKTUf9eciGtQsUNkCp9eivgkQ+DzluvNx h9d92qkg==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH 06/17] docs: Document the '/users' resource Date: Tue, 30 Oct 2018 11:19:05 +0000 Message-Id: <20181030111916.7342-7-stephen@that.guru> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030111916.7342-1-stephen@that.guru> References: <20181030111916.7342-1-stephen@that.guru> X-AuthUser: stephen@that.guru X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" This introduces our first use of parameters, both in the path and the query. The latter are extracted out as they'll be used by later changes. Signed-off-by: Stephen Finucane --- docs/api/schemas/patchwork.yaml | 232 ++++++++++++++++++++++++++++++++ 1 file changed, 232 insertions(+) diff --git a/docs/api/schemas/patchwork.yaml b/docs/api/schemas/patchwork.yaml index 804d0c3f..eabdc55d 100644 --- a/docs/api/schemas/patchwork.yaml +++ b/docs/api/schemas/patchwork.yaml @@ -25,6 +25,150 @@ paths: $ref: '#/components/schemas/Index' tags: - api + /api/users/: + get: + description: List users. + operationId: users_list + parameters: + - $ref: '#/components/parameters/Page' + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/Order' + - $ref: '#/components/parameters/Search' + responses: + '200': + description: '' + headers: + Link: + $ref: '#/components/headers/Link' + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/User' + '403': + description: 'Forbidden' + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + tags: + - users + /api/users/{id}/: + get: + description: Show a user. + operationId: users_read + parameters: + - in: path + name: id + required: true + schema: + description: A unique integer value identifying this user. + title: ID + type: integer + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/User' + '400': + description: 'Bad request' + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorUserUpdate' + '403': + description: 'Forbidden' + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '404': + description: 'Not found' + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + tags: + - users + patch: + description: Update a user (partial). + operationId: users_partial_update + parameters: + - in: path + name: id + required: true + schema: + description: A unique integer value identifying this user. + title: ID + type: integer + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/User' + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/User' + '403': + description: 'Forbidden' + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '404': + description: 'Not found' + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + tags: + - users + put: + description: Update a user. + operationId: users_update + parameters: + - in: path + name: id + required: true + schema: + description: A unique integer value identifying this user. + title: ID + type: integer + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/User' + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/User' + '403': + description: 'Forbidden' + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '404': + description: 'Not found' + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + tags: + - users components: securitySchemes: basicAuth: @@ -33,6 +177,44 @@ components: apiKeyAuth: type: http scheme: bearer + parameters: + Page: + in: query + name: page + schema: + description: A page number within the paginated result set. + title: Page + type: integer + PageSize: + in: query + name: per_page + schema: + description: Number of results to return per page. + title: Page size + type: integer + Order: + in: query + name: order + schema: + description: Which field to use when ordering the results. + title: Ordering + type: string + Search: + in: query + name: q + schema: + description: A search term. + title: Search + type: string + headers: + Link: + description: | + Links to related resources, in the format defined by + [RFC 5988](https://tools.ietf.org/html/rfc5988#section-5). + This will include a link with relation type `next` to the + next page, if there is a next page. + schema: + type: string schemas: Index: type: object @@ -72,5 +254,55 @@ components: type: string format: uri readOnly: true + User: + type: object + properties: + id: + title: ID + type: integer + readOnly: true + url: + title: Url + type: string + format: uri + readOnly: true + username: + title: Username + type: string + readOnly: true + minLength: 1 + maxLength: 150 + first_name: + title: First name + type: string + maxLength: 30 + last_name: + title: Last name + type: string + maxLength: 150 + email: + title: Email address + type: string + format: email + readOnly: true + minLength: 1 + Error: + type: object + properties: + detail: + title: Detail + type: string + readOnly: true + ErrorUserUpdate: + type: object + properties: + first_name: + title: First name + type: string + readOnly: true + last_name: + title: First name + type: string + readOnly: true servers: - url: 'https://patchwork.ozlabs.org/api/1.1' From patchwork Tue Oct 30 11:19:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 990738 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42kq0J6pyqz9s89 for ; Tue, 30 Oct 2018 22:25:52 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="DKgk9Mmk"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42kq0J4lnyzF10S for ; Tue, 30 Oct 2018 22:25:52 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="DKgk9Mmk"; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=that.guru (client-ip=185.234.75.9; helo=relay002.mxroute.com; envelope-from=stephen@that.guru; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="DKgk9Mmk"; dkim-atps=neutral Received: from relay002.mxroute.com (relay002.mxroute.com [185.234.75.9]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42kpsb4XgKzF100 for ; Tue, 30 Oct 2018 22:20:03 +1100 (AEDT) Received: from filter001.mxrelay.co (filter001.mxrelay.co [64.52.23.203]) by relay002.mxroute.com (Postfix) with ESMTP id D34A63F145 for ; Tue, 30 Oct 2018 11:19:29 +0000 (UTC) Received: from one.mxroute.com (one.mxroute.com [195.201.59.211]) by filter001.mxrelay.co (Postfix) with ESMTPS id 050E0100065 for ; Tue, 30 Oct 2018 11:19:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=TYSYSBFwi8k3TWmvEsa8ObrqZHbf45cQ6u7c49ZkFYI=; b=DKgk9MmkC9R5c390W4xGH8kVFk g5HdmFKwH3CqgOKj58qLN+i2fbIgVqnTUW9NRB9Ms3a6hQM99hh3Wlx9AmAR0LP9ta1OJDos14haR wAkCfqOvKNrHNWOfs86x0vLIyVcnVkfyywZfglFgWtCUGaaYkFRH90anifoHdm9FDI/xXUovtxAJI hSbabZFtIkIDJYOHSsmVs5LbKvv2jrT0dgQ8SRfsbhrCX45fMzC06WeLwlUCyL3mwaMjBskA//eVW tZbk2Xwz59HDvZPqWvIlhviijSTqGIinJ9c1mwQtsUJ44FhIgh02L5sd/C0Mkxmn4xbdjnUni4Cxg U9DWSjTA==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH 07/17] docs: Document the '/people' resource Date: Tue, 30 Oct 2018 11:19:06 +0000 Message-Id: <20181030111916.7342-8-stephen@that.guru> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030111916.7342-1-stephen@that.guru> References: <20181030111916.7342-1-stephen@that.guru> X-AuthUser: stephen@that.guru X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" This introduces our first use of embedded serializers, which are separate models from the main ones. Other than that, this is pretty standard. Signed-off-by: Stephen Finucane --- docs/api/schemas/patchwork.yaml | 109 ++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/docs/api/schemas/patchwork.yaml b/docs/api/schemas/patchwork.yaml index eabdc55d..f713f850 100644 --- a/docs/api/schemas/patchwork.yaml +++ b/docs/api/schemas/patchwork.yaml @@ -25,6 +25,56 @@ paths: $ref: '#/components/schemas/Index' tags: - api + /api/people/: + get: + description: List people. + operationId: people_list + parameters: + - $ref: '#/components/parameters/Page' + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/Order' + - $ref: '#/components/parameters/Search' + responses: + '200': + description: '' + headers: + Link: + $ref: '#/components/headers/Link' + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Person' + tags: + - people + /api/people/{id}/: + get: + description: Show a person. + operationId: people_read + parameters: + - in: path + name: id + required: true + schema: + description: '' + title: '' + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/Person' + '404': + description: 'Not found' + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + tags: + - people /api/users/: get: description: List users. @@ -254,6 +304,31 @@ components: type: string format: uri readOnly: true + Person: + type: object + properties: + id: + title: ID + type: integer + readOnly: true + url: + title: Url + type: string + format: uri + readOnly: true + name: + title: Name + type: string + readOnly: true + minLength: 1 + email: + title: Email + type: string + format: email + readOnly: true + minLength: 1 + user: + $ref: '#/components/schemas/UserEmbedded' User: type: object properties: @@ -286,6 +361,40 @@ components: format: email readOnly: true minLength: 1 + UserEmbedded: + type: object + properties: + id: + title: ID + type: integer + readOnly: true + url: + title: Url + type: string + format: uri + readOnly: true + username: + title: Username + type: string + readOnly: true + minLength: 1 + maxLength: 150 + first_name: + title: First name + type: string + maxLength: 30 + readOnly: true + last_name: + title: Last name + type: string + maxLength: 150 + readOnly: true + email: + title: Email address + type: string + format: email + readOnly: true + minLength: 1 Error: type: object properties: From patchwork Tue Oct 30 11:19:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 990735 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42kpy317l9z9s7W for ; Tue, 30 Oct 2018 22:23:55 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="GG7svkzY"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42kpy25NyLzF0yr for ; Tue, 30 Oct 2018 22:23:54 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="GG7svkzY"; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=that.guru (client-ip=185.234.75.13; helo=relay013.mxrelay.co; envelope-from=stephen@that.guru; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="GG7svkzY"; dkim-atps=neutral Received: from relay013.mxrelay.co (relay013.mxrelay.co [185.234.75.13]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42kpsX6WjYzDrSM for ; Tue, 30 Oct 2018 22:20:00 +1100 (AEDT) Received: from filter002.mxroute.com (unknown [185.133.192.179]) by relay013.mxrelay.co (Postfix) with ESMTP id 537B642DDA for ; Tue, 30 Oct 2018 11:19:28 +0000 (UTC) Received: from one.mxroute.com (one.mxroute.com [195.201.59.211]) by filter002.mxroute.com (Postfix) with ESMTPS id 2E17D3F546 for ; Tue, 30 Oct 2018 11:19:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=uH0QTmfGU9w7El38Fw1c8dshxDJ5JIGA6BkHjMtH01E=; b=GG7svkzYxhKG0parRAa5EUIiSX Iel3/xa+WLpmNyQ/jb7dDg3KUekRNTJ23ji/1UfIOkGOeqgA3+8qMX1/reZAqbNzqWvMI8se0fC9c LhuLcxNVk0fBG6hij1m4l3xkW7EOiFBDkqQR5ZlybysQNP7H8eBhzotk7/+UJmk64XbGoWwV8u3yV sN8mcIJm8hHK3dd7DOGOsLdRht6iwsljaHVaAjmHxJfGjnQGeXGOnYSbPYNKO4GRF0M4FkHEJDEI9 hJwUblauN/REEG8aP8jBEATYqLgKnqyYkLPGyx7HPK0elJeqetjWBCkyf+zrMfyd2tw3Oa7qLBpwL /Az0TV+Q==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH 08/17] docs: Document the '/projects' resource Date: Tue, 30 Oct 2018 11:19:07 +0000 Message-Id: <20181030111916.7342-9-stephen@that.guru> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030111916.7342-1-stephen@that.guru> References: <20181030111916.7342-1-stephen@that.guru> X-AuthUser: stephen@that.guru X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" This one's pretty straightforward. Signed-off-by: Stephen Finucane --- docs/api/schemas/patchwork.yaml | 223 ++++++++++++++++++++++++++++++++ 1 file changed, 223 insertions(+) diff --git a/docs/api/schemas/patchwork.yaml b/docs/api/schemas/patchwork.yaml index f713f850..99a15ad4 100644 --- a/docs/api/schemas/patchwork.yaml +++ b/docs/api/schemas/patchwork.yaml @@ -75,6 +75,144 @@ paths: $ref: '#/components/schemas/Error' tags: - people + /api/projects/: + get: + description: List projects. + operationId: projects_list + parameters: + - $ref: '#/components/parameters/Page' + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/Order' + - $ref: '#/components/parameters/Search' + responses: + '200': + description: '' + headers: + Link: + $ref: '#/components/headers/Link' + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Project' + tags: + - projects + /api/projects/{id}/: + get: + description: Show a project. + operationId: projects_read + parameters: + - in: path + name: id + required: true + schema: + description: '' + title: '' + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/Project' + '400': + description: 'Bad request' + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorProjectUpdate' + '403': + description: 'Forbidden' + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '404': + description: 'Not found' + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + tags: + - projects + patch: + description: Update a project (partial). + operationId: projects_partial_update + parameters: + - in: path + name: id + required: true + schema: + description: '' + title: '' + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Project' + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/Project' + '403': + description: 'Forbidden' + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '404': + description: 'Not found' + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + tags: + - projects + put: + description: Update a project. + operationId: projects_update + parameters: + - in: path + name: id + required: true + schema: + description: '' + title: '' + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Project' + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/Project' + '403': + description: 'Forbidden' + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '404': + description: 'Not found' + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + tags: + - projects /api/users/: get: description: List users. @@ -329,6 +467,73 @@ components: minLength: 1 user: $ref: '#/components/schemas/UserEmbedded' + Project: + type: object + properties: + id: + title: ID + type: integer + readOnly: true + url: + title: Url + type: string + format: uri + readOnly: true + name: + title: Name + type: string + readOnly: true + minLength: 1 + link_name: + title: Link name + type: string + readOnly: true + maxLength: 255 + minLength: 1 + list_id: + title: List id + type: string + readOnly: true + maxLength: 255 + minLength: 1 + list_email: + title: List email + type: string + format: email + readOnly: true + maxLength: 200 + minLength: 1 + web_url: + title: Web URL + type: string + format: uri + maxLength: 2000 + scm_url: + title: SCM URL + type: string + format: uri + maxLength: 2000 + webscm_url: + title: Web SCM URL + type: string + format: uri + maxLength: 2000 + maintainers: + type: array + items: + $ref: '#/components/schemas/UserEmbedded' + readOnly: true + uniqueItems: true + subject_match: + title: Subject match + description: Regex to match the subject against if only part of emails + sent to the list belongs to this project. Will be used with + IGNORECASE and MULTILINE flags. If rules for more projects match the + first one returned from DB is chosen; empty field serves as a + default for every email which has no other match. + type: string + readOnly: true + minLength: 1 User: type: object properties: @@ -402,6 +607,24 @@ components: title: Detail type: string readOnly: true + ErrorProjectUpdate: + type: object + properties: + web_url: + title: Web URL + type: string + format: uri + readOnly: true + scm_url: + title: SCM URL + type: string + format: uri + readOnly: true + webscm_url: + title: Web SCM URL + type: string + format: uri + readOnly: true ErrorUserUpdate: type: object properties: From patchwork Tue Oct 30 11:19:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 990747 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42kq3X5qj1z9s7W for ; Tue, 30 Oct 2018 22:28:40 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="TQIVX/0a"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42kq3X4L49zF1QC for ; Tue, 30 Oct 2018 22:28:40 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="TQIVX/0a"; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=that.guru (client-ip=185.234.75.11; helo=relay004.mxroute.com; envelope-from=stephen@that.guru; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="TQIVX/0a"; dkim-atps=neutral Received: from relay004.mxroute.com (relay004.mxroute.com [185.234.75.11]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42kptD4rm1zDrSM for ; Tue, 30 Oct 2018 22:20:36 +1100 (AEDT) Received: from relay-ext1.mxrelay.co (relay-ext1.mxrelay.co [185.19.31.132]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay004.mxroute.com (Postfix) with ESMTPS id 8FF5B3F382 for ; Tue, 30 Oct 2018 11:20:03 +0000 (UTC) Received: from filter002.mxroute.com (unknown [185.133.192.179]) by relay-ext1.mxrelay.co (Postfix) with ESMTP id 4B0A23FC2D for ; Tue, 30 Oct 2018 11:19:28 +0000 (UTC) Received: from one.mxroute.com (one.mxroute.com [195.201.59.211]) by filter002.mxroute.com (Postfix) with ESMTPS id B28B73F3DB for ; Tue, 30 Oct 2018 11:19:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=MfA/zE5TJFoCMmbiBOuhrFpqWfUTfmEIAOOoRTigYu8=; b=TQIVX/0a4Hr5vHCRvZ1Pz02U8P Hn2N/LNfxCaAv3KqjjWfbgKV63JGyUyA5Eu6kAGM8/R27CFAZLXSeH54o6qVCxwBMZXvG0afu1IuV 5wmR3/rVbxgcrk1Xe71uCKqbBuyzfbYKulMPs6/sW63oz/NMUfnKDg/zqy+RdqFdxYPirq+sWWUk7 0kqkqS7KXjrWcpn33KbzutxGOHWi3mHY03QGP4GOfihtWOGz5lHsTuFAzsgmla98kxWVWgcL9Nhrx lAXdZ7qhhEvom7+5ZTHZK/zDk4ZdiU+kIeoHEmAm4dSp0GZdcridHdCfZ9+Zdt8x6mVKLSZ1SoUA8 BRTuA7fQ==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH 09/17] docs: Document the '/bundles' resource Date: Tue, 30 Oct 2018 11:19:08 +0000 Message-Id: <20181030111916.7342-10-stephen@that.guru> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030111916.7342-1-stephen@that.guru> References: <20181030111916.7342-1-stephen@that.guru> X-AuthUser: stephen@that.guru X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" This one's a little unusual too, in that we provide the embedded serializer for resources we haven't defined the end resource for. That's necessary in general, due to recursive references in the API (series-patch, patch-series etc.) so might as well embrace it early. Signed-off-by: Stephen Finucane --- docs/api/schemas/patchwork.yaml | 203 ++++++++++++++++++++++++++++++++ 1 file changed, 203 insertions(+) diff --git a/docs/api/schemas/patchwork.yaml b/docs/api/schemas/patchwork.yaml index 99a15ad4..c5c29b50 100644 --- a/docs/api/schemas/patchwork.yaml +++ b/docs/api/schemas/patchwork.yaml @@ -25,6 +25,74 @@ paths: $ref: '#/components/schemas/Index' tags: - api + /api/bundles/: + get: + description: List bundles. + operationId: bundles_list + parameters: + - $ref: '#/components/parameters/Page' + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/Order' + - $ref: '#/components/parameters/Search' + - in: query + name: project + schema: + description: '' + title: '' + type: string + - in: query + name: owner + schema: + description: '' + title: '' + type: string + - in: query + name: public + schema: + description: '' + title: '' + type: string + responses: + '200': + description: '' + headers: + Link: + $ref: '#/components/headers/Link' + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Bundle' + tags: + - bundles + /api/bundles/{id}/: + get: + description: Show a bundle. + operationId: bundles_read + parameters: + - in: path + name: id + required: true + schema: + description: '' + title: '' + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/Bundle' + '404': + description: 'Not found' + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + tags: + - bundles /api/people/: get: description: List people. @@ -442,6 +510,50 @@ components: type: string format: uri readOnly: true + Bundle: + required: + - name + type: object + properties: + id: + title: ID + type: integer + readOnly: true + url: + title: Url + type: string + format: uri + readOnly: true + web_url: + title: Web url + type: string + format: uri + readOnly: true + project: + $ref: '#/components/schemas/ProjectEmbedded' + name: + title: Name + type: string + maxLength: 50 + minLength: 1 + owner: + allOf: + - $ref: '#/components/schemas/UserEmbedded' + - title: Owner + patches: + type: array + items: + $ref: '#/components/schemas/PatchEmbedded' + readOnly: true + uniqueItems: true + public: + title: Public + type: boolean + mbox: + title: Mbox + type: string + format: uri + readOnly: true Person: type: object properties: @@ -566,6 +678,97 @@ components: format: email readOnly: true minLength: 1 + PatchEmbedded: + type: object + properties: + id: + title: ID + type: integer + readOnly: true + url: + title: Url + type: string + format: uri + readOnly: true + web_url: + title: Web url + type: string + format: uri + readOnly: true + msgid: + title: Msgid + type: string + readOnly: true + minLength: 1 + date: + title: Date + type: string + format: date-time + readOnly: true + name: + title: Name + type: string + readOnly: true + minLength: 1 + mbox: + title: Mbox + type: string + format: uri + readOnly: true + ProjectEmbedded: + type: object + properties: + id: + title: ID + type: integer + readOnly: true + url: + title: Url + type: string + format: uri + readOnly: true + name: + title: Name + type: string + readOnly: true + minLength: 1 + link_name: + title: Link name + type: string + readOnly: true + maxLength: 255 + minLength: 1 + list_id: + title: List id + type: string + readOnly: true + maxLength: 255 + minLength: 1 + list_email: + title: List email + type: string + format: email + readOnly: true + maxLength: 200 + minLength: 1 + web_url: + title: Web url + type: string + format: uri + readOnly: true + maxLength: 2000 + scm_url: + title: Scm url + type: string + format: uri + readOnly: true + maxLength: 2000 + webscm_url: + title: Webscm url + type: string + format: uri + readOnly: true + maxLength: 2000 UserEmbedded: type: object properties: From patchwork Tue Oct 30 11:19:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 990745 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42kq2P1x86z9s7W for ; Tue, 30 Oct 2018 22:27:41 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="bzR9ua/0"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42kq2P015ZzDrNx for ; Tue, 30 Oct 2018 22:27:41 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="bzR9ua/0"; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=that.guru (client-ip=185.234.75.12; helo=relay012.mxrelay.co; envelope-from=stephen@that.guru; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="bzR9ua/0"; dkim-atps=neutral Received: from relay012.mxrelay.co (relay012.mxrelay.co [185.234.75.12]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42kpsg52qKzF100 for ; Tue, 30 Oct 2018 22:20:07 +1100 (AEDT) Received: from filter001.mxrelay.co (filter001.mxrelay.co [64.52.23.203]) by relay012.mxrelay.co (Postfix) with ESMTP id EF3A93F9FE for ; Tue, 30 Oct 2018 11:19:34 +0000 (UTC) Received: from one.mxroute.com (one.mxroute.com [195.201.59.211]) by filter001.mxrelay.co (Postfix) with ESMTPS id 4C3BE100065 for ; Tue, 30 Oct 2018 11:19:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=yJNFR9M8d09anuEBP2qaB3xfCk78rNz95BbIPL4aVAA=; b=bzR9ua/0H4Iu2Elcj4Y7tiO6zO 6aT4klvEqykMCplsl1ogqlsewyzZ9A444S0HMtcQUYZAG7aj/OwbSBvir02feIp2RNePcwBDgbWrf 8wFNuDU6NdOfRKjlfKaQXs1xAewlsxdH5Whvz2G9JBtaeDExRNthHiifCBefjMU+t98hGP0sxa5OS CsZN0BleI9ZKYRC+dI1OXjj4oBVX1rypA880WGH9IForzDVf8lDYHLVT620fcZzGZstBWp3ZDCXCx 7bscF8BKb5gqxVejVcdkHDF3d3SVe/aA6wwOwbPfbBMf+2K7QZoLrZ7FjMGGUle5NgciKKZHU98WD GXR9TQMw==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH 10/17] docs: Document the '/covers' resource Date: Tue, 30 Oct 2018 11:19:09 +0000 Message-Id: <20181030111916.7342-11-stephen@that.guru> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030111916.7342-1-stephen@that.guru> References: <20181030111916.7342-1-stephen@that.guru> X-AuthUser: stephen@that.guru X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" Again, we're adding embedded serializers before the main resource but that will come. Signed-off-by: Stephen Finucane --- docs/api/schemas/patchwork.yaml | 210 ++++++++++++++++++++++++++++++++ 1 file changed, 210 insertions(+) diff --git a/docs/api/schemas/patchwork.yaml b/docs/api/schemas/patchwork.yaml index c5c29b50..3cadd35a 100644 --- a/docs/api/schemas/patchwork.yaml +++ b/docs/api/schemas/patchwork.yaml @@ -93,6 +93,76 @@ paths: $ref: '#/components/schemas/Error' tags: - bundles + /api/covers/: + get: + description: List cover letters. + operationId: covers_list + parameters: + - $ref: '#/components/parameters/Page' + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/Order' + - $ref: '#/components/parameters/Search' + - $ref: '#/components/parameters/BeforeFilter' + - $ref: '#/components/parameters/SinceFilter' + - in: query + name: project + schema: + description: '' + title: '' + type: string + - in: query + name: series + schema: + description: '' + title: '' + type: string + - in: query + name: submitter + schema: + description: '' + title: '' + type: string + responses: + '200': + description: '' + headers: + Link: + $ref: '#/components/headers/Link' + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/CoverLetterList' + tags: + - covers + /api/covers/{id}/: + get: + description: Show a cover letter. + operationId: covers_read + parameters: + - in: path + name: id + required: true + schema: + description: '' + title: '' + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/CoverLetterDetail' + '404': + description: 'Not found' + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + tags: + - covers /api/people/: get: description: List people. @@ -462,6 +532,20 @@ components: description: A search term. title: Search type: string + BeforeFilter: + in: query + name: before + schema: + description: '' + title: '' + type: string + SinceFilter: + in: query + name: since + schema: + description: '' + title: '' + type: string headers: Link: description: | @@ -554,6 +638,69 @@ components: type: string format: uri readOnly: true + CoverLetterList: + type: object + properties: + id: + title: ID + type: integer + readOnly: true + url: + title: Url + type: string + format: uri + readOnly: true + web_url: + title: Web url + type: string + format: uri + readOnly: true + project: + $ref: '#/components/schemas/ProjectEmbedded' + msgid: + title: Msgid + type: string + readOnly: true + minLength: 1 + date: + title: Date + type: string + format: date-time + readOnly: true + name: + title: Name + type: string + readOnly: true + minLength: 1 + submitter: + $ref: '#/components/schemas/PersonEmbedded' + mbox: + title: Mbox + type: string + format: uri + readOnly: true + series: + $ref: '#/components/schemas/SeriesEmbedded' + comments: + title: Comments + type: string + format: uri + readOnly: true + CoverLetterDetail: + allOf: + - $ref: '#/components/schemas/CoverLetterList' + - properties: + headers: + title: Headers + type: array + items: + type: string + readOnly: true + content: + title: Content + type: string + readOnly: true + minLength: 1 Person: type: object properties: @@ -715,6 +862,29 @@ components: type: string format: uri readOnly: true + PersonEmbedded: + type: object + properties: + id: + title: ID + type: integer + readOnly: true + url: + title: Url + type: string + format: uri + readOnly: true + name: + title: Name + type: string + readOnly: true + minLength: 1 + email: + title: Email + type: string + format: email + readOnly: true + minLength: 1 ProjectEmbedded: type: object properties: @@ -769,6 +939,46 @@ components: format: uri readOnly: true maxLength: 2000 + SeriesEmbedded: + type: object + properties: + id: + title: ID + type: integer + readOnly: true + url: + title: Url + type: string + format: uri + readOnly: true + web_url: + title: Web url + type: string + format: uri + readOnly: true + name: + title: Name + description: An optional name to associate with the series, e.g. "John's PCI + series". + type: string + readOnly: true + maxLength: 255 + x-nullable: true + date: + title: Date + type: string + format: date-time + readOnly: true + version: + title: Version + description: Version of series as indicated by the subject prefix(es) + type: integer + readOnly: true + mbox: + title: Mbox + type: string + format: uri + readOnly: true UserEmbedded: type: object properties: From patchwork Tue Oct 30 11:19:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 990750 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42kq4R06R8z9s89 for ; Tue, 30 Oct 2018 22:29:27 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="rfFFeWuh"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42kq4Q56Y0zDrNx for ; Tue, 30 Oct 2018 22:29:26 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="rfFFeWuh"; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=that.guru (client-ip=185.234.75.11; helo=relay004.mxroute.com; envelope-from=stephen@that.guru; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="rfFFeWuh"; dkim-atps=neutral Received: from relay004.mxroute.com (relay004.mxroute.com [185.234.75.11]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42kptG6RzNzF0yr for ; Tue, 30 Oct 2018 22:20:38 +1100 (AEDT) Received: from relay-ext1.mxrelay.co (relay-ext1.mxrelay.co [185.19.31.132]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay004.mxroute.com (Postfix) with ESMTPS id D7B8D3F38C for ; Tue, 30 Oct 2018 11:20:05 +0000 (UTC) Received: from filter001.mxrelay.co (filter001.mxrelay.co [64.52.23.203]) by relay-ext1.mxrelay.co (Postfix) with ESMTP id DFA203FC30 for ; Tue, 30 Oct 2018 11:19:30 +0000 (UTC) Received: from one.mxroute.com (one.mxroute.com [195.201.59.211]) by filter001.mxrelay.co (Postfix) with ESMTPS id 8DFD210007F for ; Tue, 30 Oct 2018 11:19:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=6QoH26RoBfzy//HLrTLiziechvif96JwXZ0cWYybLVA=; b=rfFFeWuhtsPuNX30JlRQHX6700 SK0S8fw4ExjV7SfTK1jDrytobFpdLenC/ebtKT2+LAPr3EUhdqycNKeE3V6LEdXwhQsY8pyjqUhJC 3sE6vBDil8KbHmaf1Pnr/bra34DPxQ+p5caCAa4zkd/MIHf9k3r29+PQD4RQIDI+JkZ4eROa51X4v 2Be5TCIKwT27TwLfwFoAHP0RjnEwG16dJQJcnuqQY5xSVXmi64cMnH0IbC1eR1b4PGTXn/MQZKsph 2VH2BdqiKOgPXX7598vEJhmjUFVfLqAhqwwfyYflKZTTk//cyksUZBGabKRa7i7ihqS1kZjwPvQ9n jr5D8liw==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH 11/17] docs: Document the '/patches' resource Date: Tue, 30 Oct 2018 11:19:10 +0000 Message-Id: <20181030111916.7342-12-stephen@that.guru> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030111916.7342-1-stephen@that.guru> References: <20181030111916.7342-1-stephen@that.guru> X-AuthUser: stephen@that.guru X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" The big one (TM). Nothing too odd here though. Signed-off-by: Stephen Finucane --- docs/api/schemas/patchwork.yaml | 351 ++++++++++++++++++++++++++++++++ 1 file changed, 351 insertions(+) diff --git a/docs/api/schemas/patchwork.yaml b/docs/api/schemas/patchwork.yaml index 3cadd35a..0763bd50 100644 --- a/docs/api/schemas/patchwork.yaml +++ b/docs/api/schemas/patchwork.yaml @@ -163,6 +163,186 @@ paths: $ref: '#/components/schemas/Error' tags: - covers + /api/patches/: + get: + description: List patches. + operationId: patches_list + parameters: + - $ref: '#/components/parameters/Page' + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/Order' + - $ref: '#/components/parameters/Search' + - $ref: '#/components/parameters/BeforeFilter' + - $ref: '#/components/parameters/SinceFilter' + - in: query + name: project + schema: + description: '' + title: '' + type: string + - in: query + name: series + schema: + description: '' + title: '' + type: string + - in: query + name: submitter + schema: + description: '' + title: '' + type: string + - in: query + name: delegate + schema: + description: '' + title: '' + type: string + - in: query + name: state + schema: + description: '' + title: '' + type: string + - in: query + name: archived + schema: + description: '' + title: '' + type: string + responses: + '200': + description: '' + headers: + Link: + $ref: '#/components/headers/Link' + content: + application/json: + schema: + $ref: '#/components/schemas/PatchList' + tags: + - patches + /api/patches/{id}/: + get: + description: Show a patch. + operationId: patches_read + parameters: + - in: path + name: id + required: true + schema: + description: '' + title: '' + type: string + tags: + - patches + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/PatchDetail' + '403': + description: 'Forbidden' + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '404': + description: 'Not found' + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + patch: + description: Update a patch (partial). + operationId: patches_partial_update + parameters: + - in: path + name: id + required: true + schema: + description: '' + title: '' + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PatchUpdate' + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/PatchDetail' + '400': + description: 'Invalid Request' + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorPatchUpdate' + '403': + description: 'Forbidden' + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '404': + description: 'Not found' + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + tags: + - patches + put: + description: Update a patch. + operationId: patches_update + parameters: + - in: path + name: id + required: true + schema: + description: '' + title: '' + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PatchUpdate' + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/PatchDetail' + '400': + description: 'Invalid Request' + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorPatchUpdate' + '403': + description: 'Forbidden' + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '404': + description: 'Not found' + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + tags: + - patches /api/people/: get: description: List people. @@ -701,6 +881,158 @@ components: type: string readOnly: true minLength: 1 + PatchList: + required: + - state + - delegate + type: object + properties: + id: + title: ID + type: integer + readOnly: true + url: + title: Url + type: string + format: uri + readOnly: true + web_url: + title: Web url + type: string + format: uri + readOnly: true + project: + $ref: '#/components/schemas/ProjectEmbedded' + msgid: + title: Msgid + type: string + readOnly: true + minLength: 1 + date: + title: Date + type: string + format: date-time + readOnly: true + name: + title: Name + type: string + readOnly: true + minLength: 1 + commit_ref: + title: Commit ref + type: string + maxLength: 255 + x-nullable: true + pull_url: + title: Pull URL + type: string + format: uri + maxLength: 255 + x-nullable: true + state: + title: State + type: string + archived: + title: Archived + type: boolean + hash: + title: Hash + type: string + readOnly: true + minLength: 1 + submitter: + allOf: + - $ref: '#/components/schemas/User' + - title: Submitter + - readOnly: true + delegate: + allOf: + - $ref: '#/components/schemas/User' + - title: Delegate + mbox: + title: Mbox + type: string + format: uri + readOnly: true + series: + $ref: '#/components/schemas/SeriesEmbedded' + comments: + title: Comments + type: string + format: uri + readOnly: true + check: + title: Check + type: string + readOnly: true + enum: + - pending + - success + - warning + - fail + checks: + title: Checks + type: string + format: uri + readOnly: true + tags: + title: Tags + type: array + items: + type: string + readOnly: true + PatchDetail: + allOf: + - $ref: '#/components/schemas/PatchList' + - properties: + headers: + title: Headers + type: array + items: + type: string + readOnly: true + content: + title: Content + type: string + readOnly: true + minLength: 1 + diff: + title: Diff + type: string + readOnly: true + minLength: 1 + prefixes: + title: Prefixes + type: array + items: + type: string + readOnly: true + PatchUpdate: + required: + - state + - delegate + type: object + properties: + commit_ref: + title: Commit ref + type: string + maxLength: 255 + x-nullable: true + pull_url: + title: Pull URL + type: string + format: uri + maxLength: 255 + x-nullable: true + state: + title: State + type: string + archived: + title: Archived + type: boolean + delegate: + title: Delegate + type: integer Person: type: object properties: @@ -1020,6 +1352,25 @@ components: title: Detail type: string readOnly: true + ErrorPatchUpdate: + type: object + properties: + state: + title: State + type: string + readOnly: true + delegate: + title: Delegate + type: string + readOnly: true + commit_ref: + title: Commit ref + type: string + readOnly: true + archived: + title: Archived + type: string + readOnly: true ErrorProjectUpdate: type: object properties: From patchwork Tue Oct 30 11:19:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 990736 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42kpyh5Zdzz9s7W for ; Tue, 30 Oct 2018 22:24:28 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="RSHUJqAx"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42kpyh37SDzF10S for ; Tue, 30 Oct 2018 22:24:28 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="RSHUJqAx"; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=that.guru (client-ip=185.234.75.13; helo=relay013.mxrelay.co; envelope-from=stephen@that.guru; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="RSHUJqAx"; dkim-atps=neutral Received: from relay013.mxrelay.co (relay013.mxrelay.co [185.234.75.13]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42kpsZ6TbMzDrPq for ; Tue, 30 Oct 2018 22:20:02 +1100 (AEDT) Received: from filter002.mxroute.com (unknown [185.133.192.179]) by relay013.mxrelay.co (Postfix) with ESMTP id 60EE642DEB for ; Tue, 30 Oct 2018 11:19:30 +0000 (UTC) Received: from one.mxroute.com (one.mxroute.com [195.201.59.211]) by filter002.mxroute.com (Postfix) with ESMTPS id 286F03F3DB for ; Tue, 30 Oct 2018 11:19:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=oK3p1hog7RBYJDTorz0ngDo+HNxDW/dMQCGy3DW73DM=; b=RSHUJqAx/8z7HuwrlTzktYUlyf T1Auhb6J/PRPASDwwU//2Lx5YPLrc2QiD22OVJYVvmWoo4EFMgpjciXQqzfQoODS5k1ua55ViXk+X xb/tU1XSs1IJujhCS0DZO5CA3+B47VCy7h8oYD6kgejeK28J5CsY8ftSYgWcIC2lSkg/e3bTgBQv9 hxwof3xbboNwBtkwEmjWaZjCj6RdWAJ+NmSUzBtL0usilF/fH2AcQ2Q+33+JYsA8mlLEOk1io9PSW FFXDWPrAGShw8qgXdDR5HPFmnwZxhNzgQkPgIkeX/M7fiyUixH5Cg8hdNtDIsJc+gH8rdRo4c9Hh0 E+debJRA==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH 12/17] docs: Document the '/series' resource Date: Tue, 30 Oct 2018 11:19:11 +0000 Message-Id: <20181030111916.7342-13-stephen@that.guru> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030111916.7342-1-stephen@that.guru> References: <20181030111916.7342-1-stephen@that.guru> X-AuthUser: stephen@that.guru X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" Signed-off-by: Stephen Finucane --- docs/api/schemas/patchwork.yaml | 166 ++++++++++++++++++++++++++++++++ 1 file changed, 166 insertions(+) diff --git a/docs/api/schemas/patchwork.yaml b/docs/api/schemas/patchwork.yaml index 0763bd50..be5834a3 100644 --- a/docs/api/schemas/patchwork.yaml +++ b/docs/api/schemas/patchwork.yaml @@ -531,6 +531,70 @@ paths: $ref: '#/components/schemas/Error' tags: - projects + /api/series/: + get: + description: List series. + operationId: series_list + parameters: + - $ref: '#/components/parameters/Page' + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/Order' + - $ref: '#/components/parameters/Search' + - $ref: '#/components/parameters/BeforeFilter' + - $ref: '#/components/parameters/SinceFilter' + - in: query + name: submitter + schema: + description: '' + title: '' + type: string + - in: query + name: project + schema: + description: '' + title: '' + type: string + responses: + '200': + description: '' + headers: + Link: + $ref: '#/components/headers/Link' + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Series' + tags: + - series + /api/series/{id}/: + get: + description: Show a series. + operationId: series_read + parameters: + - in: path + name: id + required: true + schema: + description: '' + title: '' + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/Series' + '404': + description: 'Not found' + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + tags: + - series /api/users/: get: description: List users. @@ -1125,6 +1189,71 @@ components: type: string readOnly: true minLength: 1 + Series: + type: object + properties: + id: + title: ID + type: integer + readOnly: true + url: + title: Url + type: string + format: uri + readOnly: true + web_url: + title: Web url + type: string + format: uri + readOnly: true + project: + $ref: '#/components/schemas/ProjectEmbedded' + name: + title: Name + description: An optional name to associate with the series, e.g. "John's PCI + series". + type: string + maxLength: 255 + x-nullable: true + date: + title: Date + type: string + format: date-time + readOnly: true + submitter: + title: Submitter + type: integer + readOnly: true + version: + title: Version + description: Version of series as indicated by the subject prefix(es) + type: integer + total: + title: Total + description: Number of patches in series as indicated by the subject prefix(es) + type: integer + readOnly: true + received_total: + title: Received total + type: integer + readOnly: true + received_all: + title: Received all + type: boolean + readOnly: true + mbox: + title: Mbox + type: string + format: uri + readOnly: true + cover_letter: + $ref: '#/components/schemas/CoverLetterEmbedded' + patches: + type: array + items: + $ref: '#/components/schemas/PatchEmbedded' + readOnly: true + uniqueItems: true User: type: object properties: @@ -1157,6 +1286,43 @@ components: format: email readOnly: true minLength: 1 + CoverLetterEmbedded: + type: object + properties: + id: + title: ID + type: integer + readOnly: true + url: + title: Url + type: string + format: uri + readOnly: true + web_url: + title: Web url + type: string + format: uri + readOnly: true + msgid: + title: Msgid + type: string + readOnly: true + minLength: 1 + date: + title: Date + type: string + format: date-time + readOnly: true + name: + title: Name + type: string + readOnly: true + minLength: 1 + mbox: + title: Mbox + type: string + format: uri + readOnly: true PatchEmbedded: type: object properties: From patchwork Tue Oct 30 11:19:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 990748 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42kq400Mxtz9s89 for ; Tue, 30 Oct 2018 22:29:04 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="nWxq1dJA"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42kq3z5NPczF1Q2 for ; Tue, 30 Oct 2018 22:29:03 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="nWxq1dJA"; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=that.guru (client-ip=185.234.75.11; helo=relay004.mxroute.com; envelope-from=stephen@that.guru; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="nWxq1dJA"; dkim-atps=neutral Received: from relay004.mxroute.com (relay004.mxroute.com [185.234.75.11]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42kptG062wzDrPq for ; Tue, 30 Oct 2018 22:20:37 +1100 (AEDT) Received: from relay-ext1.mxrelay.co (relay-ext1.mxrelay.co [185.19.31.132]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay004.mxroute.com (Postfix) with ESMTPS id C915B3F38A for ; Tue, 30 Oct 2018 11:20:04 +0000 (UTC) Received: from filter002.mxroute.com (unknown [185.133.192.179]) by relay-ext1.mxrelay.co (Postfix) with ESMTP id DEDFA3FC2F for ; Tue, 30 Oct 2018 11:19:29 +0000 (UTC) Received: from one.mxroute.com (one.mxroute.com [195.201.59.211]) by filter002.mxroute.com (Postfix) with ESMTPS id 551123F546 for ; Tue, 30 Oct 2018 11:19:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=hqE+U29TXygpNhHQDHXZ7xiJbo82tAvmnBLrgVfVexY=; b=nWxq1dJASXMP1DTkjNAb9UZNUE bEPg+gXZHxI5od3hJb3z2+ugXsn2uAgyY3IdVVR33TDgrB1VTiSbYhQX6/oIfwzO3qP+OseQuaH5O WubKRFLd4P0MJAUMDONM5fyZ0/Rgc42DPD0fUTj4xefXL/r1aoQJNcuVQLODAOmGFZinEki5G5xNX P0shzZPRfeRb8mItLDMCR4zXVhIKVyOr3wspE9hSyc7ThDtTHVLA1bbzNxtmgyCY5Z7ZN1kdhgNfP utwM+QJoVgFf0ywi+wA07rWsXntqA6zuNtLosV5bFe1GYYnWd3bckLbrRzJlRk/ruif1Hnvs9DTP3 6jBPF4XQ==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH 13/17] docs: Document the '/covers/{coverID}/comments' resource Date: Tue, 30 Oct 2018 11:19:12 +0000 Message-Id: <20181030111916.7342-14-stephen@that.guru> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030111916.7342-1-stephen@that.guru> References: <20181030111916.7342-1-stephen@that.guru> X-AuthUser: stephen@that.guru X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" Our first nested resource. Nothing too weird here though, save for the raising of a HTTP 404 on a list resource (due to a missing patch). Signed-off-by: Stephen Finucane --- docs/api/schemas/patchwork.yaml | 75 +++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/docs/api/schemas/patchwork.yaml b/docs/api/schemas/patchwork.yaml index be5834a3..d9044624 100644 --- a/docs/api/schemas/patchwork.yaml +++ b/docs/api/schemas/patchwork.yaml @@ -163,6 +163,40 @@ paths: $ref: '#/components/schemas/Error' tags: - covers + /api/covers/{id}/comments/: + get: + description: List comments + operationId: cover_comments_list + parameters: + - in: path + name: id + required: true + schema: + description: '' + title: '' + type: string + - $ref: '#/components/parameters/Page' + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/Order' + - $ref: '#/components/parameters/Search' + responses: + '200': + description: '' + headers: + Link: + $ref: '#/components/headers/Link' + content: + application/json: + schema: + $ref: '#/components/schemas/CommentList' + '404': + description: 'Not found' + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + tags: + - comments /api/patches/: get: description: List patches. @@ -882,6 +916,47 @@ components: type: string format: uri readOnly: true + CommentList: + type: object + properties: + id: + title: ID + type: integer + readOnly: true + web_url: + title: Web url + type: string + format: uri + readOnly: true + msgid: + title: Msgid + type: string + readOnly: true + minLength: 1 + date: + title: Date + type: string + format: date-time + readOnly: true + subject: + title: Subject + type: string + readOnly: true + submitter: + allOf: + - $ref: '#/components/schemas/User' + - title: Submitter + content: + title: Content + type: string + readOnly: true + minLength: 1 + headers: + title: Headers + type: array + items: + type: string + readOnly: true CoverLetterList: type: object properties: From patchwork Tue Oct 30 11:19:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 990737 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42kpzN0jRWz9s7W for ; Tue, 30 Oct 2018 22:25:04 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="coiuqSWW"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42kpzM5Y78zDqfH for ; Tue, 30 Oct 2018 22:25:03 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="coiuqSWW"; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=that.guru (client-ip=185.234.75.2; helo=relay-direct2.mxroute.com; envelope-from=stephen@that.guru; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="coiuqSWW"; dkim-atps=neutral Received: from relay-direct2.mxroute.com (relay-direct2.mxroute.com [185.234.75.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42kpsc0WrgzDqfS for ; Tue, 30 Oct 2018 22:20:03 +1100 (AEDT) Received: from filter002.mxroute.com (unknown [185.133.192.179]) by relay-direct2.mxroute.com (Postfix) with ESMTP id 4077A3F345 for ; Tue, 30 Oct 2018 11:19:31 +0000 (UTC) Received: from one.mxroute.com (one.mxroute.com [195.201.59.211]) by filter002.mxroute.com (Postfix) with ESMTPS id 24C563F3DB for ; Tue, 30 Oct 2018 11:19:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Lnx2b/D48Y1qz7iMWHb1eFEoSdRSFJ7agXfkYE5zzfo=; b=coiuqSWWbUpT7doidCUl8TdOW0 nvjz7UfP/roHPv7xXXMammoOvLGF6yYK2/ia+INfN8oqgB8i8UtFwRp0bi1wgyv9HtxYW3dRByjPn ePmZUG4bIoHktJnte/qdjfKzqdf+zA3/K/2agwaGYSNmX2UOYWM0Wdtnu7leV/8WgqWrGe6yslCMx tDNqEjd7IFNtkrKG85c7moMygKlRK3qhXyOcEmBmy/5XZG/9ifJ1YkfkYPq/0WltxuqQIEiYzAK02 ssQexQCIFf6eaa8siUWix+cdyBRJmdwKQKzi8hAurzXe+G98ei+JslFN8r8YXWVk8ABU1opaLDfdS vJRbG1NQ==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH 14/17] docs: Document the '/patch/{patchID}/comments' resource Date: Tue, 30 Oct 2018 11:19:13 +0000 Message-Id: <20181030111916.7342-15-stephen@that.guru> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030111916.7342-1-stephen@that.guru> References: <20181030111916.7342-1-stephen@that.guru> X-AuthUser: stephen@that.guru X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" Signed-off-by: Stephen Finucane --- docs/api/schemas/patchwork.yaml | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/docs/api/schemas/patchwork.yaml b/docs/api/schemas/patchwork.yaml index d9044624..bb66c8a9 100644 --- a/docs/api/schemas/patchwork.yaml +++ b/docs/api/schemas/patchwork.yaml @@ -377,6 +377,40 @@ paths: $ref: '#/components/schemas/Error' tags: - patches + /api/patches/{id}/comments/: + get: + description: List comments + operationId: patch_comments_list + parameters: + - in: path + name: id + required: true + schema: + description: '' + title: '' + type: string + - $ref: '#/components/parameters/Page' + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/Order' + - $ref: '#/components/parameters/Search' + responses: + '200': + description: '' + headers: + Link: + $ref: '#/components/headers/Link' + content: + application/json: + schema: + $ref: '#/components/schemas/CommentList' + '404': + description: 'Not found' + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + tags: + - comments /api/people/: get: description: List people. From patchwork Tue Oct 30 11:19:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 990740 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42kq0r3MZqz9s7W for ; Tue, 30 Oct 2018 22:26:20 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="AytH6ybu"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42kq0r1Dr6zF0yr for ; Tue, 30 Oct 2018 22:26:20 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="AytH6ybu"; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=that.guru (client-ip=185.234.75.17; helo=relay017.mxrelay.co; envelope-from=stephen@that.guru; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="AytH6ybu"; dkim-atps=neutral Received: from relay017.mxrelay.co (relay017.mxrelay.co [185.234.75.17]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42kpsc2nZWzDsG1 for ; Tue, 30 Oct 2018 22:20:04 +1100 (AEDT) Received: from filter002.mxroute.com (unknown [185.133.192.179]) by relay017.mxrelay.co (Postfix) with ESMTP id A5BF242C61 for ; Tue, 30 Oct 2018 11:19:31 +0000 (UTC) Received: from one.mxroute.com (one.mxroute.com [195.201.59.211]) by filter002.mxroute.com (Postfix) with ESMTPS id 8B00B3F3DB for ; Tue, 30 Oct 2018 11:19:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=VIgPHxSlPrssk1ojVGjG3ai15B6xTsaQR/TChEUYAo4=; b=AytH6ybuXw93Jhfb2W1Loj2By7 Bh644X3NVcSpm0jdIMManCN7ucvDnaIRZzgTUI8W82+gTzyQo1yDWANyKgMOzI8mLqSExVjg3+pFG UI+8BblI0obKUsWUBFl03NPI7yWjXBONFIVM8feMTq4viL63oa44o+5rYXNrPNqIXgihU6HIz/APi t3mTGQTrgfmI8xxcJbuody+5TpvgmcYWMnyV6y/doanPQAYkdMtPI88VMGXfs74pHR6+FMP3dttcN 224mbgL3nXNpa6skYOz0XEUzvxmrP4BEpyLtLN3n33415QhHrRT9YQ3Ev9sZQPCUSz4I60AMF12+a QR4AJM6Q==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH 15/17] docs: Document the '/patches/{patchID}/checks' resource Date: Tue, 30 Oct 2018 11:19:14 +0000 Message-Id: <20181030111916.7342-16-stephen@that.guru> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030111916.7342-1-stephen@that.guru> References: <20181030111916.7342-1-stephen@that.guru> X-AuthUser: stephen@that.guru X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" Signed-off-by: Stephen Finucane --- docs/api/schemas/patchwork.yaml | 235 ++++++++++++++++++++++++++++++++ 1 file changed, 235 insertions(+) diff --git a/docs/api/schemas/patchwork.yaml b/docs/api/schemas/patchwork.yaml index bb66c8a9..c2064985 100644 --- a/docs/api/schemas/patchwork.yaml +++ b/docs/api/schemas/patchwork.yaml @@ -411,6 +411,140 @@ paths: $ref: '#/components/schemas/Error' tags: - comments + /api/patches/{patch_id}/checks/: + get: + description: List checks. + operationId: checks_list + parameters: + - in: path + name: patch_id + required: true + schema: + description: '' + title: '' + type: string + - $ref: '#/components/parameters/Page' + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/Order' + - $ref: '#/components/parameters/Search' + - $ref: '#/components/parameters/BeforeFilter' + - $ref: '#/components/parameters/SinceFilter' + - in: query + name: user + schema: + description: '' + title: '' + type: string + - in: query + name: state + schema: + description: '' + title: '' + type: string + - in: query + name: context + schema: + description: '' + title: '' + type: string + responses: + '200': + description: '' + headers: + Link: + $ref: '#/components/headers/Link' + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Check' + '404': + description: 'Not found' + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + tags: + - checks + post: + description: Create a check. + operationId: checks_create + parameters: + - in: path + name: patch_id + required: true + schema: + description: '' + title: '' + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CheckUpdate' + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/Check' + '400': + description: 'Invalid Request' + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorCheckCreate' + '403': + description: 'Forbidden' + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '404': + description: 'Not found' + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + tags: + - checks + /api/patches/{patch_id}/checks/{check_id}/: + get: + description: Show a check. + operationId: checks_read + parameters: + - in: path + name: patch_id + required: true + schema: + description: '' + title: '' + type: string + - in: path + name: check_id + required: true + schema: + description: '' + title: '' + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/Check' + '404': + description: 'Not found' + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + tags: + - checks /api/people/: get: description: List people. @@ -950,6 +1084,88 @@ components: type: string format: uri readOnly: true + Check: + type: object + properties: + id: + title: ID + type: integer + readOnly: true + url: + title: Url + type: string + format: uri + readOnly: true + user: + $ref: '#/components/schemas/UserEmbedded' + date: + title: Date + type: string + format: date-time + readOnly: true + state: + title: State + description: The state of the check. + type: string + enum: + - pending + - success + - warning + - fail + target_url: + title: Target URL + description: The target URL to associate with this check. This should be specific + to the patch. + type: string + format: uri + maxLength: 200 + x-nullable: true + context: + title: Context + description: A label to discern check from checks of other testing systems. + type: string + format: slug + pattern: ^[-a-zA-Z0-9_]+$ + maxLength: 255 + minLength: 1 + description: + title: Description + description: A brief description of the check. + type: string + x-nullable: true + CheckUpdate: + type: object + properties: + state: + title: State + description: The state of the check. + type: string + enum: + - pending + - success + - warning + - fail + target_url: + title: Target url + description: The target URL to associate with this check. This should be specific + to the patch. + type: string + format: uri + maxLength: 200 + x-nullable: true + context: + title: Context + description: A label to discern check from checks of other testing systems. + type: string + format: slug + pattern: ^[-a-zA-Z0-9_]+$ + maxLength: 255 + minLength: 1 + description: + title: Description + description: A brief description of the check. + type: string + x-nullable: true CommentList: type: object properties: @@ -1627,6 +1843,25 @@ components: title: Detail type: string readOnly: true + ErrorCheckCreate: + type: object + properties: + state: + title: State + type: string + readOnly: true + target_url: + title: Target URL + type: string + readOnly: true + context: + title: Context + type: string + readOnly: true + description: + title: Description + type: string + readOnly: true ErrorPatchUpdate: type: object properties: From patchwork Tue Oct 30 11:19:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 990746 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42kq2z2CsKz9s7W for ; Tue, 30 Oct 2018 22:28:11 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="SGxqkSyn"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42kq2z0cNBzDsG1 for ; Tue, 30 Oct 2018 22:28:11 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="SGxqkSyn"; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=that.guru (client-ip=185.234.75.10; helo=relay003.mxroute.com; envelope-from=stephen@that.guru; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="SGxqkSyn"; dkim-atps=neutral Received: from relay003.mxroute.com (relay003.mxroute.com [185.234.75.10]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42kpsl1XC2zDsGh for ; Tue, 30 Oct 2018 22:20:11 +1100 (AEDT) Received: from relay-ext2.mxrelay.co (relay-ext2.mxrelay.co [159.100.240.208]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay004.mxroute.com (Postfix) with ESMTPS id C61DF3F387 for ; Tue, 30 Oct 2018 11:19:38 +0000 (UTC) Received: from filter001.mxrelay.co (filter001.mxrelay.co [64.52.23.203]) by relay-ext2.mxrelay.co (Postfix) with ESMTP id 5D0033FC3F for ; Tue, 30 Oct 2018 11:19:34 +0000 (UTC) Received: from one.mxroute.com (one.mxroute.com [195.201.59.211]) by filter001.mxrelay.co (Postfix) with ESMTPS id 3C97D10007F for ; Tue, 30 Oct 2018 11:19:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=uyJjafKW0aJ8S5HA67QlZ5FtQVawDTmzZa70MWPHPyk=; b=SGxqkSyngd7C+Vz92aUq9zN7FP 4EhwhZgj13RKozCnKNrl0w4XZw9wca7ak2rp3suNmrio7NRPOztXMf2lDbpDRQyIXF/qrxtapzq34 Xh+pPhNYrkWTONC7aLO5wo0kOotCZph/1fxcfyn9JzECE0KGNYhgIeuB4tI0W0FBHZNdvDItmV6QA M7yzJos1fqKfuG0b/J2WbQGOSILdYtlzyzV2unQccESFpENNELppgXLfFKOmVQQk3VtJfx11SA+6R OU1Pgd2NbMbNZYC+luoJjaZb9fnBKbG/lDAQuL3kqiwNJqLLbGVUc4GzVTIhgLzMZg+J4VWs7lsvF 2jLszEag==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH 16/17] docs: Document the '/events' resource Date: Tue, 30 Oct 2018 11:19:15 +0000 Message-Id: <20181030111916.7342-17-stephen@that.guru> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030111916.7342-1-stephen@that.guru> References: <20181030111916.7342-1-stephen@that.guru> X-AuthUser: stephen@that.guru X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" This is the final resource to document and also the most complicated, on account of the polymorphism of the responses. However, with this done, our first pass at an OpenAPI 3.0 schema is completed. Signed-off-by: Stephen Finucane --- docs/api/schemas/patchwork.yaml | 266 ++++++++++++++++++++++++++++++++ 1 file changed, 266 insertions(+) diff --git a/docs/api/schemas/patchwork.yaml b/docs/api/schemas/patchwork.yaml index c2064985..cf78a87f 100644 --- a/docs/api/schemas/patchwork.yaml +++ b/docs/api/schemas/patchwork.yaml @@ -197,6 +197,89 @@ paths: $ref: '#/components/schemas/Error' tags: - comments + /api/events/: + get: + description: List events. + operationId: events_list + parameters: + - $ref: '#/components/parameters/Page' + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/Order' + - $ref: '#/components/parameters/Search' + - $ref: '#/components/parameters/BeforeFilter' + - $ref: '#/components/parameters/SinceFilter' + - in: query + name: project + schema: + description: '' + title: '' + type: string + - in: query + name: category + schema: + description: '' + title: '' + type: string + enum: + - cover-created + - patch-created + - patch-completed + - patch-state-changed + - patch-delegated + - check-created + - series-created + - series-completed + - in: query + name: series + schema: + description: '' + title: '' + type: string + - in: query + name: patch + schema: + description: '' + title: '' + type: string + - in: query + name: cover + schema: + description: '' + title: '' + type: string + responses: + '200': + description: '' + headers: + Link: + $ref: '#/components/headers/Link' + content: + application/json: + schema: + type: array + items: + oneOf: + - $ref: '#/components/schemas/EventCoverCreated' + - $ref: '#/components/schemas/EventPatchCreated' + - $ref: '#/components/schemas/EventPatchCompleted' + - $ref: '#/components/schemas/EventPatchStateChanged' + - $ref: '#/components/schemas/EventPatchDelegated' + - $ref: '#/components/schemas/EventCheckCreated' + - $ref: '#/components/schemas/EventSeriesCreated' + - $ref: '#/components/schemas/EventSeriesCompleted' + discriminator: + propertyName: category + mapping: + cover-created: '#/components/schemas/EventCoverCreated' + patch-created: '#/components/schemas/EventPatchCreated' + patch-completed: '#/components/schemas/EventPatchCompleted' + patch-state-changed: '#/components/schemas/EventPatchStateChanged' + patch-delegated: '#/components/schemas/EventPatchDelegated' + check-created: '#/components/schemas/EventCheckCreated' + series-created: '#/components/schemas/EventSeriesCreated' + series-completed: '#/components/schemas/EventSeriesCompleted' + tags: + - events /api/patches/: get: description: List patches. @@ -1270,6 +1353,144 @@ components: type: string readOnly: true minLength: 1 + EventBase: + type: object + properties: + id: + title: ID + type: integer + readOnly: true + category: + title: Category + description: The category of the event. + type: string + readOnly: true + project: + $ref: '#/components/schemas/ProjectEmbedded' + date: + title: Date + description: The time this event was created. + type: string + format: date-time + readOnly: true + payload: + type: object + EventCoverCreated: + allOf: + - $ref: '#/components/schemas/EventBase' + - type: object + properties: + category: + enum: + - cover-created + payload: + properties: + cover: + title: Cover + type: string + readOnly: true + EventPatchCreated: + allOf: + - $ref: '#/components/schemas/EventBase' + - type: object + properties: + category: + enum: + - patch-created + payload: + properties: + patch: + $ref: '#/components/schemas/PatchEmbedded' + EventPatchCompleted: + allOf: + - $ref: '#/components/schemas/EventBase' + - type: object + properties: + category: + enum: + - patch-completed + payload: + properties: + patch: + $ref: '#/components/schemas/PatchEmbedded' + series: + $ref: '#/components/schemas/SeriesEmbedded' + EventPatchStateChanged: + allOf: + - $ref: '#/components/schemas/EventBase' + - type: object + properties: + category: + enum: + - patch-state-changed + payload: + properties: + patch: + $ref: '#/components/schemas/PatchEmbedded' + previous_state: + title: Previous state + type: string + current_state: + title: Current state + type: string + EventPatchDelegated: + allOf: + - $ref: '#/components/schemas/EventBase' + - type: object + properties: + category: + enum: + - patch-delegated + payload: + properties: + patch: + $ref: '#/components/schemas/PatchEmbedded' + previous_delegate: + allOf: + - $ref: '#/components/schemas/UserEmbedded' + - title: Previous delegate + current_delegate: + allOf: + - $ref: '#/components/schemas/UserEmbedded' + - title: Current delegate + EventCheckCreated: + allOf: + - $ref: '#/components/schemas/EventBase' + - type: object + properties: + category: + enum: + - check-created + payload: + properties: + patch: + $ref: '#/components/schemas/PatchEmbedded' + check: + $ref: '#/components/schemas/CheckEmbedded' + EventSeriesCreated: + allOf: + - $ref: '#/components/schemas/EventBase' + - type: object + properties: + category: + enum: + - series-created + payload: + properties: + series: + $ref: '#/components/schemas/SeriesEmbedded' + EventSeriesCompleted: + allOf: + - $ref: '#/components/schemas/EventBase' + - type: object + properties: + category: + enum: + - series-completed + payload: + properties: + series: + $ref: '#/components/schemas/SeriesEmbedded' PatchList: required: - state @@ -1611,6 +1832,51 @@ components: format: email readOnly: true minLength: 1 + CheckEmbedded: + type: object + properties: + id: + title: ID + type: integer + readOnly: true + url: + title: Url + type: string + format: uri + readOnly: true + date: + title: Date + type: string + format: date-time + readOnly: true + state: + title: State + description: The state of the check. + type: string + readOnly: true + enum: + - pending + - success + - warning + - fail + target_url: + title: Target url + description: The target URL to associate with this check. This should be specific + to the patch. + type: string + format: uri + maxLength: 200 + x-nullable: true + readOnly: true + context: + title: Context + description: A label to discern check from checks of other testing systems. + type: string + format: slug + pattern: ^[-a-zA-Z0-9_]+$ + maxLength: 255 + minLength: 1 + readOnly: true CoverLetterEmbedded: type: object properties: From patchwork Tue Oct 30 11:19:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 990741 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42kq1H2XGQz9s7W for ; Tue, 30 Oct 2018 22:26:43 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="CeYyx75r"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42kq1H0yjTzDrPc for ; Tue, 30 Oct 2018 22:26:43 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="CeYyx75r"; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=that.guru (client-ip=185.234.75.17; helo=relay017.mxrelay.co; envelope-from=stephen@that.guru; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="CeYyx75r"; dkim-atps=neutral Received: from relay017.mxrelay.co (relay017.mxrelay.co [185.234.75.17]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42kpsc6hG3zF0RC for ; Tue, 30 Oct 2018 22:20:04 +1100 (AEDT) Received: from filter002.mxroute.com (unknown [185.133.192.179]) by relay017.mxrelay.co (Postfix) with ESMTP id 5A9B742C62 for ; Tue, 30 Oct 2018 11:19:32 +0000 (UTC) Received: from one.mxroute.com (one.mxroute.com [195.201.59.211]) by filter002.mxroute.com (Postfix) with ESMTPS id 3F4DE3F546 for ; Tue, 30 Oct 2018 11:19:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=X1rNYXJCKpvDt9XRZ7fvyQCkeyqdfuWaMHECveN2Dqw=; b=CeYyx75rquXQZfh17Uiva8bX2e 245A4oNBfyAuTw8CY6J9d5g5L2HoFYTi5W9t5T4CFoX+cbcTvK8Ql2Z7RVTaUL5HygeFZ6tlx7dD5 uOsqhV2IHiJvnzUXQGNeMkpHI9YdQo+CA3INTca8gaIZZ0xcdDi8AsarywQXnr37MJnO9iD1f67es ZEEOcTZiojwLjgVTreXAFGKtlis+32H78rMwa0bNJn5+RZy+oe1kM6hKEDY8Dw+mDYvk0ZEEKRAvB YNBsWZKqxpDsREbB6X1zZ22egIVI0uB+H5nOetrNuNcxKqCQSkUTBk7Li6lnjRf5wADb0XBXOt3+D k+yWtVXw==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH 17/17] docs: Make API document versioned Date: Tue, 30 Oct 2018 11:19:16 +0000 Message-Id: <20181030111916.7342-18-stephen@that.guru> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030111916.7342-1-stephen@that.guru> References: <20181030111916.7342-1-stephen@that.guru> X-AuthUser: stephen@that.guru X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" OpenAPI doesn't appear to support versioning natively, suggesting instead that separate documents are kept. Rather than doing this manually, let's use a templating tool - Jinja2, in this case - to generate these document for us from a single master document. Signed-off-by: Stephen Finucane --- .gitignore | 1 + docs/api/schemas/generate_schema.py | 29 +++++++++++++++++ .../schemas/{patchwork.yaml => patchwork.j2} | 31 +++++++++++++++++-- 3 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 docs/api/schemas/generate_schema.py rename docs/api/schemas/{patchwork.yaml => patchwork.j2} (98%) diff --git a/.gitignore b/.gitignore index a33d1029..da53b382 100644 --- a/.gitignore +++ b/.gitignore @@ -44,6 +44,7 @@ htmlcov/ # Sphinx stuff /docs/_build +/docs/api/schemas/v* # Selenium test artifacts /selenium.log diff --git a/docs/api/schemas/generate_schema.py b/docs/api/schemas/generate_schema.py new file mode 100644 index 00000000..65d4ed82 --- /dev/null +++ b/docs/api/schemas/generate_schema.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 + +import os + +import jinja2 + +ROOT_DIR = os.path.dirname(os.path.realpath(__file__)) +VERSIONS = [(1, 0), (1, 1)] + + +def generate_schema(): + env = jinja2.Environment( + loader=jinja2.FileSystemLoader(ROOT_DIR), + trim_blocks=True, + lstrip_blocks=True) + template = env.get_template('patchwork.j2') + + for version in VERSIONS: + version_dir = os.path.join(ROOT_DIR, 'v%d.%d' % version) + + if not os.path.exists(version_dir): + os.mkdir(version_dir) + + with open(os.path.join(version_dir, 'patchwork.yaml'), 'wb') as fh: + template.stream(version=version).dump(fh, encoding='utf-8') + + +if __name__ == '__main__': + generate_schema() diff --git a/docs/api/schemas/patchwork.yaml b/docs/api/schemas/patchwork.j2 similarity index 98% rename from docs/api/schemas/patchwork.yaml rename to docs/api/schemas/patchwork.j2 index cf78a87f..752a9c5e 100644 --- a/docs/api/schemas/patchwork.yaml +++ b/docs/api/schemas/patchwork.j2 @@ -1,3 +1,6 @@ +{# You can obviously ignore the below when editing this template #} +# DO NOT EDIT THIS FILE. It is generated from a template. Changes should be +# proposed against the template. openapi: '3.0.0' info: title: Patchwork API @@ -9,7 +12,7 @@ info: license: name: GPL v2 License url: https://www.gnu.org/licenses/gpl-2.0.html - version: '1.1' + version: '{{ "%d.%d"|format(*version) }}' paths: /api/: get: @@ -1137,11 +1140,13 @@ components: type: string format: uri readOnly: true +{% if version == '1.0' %} web_url: title: Web url type: string format: uri readOnly: true +{% endif %} project: $ref: '#/components/schemas/ProjectEmbedded' name: @@ -1256,11 +1261,13 @@ components: title: ID type: integer readOnly: true +{% if version > (1, 0) %} web_url: title: Web url type: string format: uri readOnly: true +{% endif %} msgid: title: Msgid type: string @@ -1302,11 +1309,13 @@ components: type: string format: uri readOnly: true +{% if version > (1, 0) %} web_url: title: Web url type: string format: uri readOnly: true +{% endif %} project: $ref: '#/components/schemas/ProjectEmbedded' msgid: @@ -1326,18 +1335,22 @@ components: minLength: 1 submitter: $ref: '#/components/schemas/PersonEmbedded' +{% if version > (1, 0) %} mbox: title: Mbox type: string format: uri readOnly: true +{% endif %} series: $ref: '#/components/schemas/SeriesEmbedded' +{% if version > (1, 0) %} comments: title: Comments type: string format: uri readOnly: true +{% endif %} CoverLetterDetail: allOf: - $ref: '#/components/schemas/CoverLetterList' @@ -1506,11 +1519,13 @@ components: type: string format: uri readOnly: true +{% if version > (1, 0) %} web_url: title: Web url type: string format: uri readOnly: true +{% endif %} project: $ref: '#/components/schemas/ProjectEmbedded' msgid: @@ -1566,11 +1581,13 @@ components: readOnly: true series: $ref: '#/components/schemas/SeriesEmbedded' +{% if version > (1, 0) %} comments: title: Comments type: string format: uri readOnly: true +{% endif %} check: title: Check type: string @@ -1725,6 +1742,7 @@ components: $ref: '#/components/schemas/UserEmbedded' readOnly: true uniqueItems: true +{% if version > (1, 0) %} subject_match: title: Subject match description: Regex to match the subject against if only part of emails @@ -1735,6 +1753,7 @@ components: type: string readOnly: true minLength: 1 +{% endif %} Series: type: object properties: @@ -1747,11 +1766,13 @@ components: type: string format: uri readOnly: true +{% if version > (1, 0) %} web_url: title: Web url type: string format: uri readOnly: true +{% endif %} project: $ref: '#/components/schemas/ProjectEmbedded' name: @@ -1889,11 +1910,13 @@ components: type: string format: uri readOnly: true +{% if version > (1, 0) %} web_url: title: Web url type: string format: uri readOnly: true +{% endif %} msgid: title: Msgid type: string @@ -1926,11 +1949,13 @@ components: type: string format: uri readOnly: true +{% if version > (1, 0) %} web_url: title: Web url type: string format: uri readOnly: true +{% endif %} msgid: title: Msgid type: string @@ -2040,11 +2065,13 @@ components: type: string format: uri readOnly: true +{% if version > (1, 0) %} web_url: title: Web url type: string format: uri readOnly: true +{% endif %} name: title: Name description: An optional name to associate with the series, e.g. "John's PCI @@ -2177,4 +2204,4 @@ components: type: string readOnly: true servers: -- url: 'https://patchwork.ozlabs.org/api/1.1' +- url: 'https://patchwork.ozlabs.org/api/{{ "%d.%d"|format(*version) }}'