lutaml-asyncapi 0.1.2 → 0.1.3
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/CLAUDE.md +39 -0
- data/README.md +5 -7
- data/lib/lutaml/asyncapi/version.rb +1 -1
- data/script/axe_audit +14 -7
- metadata +5 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5874e0efb50beace34dc8840ea03909c87578e9239e612d01c368c7a4ab95533
|
|
4
|
+
data.tar.gz: b190efedd76b979d52df26a137a1034540a8c598d39fd1f457bbf79fe541a5c4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 25504a11274bad2c5757abca81e4131ea78a30e66076a270f930cd04b28d8bb54d88fc07736343759a6b170ddedb5f4d4f993ffdc488f803ed1b34bbc91e0831
|
|
7
|
+
data.tar.gz: a104729ce809392582aa3b3e880c17a390e43ac5d3065c7510ef9f5a45b088c6213787f7cedd2994d3a987942f7f1ea059ac967053ceaac81ee45972a8985739
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## What this is
|
|
6
|
+
|
|
7
|
+
`lutaml-asyncapi` parses AsyncAPI 2.6/3.0/3.1 documents into lutaml-model objects and generates a single-file SPA documentation site from them — the event-driven counterpart of `lutaml-openapi`, and the model layer for model-based AsyncAPI standards (metanorma-ogc#153); `metanorma-plugin-asyncapi` renders these models into Metanorma documents.
|
|
8
|
+
|
|
9
|
+
## Commands
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
bundle exec rspec # full suite (17-doc corpus golden included)
|
|
13
|
+
bundle exec rspec spec/asyncapi_spec.rb # one file
|
|
14
|
+
bundle exec rubocop # lint (-a to autofix; .rubocop_todo.yml holds baselined offenses)
|
|
15
|
+
bundle exec rake # spec + rubocop + frontend:audit (axe; needs Chrome, skips cleanly without)
|
|
16
|
+
|
|
17
|
+
cd frontend && npm test # vitest (frontend i18n suite)
|
|
18
|
+
cd frontend && npm run build # vite build → frontend/dist
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`frontend/dist/` and `Gemfile.lock` are gitignored. `frontend/dist/` must exist for the SPA generator. The rake CI does NOT build the frontend — run `npm ci && npm run build` locally to verify frontend changes.
|
|
22
|
+
|
|
23
|
+
## Architecture
|
|
24
|
+
|
|
25
|
+
- **`Lutaml::Asyncapi.parse`** — the document is stored verbatim; wire round trips (`to_json`) are asserted losslessly for the whole corpus (spec/asyncapi_spec.rb iterates every fixture). Round-trip checks go through `to_json` — `Serializable#to_hash` emits Ruby attribute names, not wire names.
|
|
26
|
+
- **2.x vs 3.x dialects** — 3.x carries top-level `operations`; 2.x embeds publish/subscribe in channels. `Typed` (lib/lutaml/asyncapi/typed.rb) normalizes both into the same operation shape for the typed view; the document hash itself stays in dialect shape.
|
|
27
|
+
- `lutaml-model` is floored at `~> 0.8.132` (the nested-hash text-key corruption fix, model#1013) — the gitter + slack corpus goldens require it.
|
|
28
|
+
- **`Spa`** inlines `frontend/dist` with `window.ASYNCAPI_DATA` into a standalone `index.html`; dist enters the gem only at release time.
|
|
29
|
+
- Corpus fixtures live in `spec/fixtures/` (17 documents, official 3.1 examples + connected-systems 2.6 + EDR pubsub 3.0); new fixtures are picked up automatically.
|
|
30
|
+
|
|
31
|
+
## CI/release
|
|
32
|
+
|
|
33
|
+
- `.github/workflows/rake.yml` builds the frontend (`after-setup-ruby`) so green lanes validate the SPA.
|
|
34
|
+
- `release.yml` is self-contained (RubyGems Trusted Publishing is registered against THIS repo's workflow): dispatch with `next_version=patch|minor|major|x.y.z`. It bumps the version, builds the dist, publishes, and tags.
|
|
35
|
+
|
|
36
|
+
## Frontend
|
|
37
|
+
|
|
38
|
+
- All UI strings flow through the typed catalog `frontend/src/i18n/messages.ts` (`en` + `ar`); a missing key in a locale is a type error. The header locale switch mirrors `lang`/`dir` onto `<html>` (RTL without a second stylesheet); `?locale=ar` boots into a locale.
|
|
39
|
+
- Layout uses CSS logical properties; the axe audit gates both the LTR and Arabic RTL renders.
|
data/README.md
CHANGED
|
@@ -16,12 +16,10 @@ doc.to_json # lossless re-serialization
|
|
|
16
16
|
## Losslessness
|
|
17
17
|
|
|
18
18
|
The raw mapping is preserved verbatim: every section is kept as parsed,
|
|
19
|
-
unmodeled keywords re-emit on serialization (`map_unmapped`), and
|
|
20
|
-
round
|
|
21
|
-
`spec/fixtures
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
fixed on lutaml-model main; they rejoin the goldens at the next
|
|
25
|
-
lutaml-model release.
|
|
19
|
+
unmodeled keywords re-emit on serialization (`map_unmapped`), and the wire
|
|
20
|
+
round trip (`parse → to_json`) is asserted losslessly for the **entire
|
|
21
|
+
17-document corpus** vendored in `spec/fixtures` — the official 3.1 examples,
|
|
22
|
+
connected-systems 2.6, and the EDR pubsub 3.0 document. Wire round trips go
|
|
23
|
+
through `to_json`; `to_hash` emits Ruby attribute names, not wire names.
|
|
26
24
|
|
|
27
25
|
See [PLAN.md](PLAN.md) for the program plan.
|
data/script/axe_audit
CHANGED
|
@@ -67,15 +67,22 @@ dir = Dir.mktmpdir("axe-audit")
|
|
|
67
67
|
document = Lutaml::Asyncapi.parse(File.read(DOCUMENT))
|
|
68
68
|
File.write(File.join(dir, "index.html"), Lutaml::Asyncapi::Spa.generate(document))
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
# an empty document must boot and stay accessible too: a JS crash on
|
|
71
|
+
# missing sections would otherwise ship and only surface in production
|
|
72
|
+
empty = Lutaml::Asyncapi.parse("{}")
|
|
73
|
+
File.write(File.join(dir, "empty.html"), Lutaml::Asyncapi::Spa.generate(empty))
|
|
74
|
+
|
|
71
75
|
File.write(File.join(dir, "audit.html"),
|
|
72
|
-
File.read(
|
|
76
|
+
File.read(File.join(dir, "index.html")).sub("</body>", "#{INJECT}\n</body>"))
|
|
77
|
+
File.write(File.join(dir, "audit-empty.html"),
|
|
78
|
+
File.read(File.join(dir, "empty.html")).sub("</body>", "#{INJECT}\n</body>"))
|
|
73
79
|
|
|
74
|
-
# both locales
|
|
75
|
-
#
|
|
80
|
+
# gate matrix: both locales on the real document (the mirrored layout
|
|
81
|
+
# must stay accessible), plus the empty document in the default locale
|
|
76
82
|
VARIANTS = [
|
|
77
|
-
{ label: "en", query: "" },
|
|
78
|
-
{ label: "ar (rtl)", query: "?locale=ar" },
|
|
83
|
+
{ label: "en", page: "audit.html", query: "" },
|
|
84
|
+
{ label: "ar (rtl)", page: "audit.html", query: "?locale=ar" },
|
|
85
|
+
{ label: "empty doc", page: "audit-empty.html", query: "" },
|
|
79
86
|
].freeze
|
|
80
87
|
|
|
81
88
|
failed = false
|
|
@@ -83,7 +90,7 @@ failed = false
|
|
|
83
90
|
VARIANTS.each do |variant|
|
|
84
91
|
dom, err, status = Open3.capture3(
|
|
85
92
|
chrome, "--headless=new", "--disable-gpu", "--virtual-time-budget=20000",
|
|
86
|
-
"--dump-dom", "file://#{File.join(dir,
|
|
93
|
+
"--dump-dom", "file://#{File.join(dir, variant[:page])}#{variant[:query]}"
|
|
87
94
|
)
|
|
88
95
|
abort "axe audit: Chrome failed: #{err[0, 400]}" unless status.success?
|
|
89
96
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lutaml-asyncapi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-11-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: json
|
|
@@ -30,14 +30,14 @@ dependencies:
|
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: 0.8.
|
|
33
|
+
version: 0.8.156
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: 0.8.
|
|
40
|
+
version: 0.8.156
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: nokogiri
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -76,6 +76,7 @@ extra_rdoc_files: []
|
|
|
76
76
|
files:
|
|
77
77
|
- ".rubocop_todo.yml"
|
|
78
78
|
- CHANGELOG.md
|
|
79
|
+
- CLAUDE.md
|
|
79
80
|
- CODE_OF_CONDUCT.md
|
|
80
81
|
- LICENSE.md
|
|
81
82
|
- PLAN.md
|