Skip to content

Replace JSON with XML as primary doc source#2

Merged
deevus merged 19 commits intomainfrom
feature/xml-docs-primary-source
Mar 21, 2026
Merged

Replace JSON with XML as primary doc source#2
deevus merged 19 commits intomainfrom
feature/xml-docs-primary-source

Conversation

@deevus
Copy link
Copy Markdown
Contributor

@deevus deevus commented Mar 21, 2026

Summary

  • Replace the JSON extension API (godot --dump-extension-api) with XML class documentation as the sole data source
  • XML docs are the upstream authoritative source — they contain tutorials, constructors, operators, property defaults, method qualifiers, and code examples that JSON lacks
  • Delete all JSON parsing code (~800 lines), api.zig, and the --godot-extension-api CLI flag
  • Add DocDatabase.loadFromXmlDir to build the symbol table directly from XML files
  • Expand XmlDocParser to parse params, return types, qualifiers, constructors, operators, and enum-grouped constants
  • Update markdown output to render inheritance, qualifiers, default values, constructor/operator sections
  • BBCode-to-Markdown conversion now happens during XML loading
  • Cache sentinel changed from extension_api.json + Node/index.md to xml_docs/.complete + Object/index.md

Test plan

  • All existing tests pass (snapshot tests unchanged)
  • New unit tests for expanded XmlDocParser (params, constructors, operators, enum attributes)
  • New tests for loadFromXmlDir (symbol table, enum grouping, @globalscope dual-registration)
  • BBCode conversion test in loadFromXmlDir
  • Integration roundtrip test: XML → DocDatabase → markdown cache → read back
  • Error-path tests: malformed XML (skipped gracefully), symbol not found, missing cache
  • Updated cache tests for new XML marker + Object sentinel
  • Manual test: zig build run -- Node2D, zig build run -- Vector2, zig build run -- sin

🤖 Generated with Claude Code

deevus added 19 commits March 21, 2026 17:38
- Fix CLI flag name (--godot-extension-api, not --api-json)
- Add DocDatabase.loadFromXmlDir specification
- Add builtin class detection strategy (hardcoded Variant type list)
- Add enum extraction from XML constants with enum attribute
- Specify godot-not-found error behavior
- Specify cache sentinel (Object/index.md)
- Note --no-xml / GDOC_NO_XML removal
- Clarify @globalscope vs @GDscript collision handling
- Fix: operator already exists in EntryKind, only constructor is new
- Clarify test migration: JSON fixture tests deleted, not rewritten
- Fix tutorials listed as existing Entry field (it's new)
- Rename utility_function to global_function (matches codebase)
- Note Config.testing update for no_xml removal
- Add cli/root.zig to removals list
- Add markdownForSymbol signature change section
- Make MemberDoc fields explicitly nullable with usage notes
- Add replacement error-path test coverage
All XML <class> elements become EntryKind.class uniformly.
Constructors and operators render via their own entry kinds.
- Merge Task 11 (CLI) into Task 12 (root.zig) since they can't compile independently
- Move InvalidApiJson removal to Task 8 (alongside JSON deletion)
- Fix error name in XML parse failure test (was referencing nonexistent error)
- Add enum grouping test to Task 6
- Add operator rendering assertions to integration test
- Add BBCode conversion test to Task 8
- Update signal parsing to reuse parseMethodElement for param capture
- Renumber tasks 12-15 after merge
- Replace `builtin_class` with `constructor` in EntryKind enum
- Add `inherits`, `qualifiers`, and `default_value` fields to Entry
- Update all `.builtin_class` references to `.class` for compilation
Add loadFromXmlDir function that iterates a directory of Godot XML doc
files and builds a complete symbol table with class entries, methods,
properties, signals, constants (with enum grouping), constructors, and
operators. Includes signature building helpers and dual-registration of
@GlobalScope/@GDscript functions as top-level entries.
…lues

Add inheritance line after heading in generateMarkdownForEntry.
Add constructor and operator lists to generateMemberListings.
Show qualifiers and default values in formatMemberLine.
Add test for inheritance display in generated markdown.
Delete JSON-specific functions (loadFromJsonFileLeaky, loadFromJsonLeaky,
parseClass, parseEntry, parseEntryArray, etc.), handler maps, RootState
enum, InvalidApiJson error, and all JSON-based tests. Add BBCode-to-Markdown
conversion in loadFromXmlDir for class and member descriptions.
Remove api.zig, the no_xml config field, getJsonCachePathInDir,
xmlDocsArePopulated, mergeXmlDocs, fetchXmlDocs, and all JSON-direct-load
codepaths. The cache rebuild flow now exclusively uses XML docs via
DocDatabase.loadFromXmlDir. Update cacheIsPopulated to check xml_docs/.complete
marker + Object/index.md sentinel. Remove godot-extension-api CLI flag and
associated error handlers.
Add XML-to-markdown roundtrip integration test that verifies the full
pipeline: XML parsing -> DocDatabase -> markdown cache -> readback.
Add error-path tests for malformed XML skipping and symbol-not-found
on an XML-loaded database.
ensureDirectoryExists used makeDirAbsolute which only creates a single
directory level. After --clear-cache removes the entire cache tree,
nested paths like cache/Node2D/ fail because the parent doesn't exist.
@deevus deevus merged commit 9a5444e into main Mar 21, 2026
2 checks passed
@deevus deevus deleted the feature/xml-docs-primary-source branch March 21, 2026 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant