Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[JsonEncoder] [JsonStreamer] Add streaming JSON documentation#20486

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
javiereguiluz merged 1 commit intosymfony:7.3frommtarld:feat/json-encoder
Jul 25, 2025

Conversation

@mtarld
Copy link
Contributor

@mtarldmtarld commentedDec 19, 2024
edited
Loading

andreybolonin reacted with hooray emoji
@carsonbotcarsonbot added this to the7.3 milestoneDec 19, 2024
@mtarldmtarldforce-pushed thefeat/json-encoder branch 2 times, most recently from592f9aa toafa08c8CompareDecember 20, 2024 15:41
@mtarld
Copy link
ContributorAuthor

The remaining failure is due to the fact that thehttps://github.com/symfony-tools/symfony-application application does not have thesrc/Encodable folder.

Should we create it? Or should we add the issue to the baseline? Or maybe commenting that configuration?

@wouterj
Copy link
Member

wouterj commentedDec 21, 2024
edited
Loading

Hi@mtarld. Thanks a lot for starting this and providing so much valuable documentation early in the development phase!

Before reviewing the whole document, we must think about the position of the component in the documentation. We've mostly stopped using thecomponents/ directory. Instead, we focus on the "guides" and document framework usage. This component is a bit more challenging, as it belongs to the "Serialization" topic that currently belongs to the Serializer component. We've discussed this a bit with the core team during the SymfonyCon:

I think the best way would be to move this article toserializer/json_encoder.rst, and add a little section at the start ofserializer.rst mentioning this component and when you should use instead of the Serializer component (e.g. a compact version of the "Serializer or JsonEncoder?" section). But we're of course open if people have better ideas on how to position this new component in the ecosystem!


Something that might also be interesting is adding aphp-standalone tab to some of the code examples, showing how to use this component standalone. You can see this in use in the mainserializer.rst for instance.

mtarld reacted with thumbs up emoji

@SirRFI
Copy link
Contributor

The documentation requires update, because the component and it's contents has been renamed - seesymfony/symfony#59863

@SirRFI
Copy link
Contributor

Can you provide minimum code required to use the component in custom service inside Symfony project? Could be also useful for "New in Symfony 7.3" blog series.

I tried following the documentation (with updated names), but I getSymfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "Symfony\Component\JsonStreamer\StreamReaderInterface". despite it's visible inbin/console debug:container. Also triedjson.stream_reader alias. All Symfony dependencies are updated to7.3.*-dev.

@mtarld
Copy link
ContributorAuthor

Hey@SirRFI , thanks for keeping track of it. I'm aware of these points yes! 🙂

I'm really busy these days, but as soon as I have time, I'll update this PR (containing your suggestions) - it's part of my top priorities.

@mtarldmtarld changed the title[JsonEncoder] Add component documentation[Serializer] [JsonStreamer] Add streaming JSON documentationApr 27, 2025
@mtarldmtarldforce-pushed thefeat/json-encoder branch 2 times, most recently from0e63875 tofb3e6c6CompareApril 27, 2025 08:42
@OskarStarkOskarStark changed the title[Serializer] [JsonStreamer] Add streaming JSON documentation[Serializer][JsonStreamer] Add streaming JSON documentationMay 9, 2025
@mtarldmtarld requested a review fromwouterjMay 20, 2025 11:38
@SirRFI
Copy link
Contributor

SirRFI commentedJun 11, 2025
edited
Loading

Now that Symfony 7.3 is released, I tried using the component again. I stumbled upon this:

ArgumentCountError: Too few arguments to function App\CustomObject::__construct(), 0 passed in /app/vendor/symfony/json-streamer/Read/Instantiator.php on line 38 and exactly 4 expected

Eventually I came to conclusion that the component currently does not support PHP 8.0's constructor property promotion andreadonly.

I wanted to try the decoding part of things first, so I missed the following sentence:

The JsonStreamer works with simple PHP classes that are composed by public properties only.

I think this is important information, therefore my suggestion is to make it more visible. Maybe moving to the main section and putting into warning/yellow borders would do, or whatever are the guidelines for such cases.

While on it, I have to ask:Is it possible for the component to support these language features? Properties defined this way can be still public arguably, so if there is technical limitation for that - it shall be mentioned as well.

Thank you for your work.

@mtarld
Copy link
ContributorAuthor

Thanks@SirRFI, I think you're right!

  • It must be said that objects cannot have a constructor. I'll make sure to try to update it accordingly.
  • About supporting this feature, yes, it could be great, I'll give it a try ASAP

@carsonbotcarsonbot changed the title[Serializer][JsonStreamer] Add streaming JSON documentation[JsonEncoder] [JsonStreamer] Add streaming JSON documentationJul 25, 2025
@javiereguiluzjaviereguiluz merged commitb225879 intosymfony:7.3Jul 25, 2025
3 checks passed
@javiereguiluz
Copy link
Member

Mathias, thanks A LOT for this great contribution 😍 🙇 We finally merged it! 🥳 🎉

While merging we did some tweaks in grammar, flow, etc. but they were just cosmetic changes. Your core contribution and all your code examples were left intact.

andreybolonin reacted with hooray emojimtarld reacted with heart emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@wouterjwouterjAwaiting requested review from wouterj

3 more reviewers

@alamiraultalamiraultalamirault left review comments

@MrYamousMrYamousMrYamous left review comments

@TheoD02TheoD02TheoD02 left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

7.3

Development

Successfully merging this pull request may close these issues.

[Serializer] [JsonEncoder] Introducing the component

8 participants

@mtarld@wouterj@SirRFI@javiereguiluz@alamirault@MrYamous@TheoD02@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp