Skip to content

[DX][Config] Generate JSON schema for Yaml configuration #59603

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
GromNaN opened this issue Jan 24, 2025 · 3 comments · May be fixed by #59620
Open

[DX][Config] Generate JSON schema for Yaml configuration #59603

GromNaN opened this issue Jan 24, 2025 · 3 comments · May be fixed by #59620
Labels
Config DX DX = Developer eXperience (anything that improves the experience of using Symfony)

Comments

@GromNaN
Copy link
Member

GromNaN commented Jan 24, 2025

Description

IDE like PHPStorm have a great support for Yaml validation against a JSON schema.

Code completion
For example, you can use code completion for YAML documents that have the JSON schema, or you can complete anchor aliases.

The idea is to generate a schema.json from all the allowed configuration.

Example

I created a JSON schema manually for Yaml files and this was a pleasant experience to have autocompletion and errors directly highlighted in PHPStorm.

@GromNaN GromNaN added Config DX DX = Developer eXperience (anything that improves the experience of using Symfony) labels Jan 24, 2025
@Neirda24
Copy link
Contributor

Yes !! Wanted to do it myself! I see that there is already a PR opened. I also thought of having something like Config::fromJsonSchema which IMO would make sense.

@Aerendir
Copy link
Contributor

This is a good point in my opinion.

Few months ago I switched to php configs, but they don’t have too much support (ex., no support at all by Flex).

But having the schema understood by PhpStorm would be very good: we would have both advantages: autocompletion and simplicity.

I would give it a try 💪🏻

@GromNaN
Copy link
Member Author

GromNaN commented Jan 26, 2025

@Neirda24 Thanks for your enthusiasm. Reviewing and testing the PR #59620 is also very important, as there are issues to be resolved, such as dealing with different schemas for different environments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Config DX DX = Developer eXperience (anything that improves the experience of using Symfony)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants