Skip to content

Support flattening top level sequences#82

Merged
Crell merged 5 commits intoCrell:masterfrom
tjlytle:flat-sequence
Jun 19, 2025
Merged

Support flattening top level sequences#82
Crell merged 5 commits intoCrell:masterfrom
tjlytle:flat-sequence

Conversation

@tjlytle
Copy link
Copy Markdown
Contributor

@tjlytle tjlytle commented May 14, 2025

Description

Failing test as requested from this post.

#[Field(flatten: true)]
#[SequenceField(arrayType: Coordinate::class)]
public array $coordinates;

Serializes as expected into an array of objects, but does not use the defined SequenceField when deserializing.

@Crell
Copy link
Copy Markdown
Owner

Crell commented Jun 19, 2025

That was exciting to figure out. I didn't even realize that flattening a single top level array would do that (turn into an array rather than an object). But once I found the issue, the fix was nice and small. And blows open some new functionality people have been asking for. 😄

Also, it's a place where we want PHP 8.4... In time...

@Crell Crell changed the title Failing Test For Flattening Sequences Support flattening top level sequences Jun 19, 2025
@Crell Crell merged commit 250acf7 into Crell:master Jun 19, 2025
8 checks passed
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.

2 participants