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

Add textSpec' and primitives #3

Closed
wants to merge 1 commit into from
Closed

Conversation

dminuoso
Copy link

Adds textSpec' which acts similar to atomSpec except it works on texts instead of atoms.

For automatic config generation from nixos we would like to use YAML generators, since recently config-value accepts YAML-style lists as well. However, existing tooling makes it hard to control when to put out strings with or without quotes. Realistically you're forced to always emit atoms or always emit texts.

Using anyAtom is too constraining, as not every valid string is a valid atom, but using textSpec/customSpec means we lose the ability to enumerate possible values in documentation/diagnostics.

With the pull request you can use textSpec' similarly to atomSpec while sticking to text. This lets us name specific possible strings that diagnostics/documentation can print out.

@glguy
Copy link
Owner

glguy commented Mar 29, 2022

instead of adding another specialization, what do you think about generalizing it like this? https://github.com/glguy/config-schema/tree/exactSpec

@glguy glguy closed this Aug 10, 2022
@dminuoso
Copy link
Author

Sorry I forgot to respond. This is perfect, thanks! :)

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.

2 participants