Generate the OTIO Core Specification from code + curated overlay#2024
Open
jhodges10 wants to merge 1 commit into
Open
Generate the OTIO Core Specification from code + curated overlay#2024jhodges10 wants to merge 1 commit into
jhodges10 wants to merge 1 commit into
Conversation
This adds a generator that assembles the OpenTimelineIO Core Specification from two sources: the code (every serializable schema object, its fields, field types, default values, inheritance, and binding docstrings) and a curated markdown overlay holding the human-authored narrative and per-object integrator usage guidance. Changes: - Enrich autogen_serialized_datamodel.py so the serialized-schema docs now carry per-field type info (derived from pybind11 getter signatures, normalized to spec vocabulary), optional flags, default values, and a class-level inheritance chain. Addresses the long-standing "type information would be awesome" TODO. - Add autogen_core_specification.py, which reuses that model and interleaves it with docs/spec/core-specification-overlay.md to produce a full specification document (docs/spec/otio-core-specification.md). The overlay is plain markdown with HTML-comment directives, parsed with the stdlib (no new dependencies). Generation fails unless every non-plugin schema object is documented exactly once, so the spec cannot silently drift from the code. - Fill in the missing per-field semantic docstrings on the bindings (otio and opentime) so the pure definitions live in code and flow into both the serialized-schema docs and the specification. - Wire up `make spec` / `make spec-update` and a regenerate-and-compare unit test (CoreSpecificationTester), matching the existing autogen doc pattern. Signed-off-by: Jeff Hodges <jeff@jeffhq.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
This is a first step toward generating the OTIO Core Specification from the code rather than maintaining it by hand. It adds a generator that assembles a full specification document from two sources:
metadatadictionary, root objects, JSON serialization) and the per-object integrator usage guidance that doesn't belong in terse API docstrings.The per-object semantic definitions live in the binding docstrings (single source of truth, also improves IDE/readthedocs help); the narrative and usage guidance live in the overlay. The generator interleaves them.
What's here
autogen_serialized_datamodel.pyso the serialized-schema docs now carry per-field type info (derived from the pybind11 getter signatures, normalized to spec vocabulary —String,Double,Array[Effect],Map[String, MediaReference],TimeRange, …), optional flags, default values, and a class-level inheritance chain. (Resolves the long-standing# @TODO: having type information here would be awesome.)autogen_core_specification.py, which reuses that model and stitches it together with a curated overlay to producedocs/spec/otio-core-specification.md. The overlay (docs/spec/core-specification-overlay.md) is plain markdown with HTML-comment directives (@preamble/@section/@object/@appendix), parsed with the stdlib — no new dependencies.@objectentry. Adding a new schema to the code forces a matching overlay entry, so the spec can't silently drift.source_range,kind,global_start_time,available_range,target_url,RationalTime.value/rate,TimeRange.start_time/duration,name/metadata). These flow into both the serialized-schema docs and the specification.make spec/make spec-update, plus a regenerate-and-compare unit test (CoreSpecificationTester) matching the existing autogen-doc pattern.Regenerating
Edit prose in
docs/spec/core-specification-overlay.md; edit field/object definitions in the bindings.Testing
CoreSpecificationTester,SerializedSchemaTester, andPluginDocumentationTesterpass.Notes
0..1/0..*), per-property "inherited from" grouping, intra-document cross-links between object headings, and UML/diagrams.