lutaml-xsd 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +37 -3
- data/README.adoc +12 -96
- data/docs/CLI.adoc +5 -14
- data/docs/FAQ.adoc +1 -1
- data/docs/SPA_CONFIGURATION.adoc +1 -1
- data/docs/SPA_GUIDE.adoc +40 -187
- data/docs/URL_FETCHING.adoc +5 -6
- data/docs/advanced/INTEGRATION_PATTERNS.adoc +10 -11
- data/docs/advanced/SCHEMA_MAPPING_PATTERNS.adoc +4 -3
- data/examples/02-urban-function/README.adoc +2 -7
- data/examples/02-urban-function/cli/run.sh +1 -2
- data/examples/02-urban-function/ruby-api/example.rb +1 -1
- data/examples/02-urban-function/scripts/map_uro_types.rb +4 -3
- data/examples/06-package-composition/README.adoc +1 -1
- data/examples/07-package-merge/README.adoc +2 -3
- data/lib/lutaml/xsd/cli.rb +15 -32
- data/lib/lutaml/xsd/commands/generate_spa_command.rb +3 -3
- data/lib/lutaml/xsd/commands/package_command.rb +4 -1
- data/lib/lutaml/xsd/definition_extractor.rb +6 -7
- data/lib/lutaml/xsd/package_builder.rb +39 -0
- data/lib/lutaml/xsd/spa/generator.rb +7 -7
- data/lib/lutaml/xsd/spa/schema_serializer.rb +43 -25
- data/lib/lutaml/xsd/spa/utils/extract_enumeration.rb +4 -1
- data/lib/lutaml/xsd/spa/xml_instance_generator.rb +1 -1
- data/lib/lutaml/xsd/validation/xml_navigator.rb +3 -3
- data/lib/lutaml/xsd/version.rb +1 -1
- data/lib/lutaml/xsd.rb +0 -3
- metadata +2 -3
- data/lib/lutaml/xsd/commands/doc_command.rb +0 -61
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e6278aec90450f0666ccb21d61f3afa2f7f77be209dac10da32c991841a31a7d
|
|
4
|
+
data.tar.gz: 5dc436d5d5e8323fec4bd2fe2928f0890de032e626d0f4bde19baf5570acaccb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5491e6d47a6d39bbb0ff66ab75334aaafebfbc171de6117bfd9b5fae07badea0d53239941c1539d3d67c6e49dfda736e6420b489036a56529affca0f89431e17
|
|
7
|
+
data.tar.gz: 2e020487a42d0c3eaf86ad45040719632178147891edf4b35caa6d7d9d1fad310ed9682f4a5c70627429078d2db472997aa691e7da7f19e1d355b816afea0444
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on 2026-04-
|
|
3
|
+
# on 2026-04-25 09:44:01 UTC using RuboCop version 1.86.1.
|
|
4
4
|
# The point is for the user to remove these configuration records
|
|
5
5
|
# one by one as the offenses are removed from the code base.
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
@@ -11,6 +11,29 @@ Gemspec/RequiredRubyVersion:
|
|
|
11
11
|
Exclude:
|
|
12
12
|
- 'lutaml-xsd.gemspec'
|
|
13
13
|
|
|
14
|
+
# Offense count: 2
|
|
15
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
16
|
+
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
17
|
+
# SupportedStyles: with_first_element, with_fixed_indentation
|
|
18
|
+
Layout/ArrayAlignment:
|
|
19
|
+
Exclude:
|
|
20
|
+
- 'lib/lutaml/xsd/spa/schema_serializer.rb'
|
|
21
|
+
- 'lib/lutaml/xsd/spa/utils/extract_enumeration.rb'
|
|
22
|
+
|
|
23
|
+
# Offense count: 4
|
|
24
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
25
|
+
# Configuration parameters: IndentationWidth.
|
|
26
|
+
Layout/AssignmentIndentation:
|
|
27
|
+
Exclude:
|
|
28
|
+
- 'lib/lutaml/xsd/commands/package_command.rb'
|
|
29
|
+
- 'lib/lutaml/xsd/spa/schema_serializer.rb'
|
|
30
|
+
|
|
31
|
+
# Offense count: 7
|
|
32
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
33
|
+
Layout/ClosingParenthesisIndentation:
|
|
34
|
+
Exclude:
|
|
35
|
+
- 'lib/lutaml/xsd/spa/schema_serializer.rb'
|
|
36
|
+
|
|
14
37
|
# Offense count: 1
|
|
15
38
|
# This cop supports safe autocorrection (--autocorrect).
|
|
16
39
|
# Configuration parameters: EnforcedStyleAlignWith.
|
|
@@ -45,7 +68,7 @@ Layout/IndentationWidth:
|
|
|
45
68
|
Exclude:
|
|
46
69
|
- 'lib/lutaml/xsd/spa/schema_serializer.rb'
|
|
47
70
|
|
|
48
|
-
# Offense count:
|
|
71
|
+
# Offense count: 730
|
|
49
72
|
# This cop supports safe autocorrection (--autocorrect).
|
|
50
73
|
# Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
|
|
51
74
|
# URISchemes: http, https
|
|
@@ -60,11 +83,14 @@ Layout/MultilineMethodCallBraceLayout:
|
|
|
60
83
|
Exclude:
|
|
61
84
|
- 'lib/lutaml/xsd/spa/schema_serializer.rb'
|
|
62
85
|
|
|
63
|
-
# Offense count:
|
|
86
|
+
# Offense count: 11
|
|
64
87
|
# This cop supports safe autocorrection (--autocorrect).
|
|
65
88
|
# Configuration parameters: AllowInHeredoc.
|
|
66
89
|
Layout/TrailingWhitespace:
|
|
67
90
|
Exclude:
|
|
91
|
+
- 'lib/lutaml/xsd/commands/package_command.rb'
|
|
92
|
+
- 'lib/lutaml/xsd/spa/schema_serializer.rb'
|
|
93
|
+
- 'lib/lutaml/xsd/spa/utils/extract_enumeration.rb'
|
|
68
94
|
- 'lib/lutaml/xsd/spa/xml_instance_generator.rb'
|
|
69
95
|
|
|
70
96
|
# Offense count: 11
|
|
@@ -222,6 +248,14 @@ Style/IdenticalConditionalBranches:
|
|
|
222
248
|
Exclude:
|
|
223
249
|
- 'lib/lutaml/xsd/package_tree_formatter.rb'
|
|
224
250
|
|
|
251
|
+
# Offense count: 3
|
|
252
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
253
|
+
Style/MultilineIfModifier:
|
|
254
|
+
Exclude:
|
|
255
|
+
- 'lib/lutaml/xsd/commands/package_command.rb'
|
|
256
|
+
- 'lib/lutaml/xsd/spa/schema_serializer.rb'
|
|
257
|
+
- 'lib/lutaml/xsd/spa/utils/extract_enumeration.rb'
|
|
258
|
+
|
|
225
259
|
# Offense count: 1
|
|
226
260
|
Style/OpenStructUse:
|
|
227
261
|
Exclude:
|
data/README.adoc
CHANGED
|
@@ -42,7 +42,7 @@ allowing you to shape and structure your data into useful forms.
|
|
|
42
42
|
|
|
43
43
|
* <<spa-documentation,SPA documentation generation>> - Modern, responsive,
|
|
44
44
|
interactive HTML documentation with schema navigation and search
|
|
45
|
-
- Single-file
|
|
45
|
+
- Single-file mode
|
|
46
46
|
- Entrypoint prioritization in sidebar
|
|
47
47
|
- Schema detail views with elements/types/attributes tables
|
|
48
48
|
- Hash-based navigation with browser back/forward support
|
|
@@ -63,7 +63,7 @@ allowing you to shape and structure your data into useful forms.
|
|
|
63
63
|
- `pkg` commands for package inspection
|
|
64
64
|
- `xml` commands for XML validation
|
|
65
65
|
- `build` commands for package creation
|
|
66
|
-
- `
|
|
66
|
+
- `spa` command for documentation generation
|
|
67
67
|
* <<lxr-packages,LXR (LutaML XSD Repository) packages>> for distributable,
|
|
68
68
|
pre-indexed schema collections
|
|
69
69
|
* <<parsing-xsd,XSD file parsing>> with full schema structure support
|
|
@@ -127,10 +127,10 @@ Generate single-file documentation:
|
|
|
127
127
|
[source,bash]
|
|
128
128
|
----
|
|
129
129
|
# Generate standalone HTML file with semantic URLs
|
|
130
|
-
lutaml-xsd
|
|
130
|
+
lutaml-xsd spa your_package.lxr --output docs.html
|
|
131
131
|
|
|
132
132
|
# Generate with custom title
|
|
133
|
-
lutaml-xsd
|
|
133
|
+
lutaml-xsd spa schemas.lxr --output docs.html \
|
|
134
134
|
--title "My Schema Documentation"
|
|
135
135
|
----
|
|
136
136
|
|
|
@@ -141,21 +141,6 @@ lutaml-xsd doc spa schemas.lxr --mode single_file --output docs.html \
|
|
|
141
141
|
* Clickable cross-references throughout
|
|
142
142
|
* xs3p-quality documentation
|
|
143
143
|
|
|
144
|
-
Generate API-mode documentation with server:
|
|
145
|
-
|
|
146
|
-
[source,bash]
|
|
147
|
-
----
|
|
148
|
-
# Generate API-based SPA with Sinatra server
|
|
149
|
-
lutaml-xsd doc spa your_package.lxr --mode api --output-dir docs/
|
|
150
|
-
|
|
151
|
-
# Start the server
|
|
152
|
-
cd docs/
|
|
153
|
-
bundle install
|
|
154
|
-
bundle exec rackup
|
|
155
|
-
|
|
156
|
-
# Access at http://localhost:9292
|
|
157
|
-
----
|
|
158
|
-
|
|
159
144
|
=== Navigation and Linking
|
|
160
145
|
|
|
161
146
|
The generated SPA provides comprehensive navigation:
|
|
@@ -213,21 +198,7 @@ Perfect for:
|
|
|
213
198
|
|
|
214
199
|
[source,bash]
|
|
215
200
|
----
|
|
216
|
-
lutaml-xsd
|
|
217
|
-
----
|
|
218
|
-
|
|
219
|
-
==== Multi-file mode
|
|
220
|
-
|
|
221
|
-
Generates a documentation site with separate resource files. Perfect for:
|
|
222
|
-
|
|
223
|
-
* Web hosting (better caching)
|
|
224
|
-
* Larger schema sets (faster loading)
|
|
225
|
-
* Professional deployment
|
|
226
|
-
* CDN optimization
|
|
227
|
-
|
|
228
|
-
[source,bash]
|
|
229
|
-
----
|
|
230
|
-
lutaml-xsd generate-spa schemas.lxr --mode multi_file --output-dir ./docs
|
|
201
|
+
lutaml-xsd spa schemas.lxr --output schema-docs.html
|
|
231
202
|
----
|
|
232
203
|
|
|
233
204
|
=== Configuration
|
|
@@ -244,8 +215,7 @@ The SPA generator is fully configurable via YAML files in `config/spa/`:
|
|
|
244
215
|
[source,bash]
|
|
245
216
|
----
|
|
246
217
|
# Generate with custom configuration
|
|
247
|
-
lutaml-xsd
|
|
248
|
-
--mode single_file \
|
|
218
|
+
lutaml-xsd spa schemas.lxr \
|
|
249
219
|
--output custom-docs.html \
|
|
250
220
|
--config config/my-custom-spa-config.yml \
|
|
251
221
|
--title "Custom Schema Docs"
|
|
@@ -559,7 +529,7 @@ Where `<CATEGORY>` is one of:
|
|
|
559
529
|
`pkg`:: Package inspection commands (operate on `.lxr` files)
|
|
560
530
|
`xml`:: XML validation commands (operate on `.xml` files)
|
|
561
531
|
`build`:: Package creation commands (operate on `.yml` configs)
|
|
562
|
-
`
|
|
532
|
+
`spa`:: Documentation generation (operate on `.lxr` files)
|
|
563
533
|
|
|
564
534
|
This structure ensures:
|
|
565
535
|
|
|
@@ -923,73 +893,19 @@ Each warning shows:
|
|
|
923
893
|
* Actionable hint for resolution
|
|
924
894
|
====
|
|
925
895
|
|
|
926
|
-
===
|
|
896
|
+
=== SPA command (documentation generation)
|
|
927
897
|
|
|
928
898
|
Generate documentation from LXR packages.
|
|
929
899
|
|
|
930
900
|
[source,bash]
|
|
931
901
|
----
|
|
932
|
-
# Generate
|
|
933
|
-
lutaml-xsd
|
|
934
|
-
|
|
935
|
-
# Generate SPA with API mode (multi-file with server)
|
|
936
|
-
lutaml-xsd doc spa <package.lxr> --mode api --output-dir docs/
|
|
937
|
-
|
|
938
|
-
# Generate markdown documentation
|
|
939
|
-
lutaml-xsd doc markdown <package.lxr> --output-dir docs/
|
|
940
|
-
----
|
|
941
|
-
|
|
942
|
-
==== API mode documentation
|
|
902
|
+
# Generate single-file documentation
|
|
903
|
+
lutaml-xsd spa <package.lxr> --output docs.html
|
|
943
904
|
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
.Generating API-mode SPA
|
|
948
|
-
[example]
|
|
949
|
-
====
|
|
950
|
-
[source,bash]
|
|
951
|
-
----
|
|
952
|
-
# Generate with API mode
|
|
953
|
-
$ lutaml-xsd doc spa pkg/urban_function_repository.lxr \
|
|
954
|
-
--mode api \
|
|
955
|
-
--output-dir tmp/api_docs
|
|
956
|
-
|
|
957
|
-
SPA Documentation Generated Successfully
|
|
958
|
-
════════════════════════════════════════════════════════════════
|
|
959
|
-
|
|
960
|
-
Output files (6 total):
|
|
961
|
-
tmp/api_docs/public/index.html
|
|
962
|
-
tmp/api_docs/data/schemas.json
|
|
963
|
-
tmp/api_docs/lib/app.rb
|
|
964
|
-
tmp/api_docs/config.ru
|
|
965
|
-
tmp/api_docs/Gemfile
|
|
966
|
-
tmp/api_docs/README.md
|
|
967
|
-
|
|
968
|
-
✓ Generation complete
|
|
969
|
-
|
|
970
|
-
# Install dependencies and start server
|
|
971
|
-
$ cd tmp/api_docs
|
|
972
|
-
$ bundle install
|
|
973
|
-
$ bundle exec rackup
|
|
974
|
-
|
|
975
|
-
# Access at http://localhost:9292
|
|
905
|
+
# Generate with custom title
|
|
906
|
+
lutaml-xsd spa <package.lxr> --output docs.html --title "My Docs"
|
|
976
907
|
----
|
|
977
908
|
|
|
978
|
-
The API mode provides:
|
|
979
|
-
|
|
980
|
-
* **Separate frontend and backend**: HTML/JS frontend fetches data via API
|
|
981
|
-
* **RESTful endpoints**: `/api/schemas`, `/api/schemas/:id`, `/api/health`
|
|
982
|
-
* **CORS enabled**: Can be used by external applications
|
|
983
|
-
* **Production ready**: Sinatra server with proper error handling
|
|
984
|
-
|
|
985
|
-
API endpoints:
|
|
986
|
-
|
|
987
|
-
* `GET /` - Serves the frontend HTML
|
|
988
|
-
* `GET /api/schemas` - Returns all schema data as JSON
|
|
989
|
-
* `GET /api/schemas/:id` - Returns specific schema by ID
|
|
990
|
-
* `GET /api/health` - Health check endpoint
|
|
991
|
-
====
|
|
992
|
-
|
|
993
909
|
=== Table formatting
|
|
994
910
|
|
|
995
911
|
All CLI table output uses the `table-tennis` gem for beautiful, auto-themed
|
data/docs/CLI.adoc
CHANGED
|
@@ -487,20 +487,11 @@ lutaml-xsd xml validate instance.xml \
|
|
|
487
487
|
====
|
|
488
488
|
[source,bash]
|
|
489
489
|
----
|
|
490
|
-
# Single file output
|
|
491
|
-
lutaml-xsd
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
# Multi-file output
|
|
496
|
-
lutaml-xsd doc spa my_composition.yml \
|
|
497
|
-
--mode multi_file \
|
|
498
|
-
--output docs/
|
|
499
|
-
|
|
500
|
-
# API mode output
|
|
501
|
-
lutaml-xsd doc spa my_composition.yml \
|
|
502
|
-
--mode api \
|
|
503
|
-
--output api/
|
|
490
|
+
# Single file output (default)
|
|
491
|
+
lutaml-xsd spa my_composition.yml --output docs.html
|
|
492
|
+
|
|
493
|
+
# With separate asset files
|
|
494
|
+
lutaml-xsd spa my_composition.yml --output docs.html --mode cdn
|
|
504
495
|
----
|
|
505
496
|
====
|
|
506
497
|
|
data/docs/FAQ.adoc
CHANGED
|
@@ -457,7 +457,7 @@ Note: `marshal` format packages may not be compatible across different Ruby majo
|
|
|
457
457
|
|
|
458
458
|
Yes! Lutaml::XSD is complementary to other XML tools:
|
|
459
459
|
|
|
460
|
-
* **
|
|
460
|
+
* **Moxml**: Unified XML adapter layer
|
|
461
461
|
* **REXML**: Use for lightweight XML processing
|
|
462
462
|
* **Ox**: Use for fast XML parsing
|
|
463
463
|
|
data/docs/SPA_CONFIGURATION.adoc
CHANGED
data/docs/SPA_GUIDE.adoc
CHANGED
|
@@ -16,9 +16,9 @@ The SPA (Single Page Application) Documentation Generator creates modern, intera
|
|
|
16
16
|
* **Advanced search** - Real-time fuzzy matching across all schema components
|
|
17
17
|
* **Type filtering** - Filter by element, complex type, simple type, attribute group, group
|
|
18
18
|
* **Zero dependencies** - Self-contained HTML, CSS, and JavaScript
|
|
19
|
-
* **Offline-capable** - Works without internet connection (
|
|
19
|
+
* **Offline-capable** - Works without internet connection (inlined mode)
|
|
20
20
|
* **Accessibility** - WCAG 2.1 AA compliant
|
|
21
|
-
* **
|
|
21
|
+
* **Two output modes** - Single-file (inlined) or separate assets (cdn)
|
|
22
22
|
|
|
23
23
|
=== When to use SPA documentation
|
|
24
24
|
|
|
@@ -40,42 +40,25 @@ Use the SPA generator when you need to:
|
|
|
40
40
|
|
|
41
41
|
=== Quick start
|
|
42
42
|
|
|
43
|
-
Generate single-file documentation:
|
|
44
|
-
|
|
45
43
|
[source,bash]
|
|
46
44
|
----
|
|
47
|
-
# From an LXR package
|
|
48
|
-
lutaml-xsd
|
|
45
|
+
# From an LXR package (generates single self-contained HTML)
|
|
46
|
+
lutaml-xsd spa schemas.lxr --output docs.html
|
|
49
47
|
|
|
50
48
|
# With custom title
|
|
51
|
-
lutaml-xsd
|
|
52
|
-
--mode single_file \
|
|
53
|
-
--output schema-docs.html \
|
|
54
|
-
--title "My Schema Documentation"
|
|
55
|
-
----
|
|
49
|
+
lutaml-xsd spa schemas.lxr --output schema-docs.html --title "My Schema Documentation"
|
|
56
50
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
[source,bash]
|
|
60
|
-
----
|
|
61
|
-
# Creates a directory with separate files
|
|
62
|
-
lutaml-xsd generate-spa schemas.lxr \
|
|
63
|
-
--mode multi_file \
|
|
64
|
-
--output-dir ./docs
|
|
65
|
-
|
|
66
|
-
# Generate API-based documentation with Sinatra server
|
|
67
|
-
lutaml-xsd generate-spa schemas.lxr \
|
|
68
|
-
--mode api \
|
|
69
|
-
--output-dir ./docs-api
|
|
51
|
+
# With separate asset files (requires HTTP server)
|
|
52
|
+
lutaml-xsd spa schemas.lxr --output docs.html --mode cdn
|
|
70
53
|
----
|
|
71
54
|
|
|
72
55
|
Open the generated HTML file in your browser to view the documentation.
|
|
73
56
|
|
|
74
57
|
== Output modes
|
|
75
58
|
|
|
76
|
-
===
|
|
59
|
+
=== Inlined mode (default)
|
|
77
60
|
|
|
78
|
-
|
|
61
|
+
Inlined mode generates a standalone HTML file with all assets embedded.
|
|
79
62
|
|
|
80
63
|
==== Advantages
|
|
81
64
|
|
|
@@ -92,7 +75,7 @@ Single-file mode generates a standalone HTML file with all assets embedded.
|
|
|
92
75
|
|
|
93
76
|
==== When to use
|
|
94
77
|
|
|
95
|
-
Use
|
|
78
|
+
Use inlined mode for:
|
|
96
79
|
|
|
97
80
|
* Email attachments or file sharing
|
|
98
81
|
* Offline documentation needs
|
|
@@ -105,8 +88,7 @@ Use single-file mode for:
|
|
|
105
88
|
[source,bash]
|
|
106
89
|
----
|
|
107
90
|
# Generate standalone documentation
|
|
108
|
-
lutaml-xsd
|
|
109
|
-
--mode single_file \
|
|
91
|
+
lutaml-xsd spa person_schemas.lxr \
|
|
110
92
|
--output person-documentation.html \
|
|
111
93
|
--title "Person Schema Documentation"
|
|
112
94
|
----
|
|
@@ -116,154 +98,33 @@ Output:
|
|
|
116
98
|
person-documentation.html (125 KB)
|
|
117
99
|
----
|
|
118
100
|
|
|
119
|
-
===
|
|
120
|
-
|
|
121
|
-
Multi-file mode generates a documentation site with separate resource files.
|
|
101
|
+
=== CDN mode
|
|
122
102
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
* **Better caching** - Browser caches CSS/JS separately
|
|
126
|
-
* **Faster loading** - Smaller HTML file loads faster
|
|
127
|
-
* **Professional** - Standard web application structure
|
|
128
|
-
* **CDN-friendly** - Can serve static assets from CDN
|
|
129
|
-
|
|
130
|
-
==== Disadvantages
|
|
131
|
-
|
|
132
|
-
* **Multiple files** - Must deploy entire directory
|
|
133
|
-
* **Relative paths** - Files must maintain relative structure
|
|
134
|
-
* **More complex** - Requires web server or proper file serving
|
|
103
|
+
Generates an HTML file with separate JavaScript and CSS files alongside it. The HTML loads Vue.js from a CDN. Requires serving via HTTP (not file://).
|
|
135
104
|
|
|
136
105
|
==== When to use
|
|
137
106
|
|
|
138
|
-
Use
|
|
107
|
+
Use CDN mode for:
|
|
139
108
|
|
|
140
|
-
* Web hosting
|
|
109
|
+
* Web hosting with better caching
|
|
141
110
|
* Larger schema sets
|
|
142
|
-
* Professional deployment
|
|
143
|
-
* Sites with regular updates
|
|
144
|
-
* CDN optimization
|
|
111
|
+
* Professional deployment behind a web server
|
|
145
112
|
|
|
146
113
|
==== Example
|
|
147
114
|
|
|
148
115
|
[source,bash]
|
|
149
116
|
----
|
|
150
|
-
# Generate
|
|
151
|
-
lutaml-xsd
|
|
152
|
-
--mode multi_file \
|
|
153
|
-
--output-dir ./docs \
|
|
154
|
-
--title "Person Schema Documentation"
|
|
117
|
+
# Generate documentation with separate assets
|
|
118
|
+
lutaml-xsd spa person_schemas.lxr --output docs.html --mode cdn
|
|
155
119
|
----
|
|
156
120
|
|
|
157
121
|
Output:
|
|
158
122
|
----
|
|
159
123
|
docs/
|
|
160
|
-
├──
|
|
161
|
-
├──
|
|
162
|
-
|
|
163
|
-
├── js/
|
|
164
|
-
│ └── app.js (18 KB)
|
|
165
|
-
└── data/
|
|
166
|
-
└── schemas.json (12 KB)
|
|
167
|
-
----
|
|
168
|
-
|
|
169
|
-
=== API mode (Sinatra server)
|
|
170
|
-
|
|
171
|
-
API mode generates a complete Sinatra-based web application with a true REST API backend.
|
|
172
|
-
|
|
173
|
-
==== Advantages
|
|
174
|
-
|
|
175
|
-
* **True API backend** - Separate frontend and backend architecture
|
|
176
|
-
* **Scalable** - Can handle multiple concurrent requests
|
|
177
|
-
* **Development-friendly** - Hot-reload during development
|
|
178
|
-
* **RESTful architecture** - Standard REST API endpoints
|
|
179
|
-
* **CORS enabled** -Works with SPA frontends from different origins
|
|
180
|
-
|
|
181
|
-
==== Disadvantages
|
|
182
|
-
|
|
183
|
-
* **Requires Ruby** - Server must run Ruby application
|
|
184
|
-
* **More complex** - Requires server setup and maintenance
|
|
185
|
-
* **Not static** - Cannot deploy to static hosts
|
|
186
|
-
* **Resource intensive** -Requires running Ruby process
|
|
187
|
-
|
|
188
|
-
==== When to use
|
|
189
|
-
|
|
190
|
-
Use API mode for:
|
|
191
|
-
|
|
192
|
-
* Development and testing environments
|
|
193
|
-
* When you need a true API backend
|
|
194
|
-
* Integrating schema documentation into larger applications
|
|
195
|
-
* Building custom frontends that consume schema data
|
|
196
|
-
* Internal tools with API requirements
|
|
197
|
-
|
|
198
|
-
==== Example
|
|
199
|
-
|
|
200
|
-
[source,bash]
|
|
201
|
-
----
|
|
202
|
-
# Generate API-based documentation
|
|
203
|
-
lutaml-xsd generate-spa person_schemas.lxr \
|
|
204
|
-
--mode api \
|
|
205
|
-
--output-dir ./docs-api \
|
|
206
|
-
--title "Person Schema API"
|
|
207
|
-
----
|
|
208
|
-
|
|
209
|
-
Output:
|
|
210
|
-
----
|
|
211
|
-
docs-api/
|
|
212
|
-
├── public/
|
|
213
|
-
│ └── index.html (15 KB, SPA frontend)
|
|
214
|
-
├── lib/
|
|
215
|
-
│ └── app.rb (Sinatra server)
|
|
216
|
-
├── data/
|
|
217
|
-
│ └── schemas.json (12 KB)
|
|
218
|
-
├── config.ru (Rack configuration)
|
|
219
|
-
├── Gemfile (Dependencies)
|
|
220
|
-
└── README.md (Usage instructions)
|
|
221
|
-
----
|
|
222
|
-
|
|
223
|
-
==== Running the API server
|
|
224
|
-
|
|
225
|
-
After generation, start the Sinatra server:
|
|
226
|
-
|
|
227
|
-
[source,bash]
|
|
228
|
-
----
|
|
229
|
-
cd docs-api
|
|
230
|
-
|
|
231
|
-
# Install dependencies
|
|
232
|
-
bundle install
|
|
233
|
-
|
|
234
|
-
# Start server (default port 9292)
|
|
235
|
-
bundle exec rackup
|
|
236
|
-
|
|
237
|
-
# Or specify custom port
|
|
238
|
-
PORT=3000 bundle exec rackup
|
|
239
|
-
----
|
|
240
|
-
|
|
241
|
-
Then open http://localhost:9292 in your browser.
|
|
242
|
-
|
|
243
|
-
==== API endpoints
|
|
244
|
-
|
|
245
|
-
The generated server provides these REST API endpoints:
|
|
246
|
-
|
|
247
|
-
* `GET /` - Serve frontend HTML
|
|
248
|
-
* `GET /api/schemas` - Get all schemas (JSON)
|
|
249
|
-
* `GET /api/schemas/:id` - Get specific schema by ID
|
|
250
|
-
* `GET /api/health` - Health check endpoint
|
|
251
|
-
|
|
252
|
-
.Testing API endpoints
|
|
253
|
-
[example]
|
|
254
|
-
====
|
|
255
|
-
[source,bash]
|
|
124
|
+
├── docs.html (HTML that loads assets externally)
|
|
125
|
+
├── app.iife.js (Application JavaScript)
|
|
126
|
+
└── style.css (Stylesheet)
|
|
256
127
|
----
|
|
257
|
-
# Get all schemas
|
|
258
|
-
curl http://localhost:9292/api/schemas
|
|
259
|
-
|
|
260
|
-
# Get specific schema
|
|
261
|
-
curl http://localhost:9292/api/schemas/schema-0
|
|
262
|
-
|
|
263
|
-
# Health check
|
|
264
|
-
curl http://localhost:9292/api/health
|
|
265
|
-
----
|
|
266
|
-
====
|
|
267
128
|
|
|
268
129
|
== Using the documentation
|
|
269
130
|
|
|
@@ -340,8 +201,7 @@ Specify a custom configuration file:
|
|
|
340
201
|
|
|
341
202
|
[source,bash]
|
|
342
203
|
----
|
|
343
|
-
lutaml-xsd
|
|
344
|
-
--mode single_file \
|
|
204
|
+
lutaml-xsd spa schemas.lxr \
|
|
345
205
|
--output docs.html \
|
|
346
206
|
--config my-spa-config.yml
|
|
347
207
|
----
|
|
@@ -438,7 +298,7 @@ Use your theme:
|
|
|
438
298
|
|
|
439
299
|
[source,bash]
|
|
440
300
|
----
|
|
441
|
-
lutaml-xsd
|
|
301
|
+
lutaml-xsd spa schemas.lxr \
|
|
442
302
|
--config my-theme.yml \
|
|
443
303
|
--output custom-docs.html
|
|
444
304
|
----
|
|
@@ -449,7 +309,7 @@ Set a custom documentation title:
|
|
|
449
309
|
|
|
450
310
|
[source,bash]
|
|
451
311
|
----
|
|
452
|
-
lutaml-xsd
|
|
312
|
+
lutaml-xsd spa schemas.lxr \
|
|
453
313
|
--title "My Company Schema Reference" \
|
|
454
314
|
--output docs.html
|
|
455
315
|
----
|
|
@@ -476,7 +336,7 @@ features:
|
|
|
476
336
|
|
|
477
337
|
=== Local file system
|
|
478
338
|
|
|
479
|
-
For
|
|
339
|
+
For inlined mode, just open the HTML file:
|
|
480
340
|
|
|
481
341
|
[source,bash]
|
|
482
342
|
----
|
|
@@ -492,16 +352,14 @@ start docs.html
|
|
|
492
352
|
|
|
493
353
|
=== Static web hosting
|
|
494
354
|
|
|
495
|
-
Deploy
|
|
355
|
+
Deploy CDN-mode documentation to static hosts:
|
|
496
356
|
|
|
497
357
|
==== GitHub Pages
|
|
498
358
|
|
|
499
359
|
[source,bash]
|
|
500
360
|
----
|
|
501
361
|
# Generate documentation
|
|
502
|
-
lutaml-xsd
|
|
503
|
-
--mode multi_file \
|
|
504
|
-
--output-dir ./docs
|
|
362
|
+
lutaml-xsd spa schemas.lxr --output docs.html --mode cdn
|
|
505
363
|
|
|
506
364
|
# Commit and push
|
|
507
365
|
git add docs/
|
|
@@ -517,17 +375,15 @@ git push
|
|
|
517
375
|
[source,bash]
|
|
518
376
|
----
|
|
519
377
|
# Generate documentation
|
|
520
|
-
lutaml-xsd
|
|
521
|
-
--mode multi_file \
|
|
522
|
-
--output-dir ./public
|
|
378
|
+
lutaml-xsd spa schemas.lxr --output docs.html --mode cdn
|
|
523
379
|
|
|
524
380
|
# Deploy with Netlify CLI
|
|
525
|
-
netlify deploy --prod --dir=
|
|
381
|
+
netlify deploy --prod --dir=docs
|
|
526
382
|
----
|
|
527
383
|
|
|
528
384
|
==== Other static hosts
|
|
529
385
|
|
|
530
|
-
The
|
|
386
|
+
The CDN output works with any static file host:
|
|
531
387
|
|
|
532
388
|
* **Vercel** - Deploy `docs/` directory
|
|
533
389
|
* **AWS S3** - Upload to bucket, enable static hosting
|
|
@@ -552,7 +408,7 @@ See link:SPA_DEPLOYMENT.adoc[Deployment Guide] for detailed instructions.
|
|
|
552
408
|
ls -l schemas.lxr
|
|
553
409
|
|
|
554
410
|
# Use absolute path if needed
|
|
555
|
-
lutaml-xsd
|
|
411
|
+
lutaml-xsd spa /absolute/path/to/schemas.lxr --output docs.html
|
|
556
412
|
----
|
|
557
413
|
|
|
558
414
|
==== "Template not found"
|
|
@@ -580,9 +436,8 @@ gem update lutaml-xsd
|
|
|
580
436
|
[source,bash]
|
|
581
437
|
----
|
|
582
438
|
# Use correct mode values
|
|
583
|
-
lutaml-xsd
|
|
584
|
-
lutaml-xsd
|
|
585
|
-
lutaml-xsd generate-spa schemas.lxr --mode api # API mode
|
|
439
|
+
lutaml-xsd spa schemas.lxr --mode inlined # Default, single self-contained HTML
|
|
440
|
+
lutaml-xsd spa schemas.lxr --mode cdn # Separate asset files
|
|
586
441
|
----
|
|
587
442
|
|
|
588
443
|
==== Dark mode not working
|
|
@@ -631,7 +486,7 @@ If you encounter issues:
|
|
|
631
486
|
|
|
632
487
|
=== Performance
|
|
633
488
|
|
|
634
|
-
* **Use
|
|
489
|
+
* **Use CDN mode for large schemas** - Better caching and loading
|
|
635
490
|
* **Enable CDN** - Serve static assets from CDN
|
|
636
491
|
* **Compress assets** - Enable gzip on web server
|
|
637
492
|
* **Lazy loading** - Load schema details on demand
|
|
@@ -659,7 +514,7 @@ echo "files:\n - schema.xsd" > config.yaml
|
|
|
659
514
|
lutaml-xsd pkg build config.yaml -o schemas.lxr
|
|
660
515
|
|
|
661
516
|
# Generate documentation
|
|
662
|
-
lutaml-xsd
|
|
517
|
+
lutaml-xsd spa schemas.lxr --output docs.html
|
|
663
518
|
----
|
|
664
519
|
|
|
665
520
|
=== How do I update the documentation?
|
|
@@ -669,7 +524,7 @@ Regenerate it using the same command:
|
|
|
669
524
|
[source,bash]
|
|
670
525
|
----
|
|
671
526
|
# Regenerates with latest schema changes
|
|
672
|
-
lutaml-xsd
|
|
527
|
+
lutaml-xsd spa updated-schemas.lxr --output docs.html
|
|
673
528
|
----
|
|
674
529
|
|
|
675
530
|
=== Can I customize the HTML structure?
|
|
@@ -682,11 +537,9 @@ The HTML structure is controlled by Liquid templates. To customize:
|
|
|
682
537
|
|
|
683
538
|
=== Does it work offline?
|
|
684
539
|
|
|
685
|
-
|
|
540
|
+
Inlined mode works offline:
|
|
686
541
|
|
|
687
|
-
* **
|
|
688
|
-
* **Multi-file** - All files are local, no external requests
|
|
689
|
-
* **API mode** - Requires running server, no external requests once running
|
|
542
|
+
* **Inlined** - Completely self-contained, no external requests
|
|
690
543
|
|
|
691
544
|
=== What browsers are supported?
|
|
692
545
|
|
|
@@ -706,11 +559,11 @@ The generator handles schemas of any size, but browser performance varies:
|
|
|
706
559
|
* **Small** (< 50 types) - Excellent performance
|
|
707
560
|
* **Medium** (50-500 types) - Good performance
|
|
708
561
|
* **Large** (500-2000 types) - Acceptable performance
|
|
709
|
-
* **Very large** (> 2000 types) - May be slow, use
|
|
562
|
+
* **Very large** (> 2000 types) - May be slow, use CDN mode
|
|
710
563
|
|
|
711
564
|
For very large schemas, consider:
|
|
712
565
|
|
|
713
|
-
* Using
|
|
566
|
+
* Using CDN mode
|
|
714
567
|
* Splitting into multiple packages
|
|
715
568
|
* Enabling lazy loading features
|
|
716
569
|
|