Skip to content
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

Enable configuration of whether quotes are used in generated yaml #6773

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

MichaelMorrisEst
Copy link
Contributor

Description

Enables configuration of whether quotes are included in yaml generated by the KubernetesSerialization class and exposes that through the CRD generator MOJO by adding a new paramater named "minimizeQuotes".

Closes #6763

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change
  • Chore (non-breaking change which doesn't affect codebase;
    test, version modification, documentation, etc.)

Checklist

  • Code contributed by me aligns with current project license: Apache 2.0
  • I Added CHANGELOG entry regarding this change
  • I have implemented unit tests to cover my changes
  • I have added/updated the javadocs and other documentation accordingly
  • No new bugs, code smells, etc. in SonarCloud report
  • I tested my code in Kubernetes
  • I tested my code in OpenShift

Signed-off-by: MichaelMorris <michael.morris@est.tech>
Signed-off-by: MichaelMorris <michael.morris@est.tech>
Signed-off-by: MichaelMorris <michael.morris@est.tech>
Copy link

sonarqubecloud bot commented Jan 8, 2025

@manusa
Copy link
Member

manusa commented Jan 10, 2025

Thx for looking into this.

@baloo42 do you want to provide feedback?

* @param <T> the type of the object being serialized.
* @return a String containing a JSON representation of the provided object.
*/
public <T> String asYaml(T object, boolean minQuotes) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this change looks good, but wanted to bring up that based upon the DumpSettings there's a lot that could be overriden about the generation style.

Min quoting is roughly defaultScalarStyle=ScalarStyle.PLAIN - it's just that we need to still quote keys that look like boolean values to kube. Another possibliity is to create our own "DumpSettings" builder and have that as an argument so that this can be expanded in the future without adding additional signatures to asYaml.

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.

CRDGenerator: YAML output customization
3 participants