Commit Graph
3 Commits
Author SHA1 Message Date
LGUG2Z 62050f8a24 fix(docgen): only strip trailing digits from wrapper type names
Previously, add_wrapper_display_names() would add a _display_name field
to ALL types with trailing digits, incorrectly affecting legitimate type
names like Base16, Sha256, or Level3.

Now the function only strips trailing digits from types that are marked
as wrapper types (_wrapper_type: true), leaving other type names intact.

Adds comprehensive tests for both cases:
- Legitimate type names ending in digits remain unchanged
- Wrapper type variants (e.g., PerAnimationPrefixConfig2) get proper
  _display_name fields with digits stripped
2025-12-22 19:33:22 -08:00
LGUG2Z 2e3913c325 test(jsonschema): add json schema test suite compat tests
Add comprehensive integration tests using the official JSON-Schema-Test-Suite
draft2020-12 examples to ensure the CLI handles all valid JSON Schema constructs
without crashing.

Changes:
- Add 80 fixture files from JSON-Schema-Test-Suite draft2020-12
- Add parallelized integration test that runs CLI against all 448 schemas
- Normalize non-standard $ref patterns (root refs, JSON pointers, external URIs)
- Decode URL-encoded and JSON pointer escaped characters in $ref paths
- Embed type usages directly in $defs to avoid Tera lookup issues with
  special characters in definition names
- Handle missing $defs gracefully in template rendering

The test suite runs in ~5 seconds using Rayon for parallel execution.
2025-12-22 10:04:47 -08:00
LGUG2Z 5d606f0d87 refactor(docgen): centralize css classes and html ids
Create a single source of truth for all CSS class names and HTML element IDs
used throughout the generated documentation.

New Module (`src/identifiers.rs`):
- `HtmlIds` struct: Static HTML IDs for JS interaction (search, sidebar, etc.)
- `CssClasses` struct: All CSS class names organized by category
- `TypeClasses` struct: Type-specific badge classes (type-string, type-integer, etc.)
- Constants `IDS`, `CSS`, `TYPE_CLASSES` for compile-time access
- Serializable via serde for use in Tera templates

Class Categories:
- Layout: header, layout, main-content
- Sidebar: sidebar, sidebar-open, sidebar-toggle, sidebar-section
- Navigation: nav-list, nav-link, outline-list, outline-item
- Search: search-container, search-results, search-result-item
- Schema: schema-section, properties-container, property, property-header
- Badges: badge, required, deprecated, optional
- Types: type-badge, type-ref, and all type-specific classes
- Nested: nested-schema, array-items, tuple-items, variants
- Definition: definition, definition-name, highlight, usages

Template Updates:
- Replace hardcoded class strings with `{{ css.class_name }}` references
- Replace hardcoded IDs with `{{ ids.id_name }}` references
- Enables IDE navigation and refactoring support

Also adds `schema.json` test fixture (komorebi configuration schema)
2025-12-22 09:31:29 -08:00