feat: add Assembler and AttributeFactory for spec attribute collection#8
Closed
DerManoMann wants to merge 3 commits into
Closed
feat: add Assembler and AttributeFactory for spec attribute collection#8DerManoMann wants to merge 3 commits into
DerManoMann wants to merge 3 commits into
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
85dcbd0 to
d6b7a55
Compare
Owner
Author
|
Moved to zircote#2057 (base branch updated to master now that spec-dto is merged) |
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
Introduces the assembly stage of the spec pipeline — the step that scans PHP classes and collects spec attributes into a
Specificationcontainer.Source files → ReflectionClass → Assembler → Specification
Depends on zircote#2054.
Design
Two-pass assembly
The Assembler runs two distinct passes per class:
merge()maps. E.g.,Schemamerges intoPropertyfilling its$schemaslot.contains()maps. E.g.,Operationona method absorbs
Parameterfrom its parameters;Schemaon a class absorbsPropertyfrom its members.After both passes, only root attributes remain and are added to the
Specification. Non-root attributes that survive resolution trigger an error (orphan detection).AttributeFactory
Extracted helper that encapsulates:
merge()slot maps (same-reflector nesting)contains()slot maps (inner → outer)Shared between the Assembler and future augmenter pipes that need to manufacture spec objects from reflection (e.g.
ExpandHierarchyfor non-schema ancestor members).Slot semantics
The
merge()andcontains()maps return[TargetClass => 'slotName']:'parameters[]'— collection append'requestBody'— scalar assignmentThis eliminates the implicit
$_nestedarrays and reflection-heavy nesting logic from the classic pipeline.Orphan detection
After hierarchy resolution, any remaining non-root attribute is an error — e.g. a
Parameteron a class without aPathItemorOperationto absorb it. The Assembler throwsOpenApiExceptionwith source location context.