Skip to content

Document Format enum members in @typespec/json-schema - #11540

Draft
timotheeguerin wants to merge 1 commit into
mainfrom
docs/library-docs-json-schema
Draft

Document Format enum members in @typespec/json-schema#11540
timotheeguerin wants to merge 1 commit into
mainfrom
docs/library-docs-json-schema

Conversation

@timotheeguerin

@timotheeguerin timotheeguerin commented Aug 4, 2026

Copy link
Copy Markdown
Member

The 18 members of Format are the values users pick from when applying @format, and every one of them renders with an empty description in the reference docs. Each now says what it means and links the RFC that defines it.

Also fixes a doc comment on Json that the doc parser silently truncates:

 * as opposed to a schema. Use in combination with the @extension decorator. For example,

@extension is read as a doc tag, so everything after it is swallowed as tag content and never reaches the published page. Backticks fix it.

Prerequisite for #1229 and #2090. The library linter rule that catches this is in #11543, which must merge after this one: lint-typespec-library runs with --warn-as-error inside every package's build, so the docs have to exist before the rule is turned on.

Independent of the other documentation PRs (#11539, #11541, #11542) — they touch disjoint packages and can merge in any order.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves the published reference docs for @typespec/json-schema by adding meaningful documentation for Format enum members and fixing a doc-comment parsing issue around @extension.

Changes:

  • Added per-member documentation for the Format enum (and surfaced it in the website reference docs).
  • Fixed Json doc text so @extension isn’t parsed as a doc tag by escaping it with backticks.
  • Added a Chronus entry for the documentation update.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
website/src/content/docs/docs/emitters/json-schema/reference/data-types.md Updates the published reference docs for Json and Format, including descriptions and links.
packages/json-schema/lib/main.tsp Adds doc comments to Format members and fixes/parses Json documentation content and property description.
.chronus/changes/docs-json-schema-2026-8-11.md Adds a changelog entry for the documentation change.

Comment thread packages/json-schema/lib/main.tsp Outdated
/** A time of day, as defined by the `full-time` production in [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6). */
time: "time",

/** A duration, as defined by the `duration` production in [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339#appendix-A). */
| dateTime | `"date-time"` | A date and time, as defined by the `date-time` production in [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6). |
| date | `"date"` | A calendar date, as defined by the `full-date` production in [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6). |
| time | `"time"` | A time of day, as defined by the `full-time` production in [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6). |
| duration | `"duration"` | A duration, as defined by the `duration` production in [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339#appendix-A). |
@azure-sdk-automation

azure-sdk-automation Bot commented Aug 4, 2026

Copy link
Copy Markdown

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@timotheeguerin
timotheeguerin force-pushed the docs/library-docs-json-schema branch from 642ad15 to ff07fe6 Compare August 4, 2026 20:25
@timotheeguerin

Copy link
Copy Markdown
Member Author

Updated in ff07fe6 — but partly pushing back on the premise.

RFC 3339 does define a duration rule: appendix A is titled "ISO 8601 Collected ABNF" and contains duration = "P" (dur-date / dur-time / dur-week). That's not incidental — the JSON Schema validation spec defines this exact format as "a valid representation according to the duration ABNF rule in [RFC 3339], appendix A", so the citation matches the normative source, and dropping it would make this entry the only one in the enum not pointing at the spec's own reference.

That said, the readability concern is fair: readers associate RFC 3339 with timestamps, so an unqualified link is misleading. Reworded to name ISO 8601 explicitly while keeping the normative reference:

An ISO 8601 duration such as P3DT4H5M, as defined by the duration production in RFC 3339, appendix A.

Regenerating the docs applied the same change to data-types.md, so the second comment is covered by this too.

@pkg-pr-new

pkg-pr-new Bot commented Aug 4, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/json-schema@11540

commit: 31c2091

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

  • @typespec/json-schema
Show changes

@typespec/json-schema - internal ✏️

Document the members of the Format enum and escape a code reference in the Json doc comment

Documents all 18 members of the `Format` enum and the `value" property of
`Json`.

Also escapes the `@extension` reference in the `Json` doc comment: without
backticks the doc parser reads it as a tag and silently truncates the rest
of the description.

Prerequisite for #1229 and #2090.
@timotheeguerin
timotheeguerin force-pushed the docs/library-docs-json-schema branch from 2e20080 to 31c2091 Compare August 5, 2026 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants