Subject: Re: [patch net-next v2 1/3] tools: ynl-gen: lift type requirement for attribute subsets

From: Jiri Pirko <[email-masked]>
Date: Thu, 5 Oct 2023 09:23:26 +0200

Thu, Oct 05, 2023 at 02:12:02AM CEST, [email-masked] wrote:
>On Fri, 29 Sep 2023 15:47:40 +0200 Jiri Pirko wrote:
>> --- a/tools/net/ynl/ynl-gen-c.py
>> +++ b/tools/net/ynl/ynl-gen-c.py
>> @@ -723,6 +723,8 @@ class AttrSet(SpecAttrSet):
>>              self.c_name = ''
>>  
>>      def new_attr(self, elem, value):
>> +        if 'type' not in elem:
>> +            raise Exception(f"Type has to be set for attribute {elem['name']}")
>>          if elem['type'] in scalars:
>>              t = TypeScalar(self.family, self, elem, value)
>>          elif elem['type'] == 'unused':
>
>Can this still be enforced using JSON schema? Using dependencies 
>to make sure that if subset-of is not present type is?

I have no clue. I know very little about json schema. I can take a look.