Skip to content

Add YAML support for configuration file format #1682

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
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

YangSiJun528
Copy link
Contributor

@YangSiJun528 YangSiJun528 commented Jul 31, 2025

This PR adds an option to generate project configuration in YAML format. Currently, only .properties is supported. (#1109)

This PR has many changes, so I'm opening this PR early to get feedback before completing all implementation details. The core features work well, but I still need to add more comprehensive tests - currently only basic tests are implemented.

Main Changes

  • Add ConfigurationFileFormat interface with factory and implementations for Properties and YAML
  • Update ApplicationProperties to write YAML format
  • Add ApplicationYamlPropertiesContributor
  • Add @ConditionalOnConfigurationFileFormat and OnConfigurationFileFormatCondition to choose between Properties and YAML
  • Add config file format support to MutableProjectDescription, InitializrMetadata, and ProjectRequest
  • Update tests: since configuration file format is now configurable, remove application.properties validation or set format explicitly where needed.

Need Feedback On

  • Is the name and package location of ConfigurationFileFormat appropriate? (io.spring.initializr.generator.configuration.format)
  • Any feedback on the overall design?
  • Are there any missing features or edge cases to consider?

Once I receive feedback on the approach, I will add comprehensive tests and polish the implementation before requesting final review.


Fixes gh-1109

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 31, 2025
@YangSiJun528 YangSiJun528 marked this pull request as ready for review August 4, 2025 04:46
@mhalbritter
Copy link
Contributor

Thanks @YangSiJun528, I'm going to take a look. I'm in the middle of something right now, but i plan to look at it this week.

@mhalbritter mhalbritter self-assigned this Aug 8, 2025
@@ -149,6 +149,20 @@
}
]
},
"configurationFileFormat": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the metadata v2.0.0 format. I think we should add a new metadata version v2.3 which adds the configurationFileFormat field. You can take a look at InitializrMetadataV22JsonMapper and InitializrMetadataV21JsonMapper for that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reverted the changes to InitializrMetadataV2JsonMapper and added InitializrMetadataV23JsonMapper.

@mhalbritter
Copy link
Contributor

Hi @YangSiJun528 ,

thanks for the PR. I've left some comments for your consideration.

I think your name ConfigurationFileFormat is a good one. Aside from the new metadata version the design looks sane, and I can't see any missing edge cases.

@mhalbritter mhalbritter added the status: waiting-for-feedback We need additional information before we can continue label Aug 8, 2025
Signed-off-by: sijun-yang <[email protected]>
Signed-off-by: sijun-yang <[email protected]>
This reverts commit 19c8659.

Signed-off-by: sijun-yang <[email protected]>
@YangSiJun528
Copy link
Contributor Author

YangSiJun528 commented Aug 10, 2025

Applied feedback to address metadata format compatibility issues.

configuration file format addition changes the metadata structure, requiring format versioning:

  • Revert InitializrMetadataV2JsonMapper to preserve v2.0 format
  • Create InitializrMetadataV23JsonMapper for new v2.3 format support
  • Add InitializrMetadataVersion.V2_3 enum value
  • Add v2.3 endpoints in ProjectMetadataController

This maintains v2.0 compatibility while enabling configuration file format features in v2.3.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Aug 10, 2025
@YangSiJun528
Copy link
Contributor Author

And I have added compliance tests to ApplicationPropertiesComplianceTests.

This PR should now be ready for review. @mhalbritter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: feedback-provided Feedback has been provided status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add contribution model for application configuration
3 participants