Re: [httpapi] Discussion about JSON payloads and code generation

Christoph Kappestein <christoph.kappestein@gmail.com> Sun, 17 January 2021 11:46 UTC

Return-Path: <christoph.kappestein@gmail.com>
X-Original-To: httpapi@ietfa.amsl.com
Delivered-To: httpapi@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id AAF9F3A100E for <httpapi@ietfa.amsl.com>; Sun, 17 Jan 2021 03:46:37 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.097
X-Spam-Level:
X-Spam-Status: No, score=-2.097 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CcIQZbmiGSYX for <httpapi@ietfa.amsl.com>; Sun, 17 Jan 2021 03:46:35 -0800 (PST)
Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 451C63A100C for <httpapi@ietf.org>; Sun, 17 Jan 2021 03:46:35 -0800 (PST)
Received: by mail-lf1-x133.google.com with SMTP id h205so19892606lfd.5 for <httpapi@ietf.org>; Sun, 17 Jan 2021 03:46:34 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=njUYIocrbz7JGjvY7qfGfamNpZSsrSAVmsVLzKb5kCc=; b=Ud7493L07sVmzb/xh5t+viVl27dVX90vo+x4lfLbztRMm/33lzBeCwR88fV5qRk2hv xzMKb4hjXuIDyu995dTca79lzzK+YlBSDFkY2UfJuG6++v+0ptixHyx4Z/t4Uj+HM4v4 M5xJzPYm33AktpSmjpHcN2MBz3eDN+G+dNcrn4gsaaYkaGpRpa6VWsnpD0S/JwmR6vYc L/EaZnAlYEWiqunpUJ0Ik3hgMW4NY3+RSA9klD3ZvFIgEObhlW4jBur4nANF271lnYLv I3k/+bAX5Sz+DDeHmhDb74oCWfUTPfdFfmpsp5cxePnHcE4YipzBPT7NtNGmx8gh1jDK 6toQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=njUYIocrbz7JGjvY7qfGfamNpZSsrSAVmsVLzKb5kCc=; b=qtjXrj4gZDLTvW1bDw34UJBIwtuMga++GEdAzYi8On2C3FWr2vEXErePZpngDVMtYd Cj4vZF8b9irZJrvjJvFoFj0KaAXDDM4beYOXRP++DQInSJ4objxtz0j4tbyyht2BM8zA VkE/uYV1HYFEdabBoTx93M4Th0fLjFEX8VIJinjxNhzcFrxKefq+5aIKWCejMCDaxmGS OXQXQpLMIBodp8vofmN1Yx1nF+uY29KJZIpTcRdsj3fjmKCK1w9U/gPaXNdXqVUx79V6 nPUrvgc+hbSsLOzP7wPV1jFlad1ZM6HtIfhNxuG7cliiCOaHlsyShCpltCoFnlbD8VWX KojA==
X-Gm-Message-State: AOAM530fMywygtp2RD1G8phAR5eyZnhEzg8tqbylr16yZVaAEWZvEV0s Te6+erTF3mtbbY2El9sDffztGjk0Uya1FoaVPUU=
X-Google-Smtp-Source: ABdhPJxFm3amPL2OxAXeVGk0iIrzVM2HNeBsW2tX9q/YURn1lNeRVbonmYqLhW14u6g5LjSPM7CuWo01xw9ogkJmsac=
X-Received: by 2002:a19:3d5:: with SMTP id 204mr8731347lfd.21.1610883992893; Sun, 17 Jan 2021 03:46:32 -0800 (PST)
MIME-Version: 1.0
References: <CALcRZn6-ojAAdJcMWFHef70Xp32O2iFatuw-YjGLKtr8VnbmYQ@mail.gmail.com> <DM6PR00MB0845824BE38945071F9774A5F0A69@DM6PR00MB0845.namprd00.prod.outlook.com>
In-Reply-To: <DM6PR00MB0845824BE38945071F9774A5F0A69@DM6PR00MB0845.namprd00.prod.outlook.com>
From: Christoph Kappestein <christoph.kappestein@gmail.com>
Date: Sun, 17 Jan 2021 12:46:21 +0100
Message-ID: <CALcRZn6HdXE2WAn0vSod0XDY_yJd7jV7m5JnRWKWGDJaDaag-A@mail.gmail.com>
To: Darrel Miller <Darrel.Miller@microsoft.com>
Cc: "httpapi@ietf.org" <httpapi@ietf.org>
Content-Type: multipart/alternative; boundary="0000000000002bbb0205b9172885"
Archived-At: <https://mailarchive.ietf.org/arch/msg/httpapi/SMPkAVlOCfFop4Sn_FkKHKe8jw8>
Subject: Re: [httpapi] Discussion about JSON payloads and code generation
X-BeenThere: httpapi@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Building Blocks for HTTP APIs <httpapi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/httpapi>, <mailto:httpapi-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/httpapi/>
List-Post: <mailto:httpapi@ietf.org>
List-Help: <mailto:httpapi-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/httpapi>, <mailto:httpapi-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sun, 17 Jan 2021 11:46:38 -0000

