mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-17 06:11:21 +01:00
Implement intelligent detection of "wrapper types" (anyOf patterns with map
variant and inner type) to render them more meaningfully in documentation.
Wrapper Type Detection:
- Detect anyOf patterns like `[{object with additionalProperties: T}, T]`
- Mark detected wrappers with `_wrapper_type` and `_wrapper_inner` metadata
- Display inner type directly instead of showing misleading "enum" badge
- Link wrapper types to their inner type definitions
- Add `_display_name` field for wrapper types with numeric suffixes
Float Display Improvements:
- Display "float" instead of "number" for JSON Schema number types in tuples
- Use `type-float` CSS class for consistent styling
- Homogeneous tuples now show as "float; N" for number arrays
Navigation Enhancements:
- Build navigation from prepared schema (includes wrapper display names)
- Add `display_names` map to template context for type name resolution
- Track type usages for "Usages" section in definitions
Test Coverage:
- Add comprehensive tests for wrapper type rendering
- Test tuple float/integer display formatting
- Verify wrapper types don't show "Enum variants" dropdown
- Test non-wrapper anyOf still correctly shows enum badge
28 lines
542 B
TOML
28 lines
542 B
TOML
[package]
|
|
name = "schemars-docgen"
|
|
version = "0.1.0"
|
|
edition = "2024"
|
|
description = "Generate HTML documentation from schemars::Schema objects"
|
|
license-file = "LICENSE.md"
|
|
|
|
[lib]
|
|
name = "schemars_docgen"
|
|
path = "src/lib.rs"
|
|
|
|
[[bin]]
|
|
name = "schemars-docgen"
|
|
path = "src/main.rs"
|
|
|
|
[dependencies]
|
|
schemars = "1.1"
|
|
serde = { version = "1.0", features = ["derive"] }
|
|
serde_json = "1.0"
|
|
tera = "1.19"
|
|
pulldown-cmark = "0.12"
|
|
clap = { version = "4", features = ["derive"] }
|
|
thiserror = "2"
|
|
|
|
[dev-dependencies]
|
|
pretty_assertions = "1.4"
|
|
regex = "1"
|