On 22. 02. 21 10:49, Martin Björklund wrote:
> Hi,
>
> Section 11 of RFC 7950 says:
>
> o A "type" statement may be replaced with another "type" statement
> that does not change the syntax or semantics of the type. For
> example, an inline type definition may be replaced with a typedef,
> but an int8 type cannot be replaced by an int16, since the syntax
> would change.
>
> If we're just considering XML, then the syntax or encoding wouldn't
> change if we went from
>
> type int64 { range "2..4"; }
>
> to
>
> type string { pattern "2|3|4"; }
>
> or
>
> type enumeration {
> enum 2;
> enum 3;
> enum 4;
> }
>
> or
>
> type union {
> type uint8 { range "2"; }
> type string { pattern "3"; }
> type enumeration { enum 4; }
> }
>
>
> But I don't think this is reasonable, and not the intention. I think
> that changing the base built-in type always should be considered
> non-backwards compatible (which the quoted text above seems to imply).
Agreed. Another problem related to sec. 11 is that it permits to update
a module so that the range specification is extended, which may then
expose the incompatibility of e.g. uint8 and int8.
But I thought that Jürgen's question was directed to the definition of
backward compatibility in the semver context.
Lada
>
>
> /martin
>
>
>
>
> Juergen Schoenwaelder <[email protected]> wrote:
>> On Fri, Feb 19, 2021 at 10:32:34PM +0100, Carsten Bormann wrote:
>>>
>>>
>>>> On 2021-02-19, at 19:18, Juergen Schoenwaelder
>>>> <[email protected]> wrote:
>>>>
>>>> I think the CBOR encoding picks different tags depending on the
>>>> signedness of the base type and this is why things are not that simple
>>>> anymore.
>>>
>>> (This is not the CBOR encoding, but the COMI encoding of keys in URIs.)
>>
>> OK. The CBOR document indeed says:
>>
>> 6.1. The unsigned integer Types
>>
>> Leafs of type uint8, uint16, uint32 and uint64 MUST be encoded using
>> a CBOR unsigned integer data item (major type 0).
>>
>> 6.2. The integer Types
>>
>> Leafs of type int8, int16, int32 and int64 MUST be encoded using
>> either CBOR unsigned integer (major type 0) or CBOR negative integer
>> (major type 1), depending on the actual value.
>>
>> This means the type 'int8 { range 0..10; }' leads to the same
>> encodings as the type 'uint8 { range 0..10; }'.
>>
>>>> For the XML and JSON encodings, all definitions lead to the
>>>> same on-the-wire representation, hence the difference is more an
>>>> implementation detail. I have no clue what the gnmi people do. The
>>>> more diverse encodings we add, the more complex things get.
>>>
>>> Well, if the equivalence expectation that I was trying to describe actually
>>> is ingrained, then whoever designs an encoding (COMI for its URI encoding
>>> included) needs to respect it. That would be important to know.
>>>
>>
>> Exactly. I think we never defined this. And of course, this can get
>> even more fun if you consider string based encodings. The type
>>
>> type string { pattern "1|2|3|4"; }
>>
>> yields the same _XML encoded_ value space as
>>
>> type int32 { range "1..4"; }
>>
>> but as far as I recall the JSON/CBOR encodings will treat these two
>> differently. So yes, ideally the YANG language would have clear rules
>> what YANG's type equivalences are.
>>
>> /js
>>
>> --
>> Juergen Schoenwaelder Jacobs University Bremen gGmbH
>> Phone: +49 421 200 3587 Campus Ring 1 | 28759 Bremen | Germany
>> Fax: +49 421 200 3103 <https://www.jacobs-university.de/>
>>
>> _______________________________________________
>> netmod mailing list
>> [email protected]
>> https://www.ietf.org/mailman/listinfo/netmod
>
> _______________________________________________
> netmod mailing list
> [email protected]
> https://www.ietf.org/mailman/listinfo/netmod
>
--
Ladislav Lhotka
Head, CZ.NIC Labs
PGP Key ID: 0xB8F92B08A9F76C67
_______________________________________________
netmod mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/netmod