Hi Darrel,

Thank you for the feedback. I understand that it is not easy possible to
change the schema specification but I had the hope that the OpenAPI spec
will be in future versions more JSON schema independent. I.e. that a user
could use XSD, JTD, Protobuf or any other specification to describe the
request/response payload, also for payloads in the future which are not
JSON. So that a user is not forced to use JSON schema and that an
alternative could emerge.

A core editor from the JSON schema spec has already approached me regarding
a vocabulary, but from my point of view I think that those vocabularies
inherit many properties from JSON schema which are not ideal for code
generation. In the spirit of "do one thing and do it well" we could have
different specifications for specific use cases, which would be a much more
flexible framework than forcing every schema to be a vocabulary. A
generator could then support only specific schema types. If I remember
correctly the RAML specification solved this also in a similar way. This
approach would be also great for the OpenAPI since they do not have to
force a different schema spec but the users can decide which is the optimal
solution.

Thanks to the link of the API report, I was not aware of it and it looks
really interesting. Regarding the OpenAPI spec, for me it would be really
interesting to know whether there is such a plan to make the schema
description part more JSON schema independent?

best regards
Christoph


Am Sa., 16. Jan. 2021 um 23:12 Uhr schrieb Darrel Miller <
Darrel.Miller@microsoft.com>:

> Hi Christoph,
>
> *From:* httpapi <httpapi-bounces@ietf.org> on behalf of Christoph
> Kappestein <christoph.kappestein@gmail.com>
>
> I would like to gauge whether there is some interest in discussing ways to
> describe JSON payloads with a focus on code generation on this WG. Also it
> would be interesting to gather feedback from other developers who have
> experiences in this space.
>
>
> As an editor of the OpenAPI spec, that relies heavily on JSON Schema,
> consider my perspective to be heavily biased here. But I do agree
> wholeheartedly that JSON Schema has challenges when it comes to describing
> types for code generation.  However, I would be reluctant to go down a path
> of defining a new specification for describing types.
>
> The recent Postman developer survey https://www.postman.com/state-of-api/ found
> that in their 13,000 respondents, 75% of them claimed to be users of JSON
> Schema.  Convincing developers to move to a different format is going to
> require a compelling alternative.
>
> What would be awesome to see is if a community could form around creating
> a new JSON Schema vocabulary that targets type description.  JSON Schema
> itself is now defined by a set of vocabularies, one of which is the
> validation vocabulary.  I know the JSON Schema core team have been looking
> for someone to spearhead this effort.
> https://github.com/json-schema-org/json-schema-vocabularies
>
> By taking this approach, the existing JSON Schema specifications and
> artifacts can be leveraged, and the new type definition keywords could be
> used alongside the validation keywords.
>
> Darrel
>
>
>