{"id":46300811,"url":"https://github.com/entur/netex-typescript-model","last_synced_at":"2026-03-04T11:07:38.436Z","repository":{"id":339365728,"uuid":"1160954615","full_name":"entur/netex-typescript-model","owner":"entur","description":"TS types \u0026 json.schema artifacts from XSD. Workflow partly taken from netex-java-model","archived":false,"fork":false,"pushed_at":"2026-02-26T10:06:52.000Z","size":314,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-26T15:59:58.609Z","etag":null,"topics":["generator","javasc","jsonschema","netex","typescript"],"latest_commit_sha":null,"homepage":"https://entur.github.io/netex-typescript-model/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"eupl-1.2","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/entur.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-18T15:11:46.000Z","updated_at":"2026-02-26T10:03:57.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/entur/netex-typescript-model","commit_stats":null,"previous_names":["entur/netex-typescript-model"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/entur/netex-typescript-model","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/entur%2Fnetex-typescript-model","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/entur%2Fnetex-typescript-model/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/entur%2Fnetex-typescript-model/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/entur%2Fnetex-typescript-model/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/entur","download_url":"https://codeload.github.com/entur/netex-typescript-model/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/entur%2Fnetex-typescript-model/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30078530,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T08:01:56.766Z","status":"ssl_error","status_checked_at":"2026-03-04T08:00:42.919Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["generator","javasc","jsonschema","netex","typescript"],"created_at":"2026-03-04T11:07:37.799Z","updated_at":"2026-03-04T11:07:38.423Z","avatar_url":"https://github.com/entur.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# netex-typescript-model\n\n## Experimental / Work-in-progress !!\n\nGenerates JSON Schema and TypeScript interfaces from [NeTEx](http://netex-cen.eu/) (Network Timetable Exchange) XSD schemas. The JSON Schema is a standalone artifact useful on its own (validation, code generation in other languages, interactive HTML viewer); the TypeScript interfaces build on top of it. Sibling project to [netex-java-model](https://github.com/entur/netex-java-model).\n\n**[API Documentation](https://entur.github.io/netex-typescript-model/)** — TypeDoc for every NeTEx part, generated and deployed automatically via GitHub Actions.\n\n```mermaid\ngraph LR\n    XSD[NeTEx XSDs] --\u003e JS[JSON Schema]\n    JS --\u003e HTML[Schema HTML viewer]\n    JS --\u003e TS[TypeScript interfaces + typeDoc]\n\n    style XSD fill:#f5f5f5,stroke:#999\n    style JS fill:#e8f4e8,stroke:#4a4\n    style HTML fill:#e8f0f8,stroke:#48a\n    style TS fill:#e8f0f8,stroke:#48a\n  \n```\n\n## Prerequisites\n\n- JDK 21+ (any distribution — GraalVM not required)\n- Maven 3+\n- Node.js 22+\n\n```bash\ncd typescript \u0026\u0026 npm install   # once\n```\n\n## Quick Start\n\n```bash\nmake all                       # full pipeline: XSD → JSON Schema → HTML → TypeScript → TypeDoc\n```\n\nThis downloads NeTEx XSDs from GitHub, converts them to JSON Schema via a Java DOM parser, validates the schema, generates an interactive HTML viewer, TypeScript interfaces, and TypeDoc documentation.\n\n## Generating Variants\n\nPass `ASSEMBLY` to build a different NeTEx subset. Parts are derived automatically from the assembly name:\n\n```bash\nmake all ASSEMBLY=network              # base + part1_network\nmake all ASSEMBLY=network+timetable    # base + part1_network + part2_timetable\n```\n\nAvailable parts: `network`, `timetable`, `fares`, `new-modes` (also accepted as `part1_network`, `part2_timetable`, `part3_fares`, `part5_new_modes`). Multi-part assemblies use `+` separators and are sorted alphabetically. See the [Subset Selection Guide](docs/subset-selection-guide.md) for dependencies between parts.\n\n## Makefile Targets\n\n| Command                              | What it does                                           |\n| ------------------------------------ | ------------------------------------------------------ |\n| `make all`                           | Full pipeline: schema + types + docs (default: base)   |\n| `make all ASSEMBLY=network`          | Full pipeline for a named variant                      |\n| `make schema`                        | JSON Schema + schema HTML only                         |\n| `make types`                         | TypeScript interfaces only                             |\n| `make docs`                          | TypeDoc HTML only                                      |\n| `make tarball VERSION=1.0.0`         | Package assembly as `.tgz` release tarball             |\n| `make clean`                         | Remove `generated-src/`, `xsd/`, `json-schema/target/` |\n\nThe Makefile is incremental — re-running `make` after a successful build is a no-op.\n\n## Releases\n\nPushing a `v*` tag (e.g. `v1.0.0`) triggers the release workflow, which builds each assembly, packages them as `.tgz` tarballs, and attaches them to a GitHub Release. Tarball naming: `netex-\u003cversion\u003e-\u003cbranch\u003e-\u003cassembly\u003e-v\u003ctag\u003e.tgz`.\n\n## Pipeline\n\n### Stage 1: XSD → JSON Schema (Makefile)\n\n1. Maven Ant plugin downloads the NeTEx ZIP from GitHub (`next` branch)\n2. GraalJS runs `json-schema/xsd-to-jsonschema.js` on stock JDK via Java DOM APIs\n3. Each definition is stamped with `x-netex-source` (provenance) and `x-netex-atom` annotations\n4. JSON Schema is validated against the Draft 07 meta-schema\n5. An interactive HTML viewer is generated per assembly\n\n### Stage 2: JSON Schema → TypeScript (`generate.ts`)\n\n```\n\u003cassembly\u003e.schema.json → json-schema-to-typescript → split modules → tsc --noEmit\n```\n\n1. Reads `x-netex-source` annotations to build a type→file source map\n2. Injects `@see` links into a clone (persisted JSON stays clean)\n3. Compiles to monolithic TypeScript via `json-schema-to-typescript`\n4. Splits into per-category modules with cross-imports and a barrel `index.ts`\n5. Type-checks with `tsc --noEmit`\n\n### Documentation\n\n```bash\ncd typescript\nnpm run docs                          # TypeDoc HTML per assembly\nnpx tsx scripts/build-docs-index.ts   # assemble docs-site/ with welcome page\n```\n\nCI builds `base` and `network+timetable` assemblies, generates TypeDoc + schema HTML, and deploys to GitHub Pages on push to `main`.\n\n## XSD Subset\n\nNeTEx 2.0 contains 458+ XSD files across several functional parts. Generation is restricted to the parts you enable in `assembly-config.json`. The framework, GML, SIRI, service, and publication entry point are always required; the domain-specific parts are toggled individually:\n\n#### Required\n\n| Part key    | XSD directory           | Files | Domain                                                |\n| ----------- | ----------------------- | ----- | ----------------------------------------------------- |\n| `framework` | `netex_framework`       | 143   | Base types, reusable components, organizations        |\n| `gml`       | `gml`                   | 7     | Geographic coordinates                                |\n| `siri`      | `siri` + `siri_utility` | 12    | Real-time updates (imported by NeTEx_publication.xsd) |\n| `service`   | `netex_service`         | 4     | NeTEx service definitions and filters                 |\n\n#### Optional\n\n| Part key          | XSD directory  | Files | Domain                                                                 |\n| ----------------- | -------------- | ----- | ---------------------------------------------------------------------- |\n| `part1_network`   | `netex_part_1` | 93    | Routes, lines, stop places, timing patterns                            |\n| `part2_timetable` | `netex_part_2` | 56    | Service journeys, passing times, vehicle services                      |\n| `part3_fares`     | `netex_part_3` | 92    | Fare products, pricing, distribution, sales                            |\n| `part5_new_modes` | `netex_part_5` | 32    | Mobility services, vehicle meeting points (Part 4 was never published) |\n\nEnable a part by setting `\"enabled\": true` in its config entry. See the [Subset Selection Guide](docs/subset-selection-guide.md) for dependency info between parts.\n\n## Configuration\n\nAll settings live in [`assembly-config.json`](assembly-config.json):\n\n- `netex.version` / `netex.branch` — which NeTEx release to download\n- `paths.generated` — output directory (`generated-src`)\n- `parts.\u003ckey\u003e.enabled` — toggle NeTEx parts on/off\n- `rootXsds.\u003ckey\u003e.enabled` — toggle root-level XSD files\n\n## Project Structure\n\n```\nMakefile                              # build entry point\nassembly-config.json                  # NeTEx version, parts, output paths\ntsconfig.generated.json               # type-check config for generated output\ntypescript/                           # Node.js/TypeScript tooling\n  scripts/\n    generate.ts                       # JSON Schema → TypeScript (positional arg)\n    xsd-to-jsonschema-1st-try.ts      # reference XSD → JSON Schema converter (fast-xml-parser)\n    split-output.ts                   # split monolithic .ts into per-category modules\n    validate-generated-schemas.ts     # validate JSON Schema against Draft 07 meta-schema\n    build-schema-html.ts              # interactive JSON Schema HTML viewer\n    generate-docs.ts                  # TypeDoc HTML per assembly\n    build-docs-index.ts               # docs-site/ welcome page\njson-schema/                          # Java DOM pipeline (feature-parity port)\n  pom.xml                             # Maven POM (GraalJS + Xerces, XSD download)\n  xsd-to-jsonschema.js                # JS converter using Java DOM APIs\n  verify-parity.sh                    # diff output against typescript/ reference\ngenerated-src/                        # output (gitignored)\n  \u003cassembly\u003e/\n    \u003cassembly\u003e.schema.json            # JSON Schema\n    interfaces/                       # TypeScript modules + barrel index.ts\n    docs/                             # TypeDoc HTML\n    netex-schema.html                 # interactive schema viewer\n```\n\n## npm Scripts (typescript/)\n\n| Script                                 | Description                                 |\n| -------------------------------------- | ------------------------------------------- |\n| `npm run generate:ts -- \u003cschema.json\u003e` | Generate TypeScript from a JSON Schema      |\n| `npm run test`                         | Run tests (vitest)                          |\n| `npm run validate:jsonschema`          | Validate generated schemas against Draft 07 |\n| `npm run docs`                         | Generate TypeDoc HTML per assembly          |\n\n## Related Projects\n\n- [netex-java-model](https://github.com/entur/netex-java-model) — Java/JAXB bindings for NeTEx\n- [NeTEx](https://github.com/NeTEx-CEN/NeTEx) — upstream XSD schemas\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fentur%2Fnetex-typescript-model","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fentur%2Fnetex-typescript-model","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fentur%2Fnetex-typescript-model/lists"}