Repository navigation
Conversation
Add an "Annotations" section to the README listing every JSDoc tag the generator understands: the JSON Schema keyword tags read by BasicAnnotationsReader, the extended-only tags (@example, @nullable, @astype), the tags that change what is generated (@hidden, @internal) and @Discriminator with its json-schema and open-api output styles. It also explains how the --jsDoc mode and --validation-keywords affect which tags are read. Fixes vega#2045.
arthurfiorette
left a comment
There was a problem hiding this comment.
Writing pass. Content reads well; the comments below are wording fixes and one overlap with #2565.
|
|
||
| ### Keyword tags | ||
|
|
||
| These tags map straight to the JSON Schema keyword of the same name. |
There was a problem hiding this comment.
"Of the same name" is contradicted by the table right below (@id -> $id, @comment -> $comment, @ref -> $ref).
| These tags map straight to the JSON Schema keyword of the same name. | |
| Each tag becomes a JSON Schema keyword, named after the tag unless the table says otherwise. |
| | `@ref` | `$ref` (replaces the type) | | ||
| | `@format` | `format` | | ||
| | `@pattern` | `pattern` | | ||
| | `@contentMediaType`, `@contentEncoding` | `contentMediaType`, `contentEncoding` | |
There was a problem hiding this comment.
Column widths are off on these rows (and in the value tags table). Run prettier on the file.
| | `@readOnly`, `@writeOnly` | `@readOnly` | | ||
| | `@deprecated` | `@deprecated` | | ||
|
|
||
| Other tags are ignored unless you list them with `--validation-keywords` (`extraTags` in the config). Listed tags are parsed like value tags and copied into the schema under the tag name. |
There was a problem hiding this comment.
#2565 documents the same --validation-keywords / extraTags behavior in its own section. Keep it in one place and link to it from the other, otherwise the two will drift.
| Other tags are ignored unless you list them with `--validation-keywords` (`extraTags` in the config). Listed tags are parsed like value tags and copied into the schema under the tag name. | |
| Other tags are ignored unless you list them with `--validation-keywords` (`extraTags` in the config). They are parsed like value tags and copied into the schema under the tag name. |
|
|
||
| ### Discriminated unions | ||
|
|
||
| `@discriminator <property>` on a union type tells the generator which property tells the union members apart: |
There was a problem hiding this comment.
"tells" twice in one sentence.
| `@discriminator <property>` on a union type tells the generator which property tells the union members apart: | |
| `@discriminator <property>` on a union type names the property that distinguishes the union members: |
|
Can this be shorter? It's a pretty long addition that will be hard to maintain. Maybe we can link to code? |
Replace the tag tables with a short summary and point to BasicAnnotationsReader/ExtendedAnnotationsReader for the full lists. Also fix wording raised in review.
|
Thanks @domoritz and @arthurfiorette!
Ran |
What
Adds an Annotations section to the README that documents all JSDoc tags the generator supports, as requested in #2045 (see also #1819).
The section covers:
--jsDoc(none/basic/extended) controls which tags are read.BasicAnnotationsReader: text tags (@title,@description,@id,@comment,@ref,@format,@pattern,@contentMediaType,@contentEncoding) and value tags (@minimum,@maximum,@exclusiveMinimum,@exclusiveMaximum,@multipleOf,@minLength,@maxLength,@minItems,@maxItems,@uniqueItems,@minProperties,@maxProperties,@propertyNames,@contains,@const,@examples,@default,@required,@if/@then/@else,@readOnly,@writeOnly,@deprecated). It notes the$prefix for$id/$comment/$ref, JSON5 parsing, and that a value tag with no text becomestrue.--validation-keywords/extraTags.ExtendedAnnotationsReader:@example,@nullable,@asType, plus the--markdown-descriptionand--full-descriptionoutput.@hiddenand@internal, which change what gets generated.@discriminatorwith an example, the defaultif/thenoutput and thediscriminatorType: "open-api"alternative.This is a documentation-only change; no code was modified.
Fixes #2045
Testing
Ran
npm testin a clean Linux container: passed.This PR was prepared with AI assistance (Claude) and reviewed by me before submitting.