From nobody Thu Dec 26 20:45:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=patchew-devel-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1520526156264103.68434742215493; Thu, 8 Mar 2018 08:22:36 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 57A8AC0587EC; Thu, 8 Mar 2018 16:22:35 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 380FB5C20D; Thu, 8 Mar 2018 16:22:35 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 279AA1808850; Thu, 8 Mar 2018 16:22:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w28GMYnY002786 for ; Thu, 8 Mar 2018 11:22:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id B5F84BA40; Thu, 8 Mar 2018 16:22:34 +0000 (UTC) Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B08F0BA5D for ; Thu, 8 Mar 2018 16:22:31 +0000 (UTC) Received: from mail-pf0-f194.google.com (mail-pf0-f194.google.com [209.85.192.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4E07161473 for ; Thu, 8 Mar 2018 16:22:30 +0000 (UTC) Received: by mail-pf0-f194.google.com with SMTP id a16so77556pfn.9 for ; Thu, 08 Mar 2018 08:22:30 -0800 (PST) Received: from localhost.localdomain ([112.196.135.56]) by smtp.gmail.com with ESMTPSA id l74sm24658453pga.33.2018.03.08.08.22.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Mar 2018 08:22:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Vez5Qety790hiovC+lpMzolBl9PuI67hilOM30/587k=; b=mGUbvk0hMvKtO2on/2ZH0aOaHWnpM077ABqNmbWY/nVcIefy4CKIATmvF/gdxWZKVI 2Wu1ghZseDuQtcqhL5hTgNyyfP0CYrBpXR+B9Yksq9W/v9NpfxPFLScZ9YxvlpH6b0oA uoFhbi6VF2GVZyS+44sBjie2Lw894+nV7piHfuItsd56AzouUtLQudkCjD4dWJRwJB6z HSL6SdxQQGmDpVs1xGojh59DHNVUdfx/xkwwEpNZoaxzfMaS6zuTV8YcMXRMYzZunKXg feVA8pdKg0AMcvPBGLhaFFV+faKoCLt1secf0X7Z4x0ko+rAcCdTKk9LjPEFmwSgE3pW km9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Vez5Qety790hiovC+lpMzolBl9PuI67hilOM30/587k=; b=AWwsKcAKfwh6YV0/JDbpI/YzEgJtlXvCd1pzLIcg8ie/TpWzzvBwzErnkTfoTj37l3 cvS9YnggWeEFoSfCHB2qGNwe1myei71/Q9RAjTLbleA/Tz0cOv6K+NIEJ9YQ9g542uQ2 no8LvPU9CFYCqanKClw5LFpYloJT3/bD3vhqaaLXiVYN8ohXZ930v/iQreKOgSvRyrOf BmK72XCtrwn2+TAzsArFLEUvFTDRc2lAJq+45BiGhDnlP+LgdGWvC78w7MIJ4RUshadS nkZcrzHAjXijacEMr/cckUv2yGIxpprxBNJ8c5kkXHev8ocBBffUlAdxRbd/h+A7eQCL kW3A== X-Gm-Message-State: APf1xPBw4DgNHoDDq8DVBJ/fyFZezbZwClp/X6WIwn4o452UvUSHofEx iZpkSNScaqnlt2VdFmti9zeKsg== X-Google-Smtp-Source: AG47ELsg8Tl8WA3F1VREH2BISTBbzGp47m5lDLh1PTtruuol1+FtngfdjN44JUXi+lAKI4GAiZDyVw== X-Received: by 10.101.72.136 with SMTP id n8mr21763795pgs.201.1520526149285; Thu, 08 Mar 2018 08:22:29 -0800 (PST) From: Shubham Jain To: patchew-devel@redhat.com Date: Thu, 8 Mar 2018 21:52:13 +0530 Message-Id: <20180308162213.5193-1-shubhamjain7495@gmail.com> In-Reply-To: References: X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 08 Mar 2018 16:22:30 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 08 Mar 2018 16:22:30 +0000 (UTC) for IP:'209.85.192.194' DOMAIN:'mail-pf0-f194.google.com' HELO:'mail-pf0-f194.google.com' FROM:'shubhamjain7495@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.139 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.192.194 mail-pf0-f194.google.com 209.85.192.194 mail-pf0-f194.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: patchew-devel@redhat.com Cc: Shubham Jain Subject: [Patchew-devel] [PATCH] rest: add API schema X-BeenThere: patchew-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Patchew development and discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 08 Mar 2018 16:22:35 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Now, the REST API is exposing a schema endpoint at /api/v1/schema/. This makes it possible to dynamically interact with API through the coreapi command line tool. --- api/urls.py | 4 ++++ requirements.txt | 1 + 2 files changed, 5 insertions(+) diff --git a/api/urls.py b/api/urls.py index 3a8a66d..0a447f0 100644 --- a/api/urls.py +++ b/api/urls.py @@ -11,6 +11,7 @@ from django.conf.urls import url, include from rest_framework.routers import DefaultRouter from rest_framework_nested.routers import NestedDefaultRouter +from rest_framework.schemas import get_schema_view =20 from . import views from . import rest @@ -36,9 +37,12 @@ projects_router.include_format_suffixes =3D False projects_router.register('series', rest.ProjectSeriesViewSet, base_name=3D= 'series') projects_router.register('messages', rest.MessagesViewSet, base_name=3D'me= ssages') =20 +schema_view =3D get_schema_view(title=3D'API schema') + urlpatterns =3D _build_urls() + [ url(r"v1/", include(router.urls)), url(r"v1/", include(projects_router.urls)), + url(r'^v1/schema/$', schema_view), # Use the base class's handler by default url(r".*", views.APIView.as_view()) ] diff --git a/requirements.txt b/requirements.txt index 9fb9c57..252f226 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,3 +5,4 @@ django-debug-toolbar=3D=3D1.8 gunicorn>=3D19 djangorestframework>=3D3.0.0 drf-nested-routers +coreapi-cli \ No newline at end of file --=20 2.14.3 (Apple Git-98) _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel