Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support CDDL dfns, extract standard prelude from CDDL RFC #1750

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tidoust
Copy link
Member

@tidoust tidoust commented Jan 17, 2025

New types of definitions will soon be introduced in Bikeshed to deal with CDDL blocks: cddl-module, cddl-type, cddl-parameter, cddl-key, cddl-value. The extraction now considers that these definition types are valid.

To be able to reference CDDL types defined in the standard prelude, a pre-processing step is also added for the CDDL RFC (RFC8610). To avoid creating multiple definitions with the same id and href, which could perhaps confuse consuming tools (?), all types defined in the standard prelude get attached as different linking text to the same cddl-type dfn, leading to the following dfns extract:

[
  {
    "id": "appendix-D",
    "href": "https://www.rfc-editor.org/rfc/rfc8610#appendix-D",
    "linkingText": [
      "any",
      "uint",
      "nint",
      "int",
      "bstr",
      "bytes",
      "tstr",
      "text",
      "tdate",
      "time",
      "number",
      "biguint",
      "bignint",
      "bigint",
      "integer",
      "unsigned",
      "decfrac",
      "bigfloat",
      "eb64url",
      "eb64legacy",
      "eb16",
      "encoded-cbor",
      "uri",
      "b64url",
      "b64legacy",
      "regexp",
      "mime-message",
      "cbor-any",
      "float16",
      "float32",
      "float64",
      "float16-32",
      "float32-64",
      "float",
      "false",
      "true",
      "bool",
      "nil",
      "null",
      "undefined"
    ],
    "localLinkingText": [],
    "type": "cddl-type",
    "for": [],
    "access": "public",
    "informative": false,
    "heading": {
      "href": "https://www.rfc-editor.org/rfc/rfc8610",
      "title": "RFC 8610: Concise Data Definition Language (CDDL): A Notational Convention to Express Concise Binary Object Representation (CBOR) and JSON Data Structures"
    },
    "definedIn": "pre"
  }
]

I note it would be easy to create one definition per CDDL type otherwise... but then they would have the same id and same href. In practice, I do not know whether that would be a problem for anyone (we don't guarantee that dfns have unique IDs per se, although that should be the case unless a spec incorrectly reuses an ID in more than one dfn).

New types of definitions will soon be introduced in Bikeshed to deal with
CDDL blocks: cddl-module, cddl-type, cddl-parameter, cddl-key, cddl-value. The
extraction now considers that these definition types are valid.

To be able to reference CDDL types defined in the standard prelude, a
pre-processing step is also added for the CDDL RFC (RFC8610). To avoid creating
multiple definitions with the same ID and href, which could perhaps confuse
consuming tools (?), all types defined in the standard prelude get attached as
different linking text to the same cddl-type dfn.
@tidoust tidoust requested a review from dontcallmedom January 17, 2025 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants