Message ID | 20240807140831.27558-2-npratte@iol.unh.edu (mailing list archive) |
---|---|
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 236384575E; Wed, 7 Aug 2024 16:08:49 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CD02C4028C; Wed, 7 Aug 2024 16:08:48 +0200 (CEST) Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) by mails.dpdk.org (Postfix) with ESMTP id 0A0B44027B for <dev@dpdk.org>; Wed, 7 Aug 2024 16:08:48 +0200 (CEST) Received: by mail-qk1-f170.google.com with SMTP id af79cd13be357-7a20c971f89so3667285a.2 for <dev@dpdk.org>; Wed, 07 Aug 2024 07:08:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1723039727; x=1723644527; darn=dpdk.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=DeJ/yzUpZ7emFPSBnxpd/iLTV27pqND1ytW+b4g2eio=; b=VD9JZxXsQ3fWHUpfOzcylIpFOJwxS4b28W0DB5+FoZEh6BnQUfOyEjVrCG5T4bHn78 7LKt1FEtdxHr50XG2WUDa4wHedjwljy1loytxQT04N/VMJ97dPEEssjs43DTA//KdPXS WW3/sxaOgMYqRiF4RLpNgO1rW4/pTMzNNMOaU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723039727; x=1723644527; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=DeJ/yzUpZ7emFPSBnxpd/iLTV27pqND1ytW+b4g2eio=; b=vzcqWvcmNOFGlnrmqugqrf8Yme1413DftCRPllm7ir4PlbFFeSf4krhK6TJF4de5OV I+Xsmvwe8xH2QUxnNgaGoNgFpqbYjTOSY0saJb7FCZATvlsx7ueZxn1Hg0hFWmYG4KMy FT1ui+YEkh0lB53W0nUL7RAqu8mXKKDB6jtIhWvo8pZ51GkBwUPOBOdV+S14/pI8r71e hqx023epBwkJqX3qAUudwcRWjtXI8MrZOgfidNAf+K3Y/iXVgCE0oW4+2THRpAseTb7T cdEdkC1hWmL+gecvdOXrtu+6CZGKJU8bq9izPuoMFzUjDT6nFgV4/ZV+WQITy/DMuyHA +SoA== X-Gm-Message-State: AOJu0Yx1iQsep7kYUlliReQfsGTbaZXt5p9FCBrBsQ8HCmls/j0prAAc inOIn7UZdU97+hf2Cc0l7/yghbnVO0kJhh14wVKmm+0izr4yjJEAtFz/R78Rmjk= X-Google-Smtp-Source: AGHT+IGGrMmeJG1nPMPm/wniUvMv1h67BL9bWzaVkI4fU58ey4qz42MeygyVd4ccdRcsBp76uSxjCg== X-Received: by 2002:a05:620a:4495:b0:7a1:c407:9963 with SMTP id af79cd13be357-7a34efebae8mr1197098085a.10.1723039727229; Wed, 07 Aug 2024 07:08:47 -0700 (PDT) Received: from localhost.unh.edu ([2606:4100:3880:1271:e2f8:4ec3:8bf3:864c]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a3785d2a03sm64839185a.20.2024.08.07.07.08.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 07:08:46 -0700 (PDT) From: Nicholas Pratte <npratte@iol.unh.edu> To: paul.szczepanek@arm.com, luca.vizzarro@arm.com, juraj.linkes@pantheon.tech, jspewock@iol.unh.edu, dmarx@iol.unh.edu, yoan.picchi@foss.arm.com, Honnappa.Nagarahalli@arm.com, probb@iol.unh.edu Cc: dev@dpdk.org, Nicholas Pratte <npratte@iol.unh.edu> Subject: [RFC v1 0/1] dts: separate allowed values from json schema Date: Wed, 7 Aug 2024 10:08:31 -0400 Message-ID: <20240807140831.27558-2-npratte@iol.unh.edu> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions <dev.dpdk.org> List-Unsubscribe: <https://mails.dpdk.org/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://mails.dpdk.org/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <https://mails.dpdk.org/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org |
Series |
dts: separate allowed values from json schema
|
|
Message
Nicholas Pratte
Aug. 7, 2024, 2:08 p.m. UTC
I started discussions with Juraj about potentially taking all of the 'test_suite' enums in the framework's json schema and putting them into its own smaller json file that can easily be referenced. The thought being that doing so might make it easier for outside developers to navigate when writing their own test suites in the future, and it might help to keep the schema clean in the long term as the list inevitably gets larger. We took the idea one step further and discussed the idea of putting all enum/allowed values within the schema into a different location. This is a pretty simple change that doesn't require much effort, but separating the schema is not so graceful insofar that you cannot use '$ref' tags like you might expect; the only way to do this reasonably using Warlock is to merge the dictionaries together before creating a Warlock model, hence the use of '$defs' instead of references to a local file. Nicholas Pratte (1): dts: split enums from primary json schema dts/framework/config/__init__.py | 4 + dts/framework/config/conf_allowed_values.json | 131 ++++++++++++++++++ dts/framework/config/conf_yaml_schema.json | 111 ++------------- 3 files changed, 143 insertions(+), 103 deletions(-) create mode 100644 dts/framework/config/conf_allowed_values.json
Comments
Hi Nicholas, Thank you for the proposal. The way I see it is that JSON schema can be very developer unfriendly to read, therefore I would not rely on it for this purpose. Adding $refs as well could start making it more complicated for this purpose. It's helpful for structuring and maintaining the files though. Normally, a schema is meant for validation purposes. And docs should provide the developer with the right information. Nonetheless, I am getting started in replacing Warlock with Pydantic. And basing the Python classes on Pydantic models. Unfortunately, this will nullify this work altogether, as Pydantic provides an automatic facility for generating the JSON schema, thus removing the need for manual maintenance. Best, Luca
On 7. 8. 2024 17:01, Luca Vizzarro wrote: > Hi Nicholas, > > Thank you for the proposal. The way I see it is that JSON schema can be > very developer unfriendly to read, therefore I would not rely on it for > this purpose. Adding $refs as well could start making it more > complicated for this purpose. It's helpful for structuring and > maintaining the files though. > > Normally, a schema is meant for validation purposes. And docs should > provide the developer with the right information. > > Nonetheless, I am getting started in replacing Warlock with Pydantic. > And basing the Python classes on Pydantic models. Unfortunately, this > will nullify this work altogether, as Pydantic provides an automatic > facility for generating the JSON schema, thus removing the need for > manual maintenance. > > Best, > Luca What Luca says makes a lot of sense. Let's not bother improving the schema since it'll be obsolete soon with the Pydantic changes.