mirror of
https://github.com/nlohmann/json.git
synced 2026-07-12 05:25:09 +00:00
Add AST-based public API checker and fix documentation gaps it found (#3691)
Adds tools/api_checker/: extract_api.py derives the public API surface directly from the libclang AST (independent of documentation status), check_docs.py flags public entries missing @sa links (and @sa on non-public ones), diff_api.py does an overload-aware breaking/feature diff between two refs, check_macros.py cross- checks documented macros against #define sites, and snapshot_release.py backfills immutable per-release surface snapshots into tools/api_checker/history/ (v3.1.0 through v3.12.0) so diff_api.py can compare releases without live extraction. POLICY.md documents what counts as public API and what stability is guaranteed. Running this tooling against the current tree found and fixed a real documentation backlog: ~25 new API doc pages (ordered_map's methods, json_sax's ctor/dtor/ operator=, byte_container_with_subtype's comparison operators, several orphaned type aliases), each with a compiled and output-verified example, plus missing @sa comments and stale/incorrect Version History entries on several existing pages (found by diffing consecutive release pairs and checking whether the resulting change was actually reflected in the target page's history section). Also adds docs/home/api_changes.md, a per-release, per-function reference of public API changes (v3.1.0 through v3.12.0) generated from the history/ snapshots, complementing (not replacing) the existing release notes. Along the way, found and fixed several extractor bugs by testing against real release tags rather than trusting the algorithm in isolation -- most notably an identity-key scheme based on libclang's USR that encoded the enclosing class template's own arity, and a since-renamed ABI inline-namespace pattern (json_v3_11_0 vs. today's json_abi_v3_11_2) that neither of two earlier regex attempts stripped correctly. Both are documented in extract_api.py's docstrings and tools/api_checker/history/README.md so the failure mode doesn't recur silently. .github/workflows/check_api_docs.yml runs extract_api.py + check_docs.py in CI, advisory-only for now (documented backlog may not be at zero for entities this PR didn't touch), plus a blocking drift check on the committed tools/api_checker/api_surface.json. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
+30
-1
@@ -52,6 +52,7 @@ nav:
|
||||
- "FAQ": home/faq.md
|
||||
- home/exceptions.md
|
||||
- home/releases.md
|
||||
- home/api_changes.md
|
||||
- home/design_goals.md
|
||||
- home/architecture.md
|
||||
- home/customers.md
|
||||
@@ -117,6 +118,7 @@ nav:
|
||||
- 'begin': api/basic_json/begin.md
|
||||
- 'binary': api/basic_json/binary.md
|
||||
- 'binary_t': api/basic_json/binary_t.md
|
||||
- 'bjdata_version_t': api/basic_json/bjdata_version_t.md
|
||||
- 'boolean_t': api/basic_json/boolean_t.md
|
||||
- 'cbegin': api/basic_json/cbegin.md
|
||||
- 'cbor_tag_handler_t': api/basic_json/cbor_tag_handler_t.md
|
||||
@@ -154,6 +156,7 @@ nav:
|
||||
- 'get_to': api/basic_json/get_to.md
|
||||
- 'std::formatter<basic_json>': api/basic_json/std_formatter.md
|
||||
- 'std::hash<basic_json>': api/basic_json/std_hash.md
|
||||
- 'initializer_list_t': api/basic_json/initializer_list_t.md
|
||||
- 'input_format_t': api/basic_json/input_format_t.md
|
||||
- 'insert': api/basic_json/insert.md
|
||||
- 'invalid_iterator': api/basic_json/invalid_iterator.md
|
||||
@@ -172,6 +175,7 @@ nav:
|
||||
- 'is_structured': api/basic_json/is_structured.md
|
||||
- 'items': api/basic_json/items.md
|
||||
- 'json_base_class_t': api/basic_json/json_base_class_t.md
|
||||
- 'json_sax_t': api/basic_json/json_sax_t.md
|
||||
- 'json_serializer': api/basic_json/json_serializer.md
|
||||
- 'max_size': api/basic_json/max_size.md
|
||||
- 'meta': api/basic_json/meta.md
|
||||
@@ -228,9 +232,13 @@ nav:
|
||||
- 'Overview': api/byte_container_with_subtype/index.md
|
||||
- '(constructor)': api/byte_container_with_subtype/byte_container_with_subtype.md
|
||||
- 'clear_subtype': api/byte_container_with_subtype/clear_subtype.md
|
||||
- 'container_type': api/byte_container_with_subtype/container_type.md
|
||||
- 'has_subtype': api/byte_container_with_subtype/has_subtype.md
|
||||
- 'operator==': api/byte_container_with_subtype/operator_eq.md
|
||||
- 'operator!=': api/byte_container_with_subtype/operator_ne.md
|
||||
- 'set_subtype': api/byte_container_with_subtype/set_subtype.md
|
||||
- 'subtype': api/byte_container_with_subtype/subtype.md
|
||||
- 'subtype_type': api/byte_container_with_subtype/subtype_type.md
|
||||
- adl_serializer:
|
||||
- 'Overview': api/adl_serializer/index.md
|
||||
- 'from_json': api/adl_serializer/from_json.md
|
||||
@@ -256,25 +264,46 @@ nav:
|
||||
- 'to_string': api/json_pointer/to_string.md
|
||||
- json_sax:
|
||||
- 'Overview': api/json_sax/index.md
|
||||
- '(Constructor)': api/json_sax/json_sax.md
|
||||
- '(Destructor)': api/json_sax/~json_sax.md
|
||||
- 'operator=': api/json_sax/operator=.md
|
||||
- 'binary': api/json_sax/binary.md
|
||||
- 'binary_t': api/json_sax/binary_t.md
|
||||
- 'boolean': api/json_sax/boolean.md
|
||||
- 'end_array': api/json_sax/end_array.md
|
||||
- 'end_object': api/json_sax/end_object.md
|
||||
- 'key': api/json_sax/key.md
|
||||
- 'null': api/json_sax/null.md
|
||||
- 'number_float': api/json_sax/number_float.md
|
||||
- 'number_float_t': api/json_sax/number_float_t.md
|
||||
- 'number_integer': api/json_sax/number_integer.md
|
||||
- 'number_integer_t': api/json_sax/number_integer_t.md
|
||||
- 'number_unsigned': api/json_sax/number_unsigned.md
|
||||
- 'number_unsigned_t': api/json_sax/number_unsigned_t.md
|
||||
- 'parse_error': api/json_sax/parse_error.md
|
||||
- 'start_array': api/json_sax/start_array.md
|
||||
- 'start_object': api/json_sax/start_object.md
|
||||
- 'string': api/json_sax/string.md
|
||||
- 'string_t': api/json_sax/string_t.md
|
||||
- 'operator<<(basic_json), operator<<(json_pointer)': api/operator_ltlt.md
|
||||
- 'operator>>(basic_json)': api/operator_gtgt.md
|
||||
- 'operator""_json': api/operator_literal_json.md
|
||||
- 'operator""_json_pointer': api/operator_literal_json_pointer.md
|
||||
- 'ordered_json': api/ordered_json.md
|
||||
- 'ordered_map': api/ordered_map.md
|
||||
- ordered_map:
|
||||
- 'Overview': api/ordered_map/index.md
|
||||
- '(Constructor)': api/ordered_map/ordered_map.md
|
||||
- '(Destructor)': api/ordered_map/~ordered_map.md
|
||||
- 'operator=': api/ordered_map/operator=.md
|
||||
- 'at': api/ordered_map/at.md
|
||||
- 'Container': api/ordered_map/Container.md
|
||||
- 'count': api/ordered_map/count.md
|
||||
- 'emplace': api/ordered_map/emplace.md
|
||||
- 'erase': api/ordered_map/erase.md
|
||||
- 'find': api/ordered_map/find.md
|
||||
- 'insert': api/ordered_map/insert.md
|
||||
- 'key_compare': api/ordered_map/key_compare.md
|
||||
- 'operator[]': api/ordered_map/operator[].md
|
||||
- macros:
|
||||
- 'Overview': api/macros/index.md
|
||||
- 'JSON_ASSERT': api/macros/json_assert.md
|
||||
|
||||
Reference in New Issue
Block a user