Skip to content

docs(openapi-generator): Refactor documentation to Diátaxis Reference format #1038

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

Merged
merged 1 commit into from
Apr 24, 2025

Conversation

youngjungithub
Copy link
Contributor

This PR significantly refactors the documentation for the @api-ts/openapi-generator package to align with the Reference section principles of the Diátaxis framework. The goal is to provide users with a clear, structured, and authoritative technical description suitable for direct consultation during development.

Key Changes:

  • Restructured the entire README.md into a dedicated Reference section, replacing the previous narrative format.
  • Organized content into logical subsections for improved navigability and focus:
    • Command-Line Interface (CLI): Provides a technical overview, usage syntax, and detailed descriptions of the <file> argument, options (--name, --version, --codec-file), and flags (--internal, --help), along with concrete usage examples.
    • Configuration: Clearly documents the requirements for preparing external types packages (specifying files and source in the external package's package.json). Details the two distinct methods for defining custom codec schemas:
      1. Via openapi-gen.config.js within the types package (recommended for type authors), including file naming, package.json requirements (customCodecFile, files), and file structure.
      2. Via the --codec-file CLI option for consumers, specifying the required file structure (grouping by package name).
    • Supported io-ts Primitives: Includes a definitive list of io-ts primitives and combinators that the generator can automatically interpret to produce OpenAPI schemas.
    • JSDoc Annotations: Exhaustively documents the supported JSDoc tags used to enrich the generated OpenAPI specification, categorized by:
      • Endpoint Annotations (applied to httpRoute variables): Covers Summary, Description, @operationId, @tag, @private, @unstable, @example, and the handling of unknown tags (x-unknown-tags), explaining their direct mapping to OpenAPI Operation Object fields (like summary, description, operationId, tags, x-internal, x-unstable, example, x-unknown-tags).
      • Schema Annotations (applied to io-ts types/fields): Details how to add descriptions via JSDoc text and lists all supported standard OpenAPI tags (@default, @example, @minLength, @maximum, @pattern, @format, etc.) and custom tags (@private, @deprecated), explaining their effect on the resulting OpenAPI Schema Object or Property (like description, default, minLength, deprecated, x-internal). Includes comprehensive examples demonstrating tag usage.
  • Removed introductory explanations and narrative prose, focusing strictly on factual, technical descriptions of the tool's features, configuration requirements, and behavior based on inputs (like JSDoc tags).

Impact:

This restructuring provides developers using @api-ts/openapi-generator with significantly improved technical reference documentation. The information is now presented in a consistent, predictable, and easily searchable format, adhering to the Diátaxis framework's guidelines for effective reference material. This makes it easier for users to find the specific technical details they need regarding CLI usage, configuration, supported types, and JSDoc annotation capabilities while working with the generator.

@youngjungithub youngjungithub requested review from a team as code owners April 21, 2025 16:48
@youngjungithub youngjungithub force-pushed the docs/refactor-openapi-generator-docs branch from e0fbf18 to 34b3ce2 Compare April 21, 2025 16:50
@youngjungithub youngjungithub force-pushed the docs/refactor-openapi-generator-docs branch 2 times, most recently from 035255a to 8046350 Compare April 22, 2025 17:32
… format

This commit significantly refactors the documentation for the `@api-ts/openapi-generator` package to align with the Reference section principles of the Diátaxis framework. The goal is to provide users with a clear, structured, and authoritative technical description suitable for direct consultation during development.

**Key Changes:**

* Restructured the entire README.md into a dedicated Reference section, replacing the previous narrative format.
* Organized content into logical subsections for improved navigability and focus:
    * **Command-Line Interface (CLI):** Provides a technical overview, usage syntax, and detailed descriptions of the `<file>` argument, options (`--name`, `--version`, `--codec-file`), and flags (`--internal`, `--help`), along with concrete usage examples.
    * **Configuration:** Clearly documents the requirements for preparing external types packages (specifying `files` and `source` in the external package's `package.json`). Details the two distinct methods for defining custom codec schemas:
        1.  Via `openapi-gen.config.js` within the types package (recommended for type authors), including file naming, `package.json` requirements (`customCodecFile`, `files`), and file structure.
        2.  Via the `--codec-file` CLI option for consumers, specifying the required file structure (grouping by package name).
    * **Supported `io-ts` Primitives:** Includes a definitive list of `io-ts` primitives and combinators that the generator can automatically interpret to produce OpenAPI schemas.
    * **JSDoc Annotations:** Exhaustively documents the supported JSDoc tags used to enrich the generated OpenAPI specification, categorized by:
        * *Endpoint Annotations* (applied to `httpRoute` variables): Covers Summary, Description, `@operationId`, `@tag`, `@private`, `@unstable`, `@example`, and the handling of unknown tags (`x-unknown-tags`), explaining their direct mapping to OpenAPI Operation Object fields (like `summary`, `description`, `operationId`, `tags`, `x-internal`, `x-unstable`, `example`, `x-unknown-tags`).
        * *Schema Annotations* (applied to `io-ts` types/fields): Details how to add descriptions via JSDoc text and lists all supported standard OpenAPI tags (`@default`, `@example`, `@minLength`, `@maximum`, `@pattern`, `@format`, etc.) and custom tags (`@private`, `@deprecated`), explaining their effect on the resulting OpenAPI Schema Object or Property (like `description`, `default`, `minLength`, `deprecated`, `x-internal`). Includes comprehensive examples demonstrating tag usage.
* Removed introductory explanations and narrative prose, focusing strictly on factual, technical descriptions of the tool's features, configuration requirements, and behavior based on inputs (like JSDoc tags).

**Impact:**

This restructuring provides developers using `@api-ts/openapi-generator` with significantly improved technical reference documentation. The information is now presented in a consistent, predictable, and easily searchable format, adhering to the Diátaxis framework's guidelines for effective reference material. This makes it easier for users to find the specific technical details they need regarding CLI usage, configuration, supported types, and JSDoc annotation capabilities while working with the generator.

chore: apply feedback

chore: fix heading to use title casing

chore: add . after sentences

chore: apply feedback
@youngjungithub youngjungithub force-pushed the docs/refactor-openapi-generator-docs branch from 65ce5d0 to a0399b6 Compare April 23, 2025 15:49
@vmccarty vmccarty self-requested a review April 23, 2025 16:08
@omeradeel26 omeradeel26 merged commit 3c5f52a into master Apr 24, 2025
6 checks passed
@omeradeel26 omeradeel26 deleted the docs/refactor-openapi-generator-docs branch April 24, 2025 08:05
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.

3 participants