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

Sort fields from values.schema.json #228

Closed
petar-cvit opened this issue Apr 24, 2024 · 6 comments
Closed

Sort fields from values.schema.json #228

petar-cvit opened this issue Apr 24, 2024 · 6 comments
Labels
go Pull requests that update Go code good first issue Good for newcomers

Comments

@petar-cvit
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
Cyclops uses an additional field order provided in the values.schema.json that allows users to set a custom order of fields in the object in their schemas (e.g. here)
However, most templates won't have this field set and their children will have a random order. The scope of this issue is to order fields alphabetically if order is not provided.

Another possible case is that order is defined for just a subset of fields. Fields with a defined order should come before those without set order.

Example:

{
  "properties": {
    "name": {
      ...
    },
    "scaling": {
      ...
    },
    "general": {
      ...
    },
    "probes": {
      ...
    },
    "networking": {
      ...
    }
    "owner": {
      ...
    },
  },
  "order": [
    "name",
    "general",
    "scaling"
  ]
}

Should be rendered in the to following order:

  1. name
  2. general
  3. scaling
  4. network
  5. owner
  6. probes

The first three are defined in the order, and the last three are sorted alphabetically. Ordered come before alphabetically sort ones.

Describe the solution you'd like
Add alphabetical sorting here

@petar-cvit petar-cvit added good first issue Good for newcomers go Pull requests that update Go code labels Apr 24, 2024
@Sheikh-Abubaker
Copy link
Contributor

Hey @petar-cvit I would like to work on this!!

RohanMishra315 added a commit to RohanMishra315/cyclops that referenced this issue Apr 27, 2024
Issue: cyclops-ui#228

1. Sorted the fields from values.schema.json into the alphabetical form when the order is not provided
2.  When order is provided , the defined fields will come in order first and then the sorted fields.
@petar-cvit
Copy link
Collaborator Author

@Sheikh-Abubaker thanks, but @RohanMishra315 already opened a PR for it

@Sheikh-Abubaker
Copy link
Contributor

@Sheikh-Abubaker thanks, but @RohanMishra315 already opened a PR for it

@petar-cvit no worries!

@petar-cvit petar-cvit assigned petar-cvit and unassigned petar-cvit Apr 30, 2024
@Tanmay-21
Copy link
Contributor

@petar-cvit would like to give this a try.

@Tanmay-21
Copy link
Contributor

Hey @petar-cvit, I have raised a PR for the requirement - #261

@petar-cvit
Copy link
Collaborator Author

Hey @Tanmay-21. @RohanMishra315 already has a PR for this, so let's wait to hear back from him about this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update Go code good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants