Repository navigation
docs: TypeScript does lib mode, and both generators import cross-schema types - #29
Merged
Merged
Conversation
…hema types Catches the codegen guide up with two merged changes and one shipping now. `lib` mode was documented as "rust only" with nested namespaces "not done yet" - stale for rust, whose `ModuleTree` has handled them all along, and now wrong for typescript too (comline-typescript#32). `library-generation.md` gains a typescript section: the package shape, why the barrel mirrors namespaces rather than flattening them, and the one restriction both generators share (a namespace is a schema or a parent, not both). `generating-code.md`'s cross-schema reference section only covered rust's `crate::`-qualified paths; typescript now emits `import type` by relative specifier, which carries an assumption worth stating - `code` mode needs the layout to keep a namespace in the file-name position. Also from cli#58 and cli#59, neither of which reached the docs: `--no-external-std` and `--dry-run` were missing from `cli.md` entirely (caught by `scripts/check-cli-drift.py`, which is now clean again), and the `[[generate.target]]` section still described a block as what decides whether a language is generated rather than how.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Docs for comline-typescript#32, plus two things from already-merged CLI work that never reached the docs.
libmodelibrary-generation.mdsaidlibwas "rust only" and that "a schemawhose namespace is nested (
a/b)" was "not done yet". Both stale: rust'sModuleTreehas handled nested namespaces all along, and typescript nowdoes too. The
libsection gains a typescript half — the package shape, theindex.ts-per-level barrel and why it mirrors namespaces instead offlattening (
stdis implicit in every package, so a flat barrel makes yourown
Requestambiguous withstd/http's, which TypeScript refusesoutright), and the one restriction both generators share: a namespace can be
a schema or a parent of deeper schemas, not both.
Cross-schema references
generating-code.mdonly documented rust'scrate::-qualified paths. Addedthe typescript equivalent —
import typeby relative specifier, aliasesimporting the name the other module exports, unused
uses producingnothing — along with the assumption that carries:
codemode needs thelayoutto keep each namespace in the file-name position. Every layoutthe docs show does, including the default.
Flags that were never documented
scripts/check-cli-drift.pywas failing onmain:--no-external-std(cli#58) was missing fromcli.mdentirely, and--dry-runwas in the flag list but unexplained. Both documented, and theexternal_stddefault is now stated (on inlib, off incode). The driftcheck is clean again:
The
[[generate.target]]section also still described a block as whatdecides whether a language is generated — the behaviour cli#59 fixed — so
that carries over here too.
Both drift scripts pass. mkdocs isn't installed locally, so the site build is
unverified.