Emit neutral JSON schema artifact (db/event_schema.json)#161
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a parallel, neutral JSON artifact —
db/event_schema.json— generated from the same compiled schema asdb/event_schema.rb, so BI/data consumers can read every event's shape and version without running Ruby or evaluating the executable schema file.Purely additive: the Ruby artifact format, the boot/runtime path, the DSL, and the helper signatures are all unchanged. The JSON is written during the same schema dump.
What changed
Schema#to_h— plain-data hash parallel toto_ruby:event_name,event_version,event_type,process_type,subject,domain,required_inputs,optional_inputs,payload_fields(eachname/from/attr/required), andfingerprint.EventSchemaJsonWriter— serializes a full compiledEventSchema(all events, all versions) to JSON, one object per event+version, sorted[event_name, event_version]likeEventSchemaWriter. Output is byte-identical on unchanged re-dump.EventSchemaDumper.dump!takes an optionaljson_path:and writes the JSON when given.event_engine:schema:dumprake task writesdb/event_schema.jsonnext todb/event_schema.rb.Testing
to_h, the JSON writer (ordering + determinism), and the dumper wiring.bundle exec rake test— 162 runs, 0 failures.Out of scope (per the issue)
Making JSON canonical at runtime, drift-guard coverage of the JSON file, RBS generation, and conforming to a formal JSON Schema meta-schema — each a separate task.
Closes #157. Part of the #152 plan.
🤖 Generated with Claude Code