diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 870920d..3a27159 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -8,7 +8,7 @@ license = "GPL-3.0-only" # Consumed by git rev (see ComlineProject/docs → Design → Runtime & generation # repository structure — no crates.io publishing at this stage). Local # iteration: add a `[patch]` onto a sibling checkout. -comline-codegen = { git = "https://github.com/ComlineProject/generation", rev = "cd63473e7029542ef1358accbc5fc61059824577" } +comline-codegen = { git = "https://github.com/ComlineProject/generation", rev = "3ad2c79f48242f7de4bed3e8bc23c5673a381a2e" } comline-core = { git = "https://github.com/ComlineProject/core", rev = "263e58378bb7efcaa466542ca644228ad14e2884", default-features = false } eyre = "0.6.8" @@ -21,6 +21,6 @@ path = "src/bin/comline-gen-typescript.rs" # The conformance corpus: every fixture is a whole package. Same generation # rev as `comline-codegen` above, so the corpus and the generator share one # `comline-codegen`. -comline-conformance = { git = "https://github.com/ComlineProject/generation", rev = "cd63473e7029542ef1358accbc5fc61059824577" } +comline-conformance = { git = "https://github.com/ComlineProject/generation", rev = "3ad2c79f48242f7de4bed3e8bc23c5673a381a2e" } # The tests compile schemas, so they need core's compiler. comline-core = { git = "https://github.com/ComlineProject/core", rev = "263e58378bb7efcaa466542ca644228ad14e2884" } diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index fecafaa..8347cb9 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -12,6 +12,7 @@ mod generator; mod ident; +use comline_codegen::docs::{DocsTable, Topic}; use comline_codegen::features::{Feature, Support, SupportTable}; use comline_codegen::versions::Versions; use comline_codegen::Generator; @@ -81,6 +82,12 @@ pub const SUPPORT: SupportTable = &[ (Feature::Chars, Support::supported()), ]; +/// The documentation pages this generator points users at, by topic. +pub const DOCS: DocsTable = &[( + Topic::Connections, + "https://comlineproject.github.io/docs/languages/typescript/connections/#when-theyre-generated", +)]; + /// Contribute the TypeScript generator to a CLI's [`Registry`](comline_codegen::Registry), /// as `typescript` and `ts`. pub fn register(registry: &mut comline_codegen::Registry) { @@ -91,6 +98,7 @@ pub fn register(registry: &mut comline_codegen::Registry) { generate: generate_typescript, support: SUPPORT, versions: VERSIONS, + docs: DOCS, }); } } diff --git a/codegen/tests/stdio.rs b/codegen/tests/stdio.rs index e811a39..7953e69 100644 --- a/codegen/tests/stdio.rs +++ b/codegen/tests/stdio.rs @@ -5,8 +5,9 @@ use std::io::Write; use std::process::{Command, Stdio}; -use comline_codegen::protocol::{decode, encode, FileOut, Request, Response}; -use comline_codegen::{GenerateRequest, PackageMeta, TargetLanguage}; +use comline_codegen::docs::Topic; +use comline_codegen::protocol::{decode, describe, encode, FileOut, Request, Response}; +use comline_codegen::{GenerateRequest, PackageMeta, Registry, TargetLanguage}; use comline_codegen_typescript::{generate_typescript, VERSIONS}; use comline_conformance::{corpus, Fixture}; use comline_core::schema::idl::annotations::DEFAULT_FORMAT; @@ -73,6 +74,20 @@ fn the_binary_describes_the_typescript_generator() { assert!(d.languages.iter().all(|l| l.versions.floor == VERSIONS.floor)); } +#[test] +fn every_registered_name_carries_the_connections_docs_link() { + let mut registry = Registry::new(); + comline_codegen_typescript::register(&mut registry); + let languages = describe(®istry).languages; + assert_eq!(languages.len(), 2); + for language in &languages { + assert_eq!( + language.doc(Topic::Connections), + Some("https://comlineproject.github.io/docs/languages/typescript/connections/#when-theyre-generated") + ); + } +} + #[test] fn the_ts_alias_generates_the_same() { let fx = corpus().into_iter().next().unwrap(); diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index 601d7c3..0c4fab7 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -8,7 +8,7 @@ publish = false # Same revs `codegen` pins, so this tool and the generator it drives agree on # one `comline-core` - see codegen/Cargo.toml's own comment. comline-core = { git = "https://github.com/ComlineProject/core", rev = "263e58378bb7efcaa466542ca644228ad14e2884" } -comline-codegen = { git = "https://github.com/ComlineProject/generation", rev = "cd63473e7029542ef1358accbc5fc61059824577" } +comline-codegen = { git = "https://github.com/ComlineProject/generation", rev = "3ad2c79f48242f7de4bed3e8bc23c5673a381a2e" } comline-codegen-typescript = { path = "../codegen" } eyre = "0.6.8"