Remove v0.1.0 custom-keyword machinery (step 8)

The BAST parser (step 3) and BAST-native validator (step 5) replaced
the v0.1.0 custom-keyword accessor layer; step 7 moved the builder to
BAST output. This step removes the now-dead code:

Removed from src/schema.rs:
- get_alktype_kind / get_alktype_kind_enum /
  get_alktype_kind_loose / get_alktype_kind_loose_enum
  (replaced by the BAST parser's kind dispatch)
- normalize_refs / inline_union_variant_refs + helpers
  (BAST refs are always #/$defs/<name>; resolution is a single
  hash lookup, variant refs resolve lazily)
- parse_encoding / parse_align / parse_max_length / parse_endian
  (bast.rs has its own BAST-property-form copies)
- parse_discriminator + DiscriminatorKind
  (replaced by bast::BastDiscriminator; builder has its own
  Discriminator enum)
- resolve_ref / resolve_ref_or_inline
  (replaced by BastDoc::lookup_def / resolve_typeref)
- FromStr impl, as_str, Endian::from_schema, ALKTYPE_PREFIX,
  BYTE_DISCRIMINATOR_TYPES, and the associated unit tests

Kept: AlkTypeKind enum + methods (type_size, natural_alignment,
is_fixed_size, needs_endian, is_composite, is_variable_length,
to_bast_str, from_bast_str), Display (now backed by to_bast_str),
Endian, VariableEncoding, U32_SIZE, DISCRIMINATOR_PATH.

src/lib.rs: dropped the 13 schema::* helper re-exports and
DiscriminatorKind from the public surface; kept Endian, AlkTypeKind,
VariableEncoding.

Doc/comment updates: bast.rs, builder.rs, engine.rs, error.rs —
removed references to the deleted functions and the AlkType:*
keyword form.

The jsonschema crate remains a dependency (validate_json path +
BAST meta-schema validation); build_validator was already repurposed
in step 6 (no custom keywords).

Verification:
- cargo test --release: 389 pass (312 lib + 77 integration)
- cargo clippy --all-targets -- -D warnings: clean
- cargo doc --no-deps: clean
- cargo build --target wasm32-unknown-unknown --release: clean
This commit is contained in:
glm-5.2 committed 2026-08-15 13:39:05 +00:00
1 parent 45f3336201
commit 54fd112fde
6 files changed
+51 -845

No files matched your search

+4 -4
View File
@@ -10,9 +10,9 @@
//! Feed to [`crate::AlkTypeEngine::compile`].
//! - **Standard JSON Schema** (JSON validation) — `Schema::object().field(...)`
//! produces `{ "type": "object", "properties": {...}, "required": [...] }`.
//! No BAST `kind`, no `AlkType:*` keywords. Feed to a standard
//! `jsonschema::Validator` (or [`crate::AlkTypeEngine::compile`] with a
//! JSON Schema for the `validate_json` path).
//! No BAST `kind`, no custom keywords — a plain JSON Schema. Feed to a
//! standard `jsonschema::Validator` (or [`crate::AlkTypeEngine::compile`]
//! with a JSON Schema for the `validate_json` path).
//!
//! The construction API distinguishes BAST kinds from standard JSON Schema
//! types via naming conventions (`string()` is the BAST primitive,
@@ -705,7 +705,7 @@ fn discriminator_value(disc: &Discriminator) -> Value {
}
/// TUnion discriminator, builder-friendly form. Mirrors
/// [`crate::schema::DiscriminatorKind`] but constructed via the builder
/// [`crate::bast::BastDiscriminator`] but constructed via the builder
/// API.
#[derive(Debug, Clone)]
pub enum Discriminator {