Repository navigation
feat(metadata): auto order, stable order and output relation labels [*] - #9
Merged
Merged
Conversation
…spike) [*] Opt-in auto_order: a metadata factory decorating with priority 1100 adds one SortFilter QueryParameter per sortable scalar field and per to-one relation label, skipping properties with an explicit OrderFilter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- auto_order: per-property SortFilter parameters for readable scalar fields and to-one relation labels (candidates only), identifiers excluded, explicit OrderFilter wins, #[AutoOrder] per entity, configurable default_order (name ASC, createdAt DESC) - stable_order: StableOrderExtension (priority -40) appends the identifier as tie-breaker for stable pagination - output schemas carry x-label-property and x-resource-class - email added to the default label property candidates - CHANGELOG: 0.4.0 section for the hydra:operation filtering Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The extension always loads config/services.yaml via YamlFileLoader; neither framework-bundle nor dependency-injection pulls symfony/yaml in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolves the conflict with 0.4.1 in RelationFieldSchemaDecorator in favour of 0.4.1: output schemas get all five relation extensions, the reduced output variant of this branch is dropped. Properties inside allOf (JSON-LD output definitions) are decorated too. CHANGELOG gets the 0.5.0 section. Co-Authored-By: Claude Opus 5.5 <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
Opt-in features so admin UIs can derive sortable columns from the standard API Platform
order[...]parameters instead of guessing:auto_order(default off): a resource metadata factory (decoration priority 1100, before API Platform's parameter factory) adds oneSortFilterQueryParameterper readable scalar Doctrine field and per to-one relation label (order[<relation>.<label>], label fromrelation_field_decorator.label_property_candidatesonly). Identifiers, embedded fields, json/text/blob/vector types and properties outside the operation's serializer groups orreadable: falseare skipped. An explicit#[ApiFilter(OrderFilter::class)]or an existing parameter wins per property.#[AutoOrder(enabled:, exclude:)]per entity. Configurabledefault_order(defaultname ASC, thencreatedAt DESC), applied only to operations withoutorder.stable_order(default off):StableOrderExtension(priority -40, between OrderExtension and pagination) appends the identifier as tie-breaker for stable pagination; skips composite/foreign identifiers andGROUP BYqueries.x-label-propertyandx-resource-classfor relations (nox-collectionetc., so form editors don't claim read-only relations).emailadded to the default label property candidates.symfony/yamlmoved torequire(the extension always loads YAML service files).0.4.0section for the hydra:operation filtering.Requires API Platform >= 4.3 when
auto_orderis enabled (guarded with a configuration error).Verification
x-label-propertyin output schemas.order[collection.name]=ascproducesLEFT JOIN o.collection … ORDER BY collection_a1.name ASC. Row-order tests against a database run in the consumer's CI.Proposed release:
0.5.0.🤖 Generated with Claude Code