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

Order is significant in screens map in yafti.yml #122

Open
greenrd opened this issue Jun 18, 2023 · 3 comments
Open

Order is significant in screens map in yafti.yml #122

greenrd opened this issue Jun 18, 2023 · 3 comments
Assignees
Labels
beta question Further information is requested
Milestone

Comments

@greenrd
Copy link

greenrd commented Jun 18, 2023

According to the YAML specification, the order of keys in maps like screens is not supposed to be significant.

But it seems to me that yafti relies on the order of the keys in the file to determine the order to display the screens in (subject to the conditions of each screen).

If you want an ordered map, you are supposed to use this syntax (example 2.26 in the YAML 1.2.2 spec):

# Ordered maps are represented as
# A sequence of mappings, with
# each mapping having one key
--- !!omap
- Mark McGwire: 65
- Sammy Sosa: 63
- Ken Griffey: 58

It seems to me that the !!omap type annotation is optional, but the use of lists is not.

@marcoceppi
Copy link
Collaborator

marcoceppi commented Jun 19, 2023

We may be getting lucky based on the implementation of dicts in python since 3.6 which order is preserved by default. This means ordered maps aren't required unless we're reading, parsing, and re-writing the YAML file back to disk. I don't know how pyaml handles !!omap so I'd need to experiment. If it does "the right thing" then prefect we can update the yafti format to support this allowing future implementations of yafti to not rely on Python quirks.

If pyyaml (or ruamel.yaml for that matter) don't treat omaps well I may close this for now and if we ever stray from Python we'll need to rev the yafti.yaml format version. I'm going to assign this to the 1.0 milestone and update based on research if no one else gets to this before me.

@marcoceppi marcoceppi added this to the v1.0.0 milestone Jun 19, 2023
@abanna
Copy link
Collaborator

abanna commented May 2, 2024

@greenrd are you still interested in this?

@abanna abanna self-assigned this May 2, 2024
@abanna abanna added beta question Further information is requested labels May 2, 2024
@abanna abanna added this to uPortal May 2, 2024
@greenrd
Copy link
Author

greenrd commented Jul 21, 2024

@greenrd are you still interested in this?

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta question Further information is requested
Projects
Status: No status
Development

No branches or pull requests

3 participants