Re: [art] Alternative representation of URIs in YANG

"Martin Thomson" <mt@lowentropy.net> writes:
> I recently had cause to review draft-ietf-netconf-http-client-server
> and found Section 2 [2] gave me pause.
>
> This section claims to represent URIs with a name of "ietf-uri" for
> the module.  However, it seems like the only form on offer is a very
> specific authority form.  This might be sufficient for HTTP URIs, but
> I doubt it works for SIP, file, or many other URI forms.

Is that true?  I compared draft-ietf-netconf-http-client-server with RFC
3986, and at first look, it seems like the Yang covers all of the URI
forms allowed by the RFC.  To pick a couple of examples: (with query and
fragment being empty in all cases)

    mailto:worley@ariadne.com

scheme = mailto
hier-part = path-rootless = segment-nz = worley@ariadne.com
authority =

    urn:alert:source:family

scheme = urn
hier-part = path-rootless = segment-nz = alert:source:family
authority =

There is a bit of oddity in that the Yang leaf "path" doesn't correspond
to a nonterminal named "path" in the parse tree of any URI because the
grammar is

      URI         = scheme ":" hier-part [ "?" query ] [ "#" fragment ]

      hier-part   = "//" authority path-abempty
                  / path-absolute
                  / path-rootless
                  / path-empty

But there *is* a nonterminal "path" that is the collective name for the
nonterminals "path-abempty", "path-absolute", "path-rootless", and
"path-empty", and one of those *does* appear in the parse tree of any
(absolute) URI:

      path          = path-abempty    ; begins with "/" or is empty
                    / path-absolute   ; begins with "/" but not "//"
                    / path-noscheme   ; begins with a non-colon segment
                    / path-rootless   ; begins with a segment
                    / path-empty      ; zero characters

Note that "path-noscheme" is also included in "path", but
"path-noscheme" is only used in relative URIs, which aren't in scope.

Dale

Received on Monday, 8 December 2025 11:00:20 UTC