Skip to content

chore: resolve stale SerializerContextBuilder / ContextAction 5.0 TODOs#8402

Open
soyuka wants to merge 2 commits into
api-platform:mainfrom
soyuka:chore/jsonld-context-uri-variables-cleanup
Open

chore: resolve stale SerializerContextBuilder / ContextAction 5.0 TODOs#8402
soyuka wants to merge 2 commits into
api-platform:mainfrom
soyuka:chore/jsonld-context-uri-variables-cleanup

Conversation

@soyuka

@soyuka soyuka commented Jul 13, 2026

Copy link
Copy Markdown
Member
Q A
Branch? main
Bug fix? no
New feature? no
Deprecations? no
Tickets
License MIT
Doc PR

Two verification-gated cleanups from the 4.4/5.0 audit.

refactor(serializer): drop redundant uri_variables assignment

SerializerContextBuilder::createFromRequest() populated uri_variables from raw request attributes, but every serialization consumer overrides it with correctly-parsed values immediately after calling it — SerializeProcessor, DeserializeProvider and Mcp\StructuredContentProcessor. No other caller reads the builder's uri_variables (PayloadArgumentResolver only reads input/resource_class; _api_normalization_context is written, never read for uri_variables).

refactor(jsonld)!: resolve reserved short names through their resources

ContextAction served a hardcoded base @context for the Error and ConstraintViolationList short names. Exceptions are resources since 3.2: Error and the validation resource ConstraintViolation now resolve through the normal resource loop. The legacy ConstraintViolationList context route had no producer left — responses reference /contexts/ConstraintViolation.

BREAKING CHANGE: removes the public ContextAction::RESERVED_SHORT_NAMES constant and the /contexts/ConstraintViolationList route.

Verification

  • Full regression sweep (Serializer unit + JSON-API/JSON-LD/HAL + Parameters/Doctrine + Security/CrudUriVariables functional): 862 tests, 0 failures.
  • Combined change on 5.0: 144 tests, 0 failures. Added ContextTest coverage for /contexts/Error and /contexts/ConstraintViolation resolving through their resources.
  • php-cs-fixer + PHPStan clean.

soyuka added 2 commits July 12, 2026 18:08
SerializerContextBuilder::createFromRequest populated uri_variables from raw
request attributes, but every serialization consumer overrides it with
correctly-parsed values immediately after calling it: SerializeProcessor,
DeserializeProvider and Mcp\StructuredContentProcessor. No other caller reads
the builder's uri_variables (PayloadArgumentResolver only reads
input/resource_class; _api_normalization_context is written, never read for
uri_variables).
ContextAction served a hardcoded base @context for the "Error" and
"ConstraintViolationList" short names. Exceptions are resources since 3.2:
"Error" and the validation resource "ConstraintViolation" now resolve through
the normal resource loop. The legacy "ConstraintViolationList" context route
had no producer left — responses reference /contexts/ConstraintViolation.

BREAKING CHANGE: removes the public ContextAction::RESERVED_SHORT_NAMES
constant and the /contexts/ConstraintViolationList route.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant