Repository navigation
Generate a config yaml schema to better support config building/editing #374
Description
Activity
What is the concrete workflow you'd like to enable with this? Currently when I start a new collection file I usually just copy and paste an example from the docs, or a previous file, and edit from there. It's definitely not great, so I'm curious how you think we can leverage a schema to make that process easier.
Sure! So my thought is it'd be nice to not have to copy-paste. The IDE can be powerful if it knows what the schema is, it's mostly useless without it.
Today, unless you copy-paste and don't make any mistakes when modifying that pasted bit of config, you'd never know that you may have an invalid config file until you startup the app when it parses. This feels slightly wasteful since the IDE could've told the user that well before running the app.
Additionally, these configs make use of custom yaml tags, which the generic YAML validator knows nothing about (and thus complains) -

Ultimately this is a minor inconvenience and FAR from a boundary to successfully writing a valid config.
@anussel5559 What would the artifact of schema generation look like? You mentioned schemars, are you picturing slumber spitting out a JSONSchema file? How would that get loaded into the IDE? How do we tell the IDE that
slumber.ymlshould be parsed according to that schema?@LucasPickering yup, yaml schema is just JSON schema and that's what schemars would generate.
There's a few ways the JSON schema can be associated to the yaml file to enable validation/hinting/docs/etc... (checkout this article), but likely the easiest way is to host the schema, and document that schema validation can be enabled by setting:
# yaml-language-server: $schema=https://my.url.to/the/schemaat the top of the config file.
- addedqolImprovements that make usage smoother, without introducing new functionalityImprovements that make usage smoother, without introducing new functionality
on Sep 13, 2024 Yeah I like this idea! I just opened a related feature #376 to add a subcommand
slumber new, which would generate a new collection file. This file would include that comment at the top so users don't have to write it manually. And we could host the YAML file on the website, since that is already a process that generates static files in CI and hosts them.I'm going to do the
slumber newthing, do you want to work on this issue?Reacted by Alex Nusselawesome! That makes a lot of sense. I'm definitely interested in helping out with this, likely after I get some solid movement on the collection ref stuff.
@anussel5559 Took me a while to get to it but yesterday I played around with vscode-yaml and JSONSchema. It's really useful but there's a critical problem: JSONSchema doesn't support YAML tags in any way since tags don't exist in JSON. vscode-yaml has no extended support for it either.
Having the schema definitely improved the experience of writing a collection so I like the idea. The only solution I can come up with for this is to ditch tags in favor of internally tagged enums, like so:
login: !request method: GET url: https://website/login
becomes this:
login: type: request method: GET url: https://website/login
The same change would have to be made for everything that uses tags. Obviously this would be a breaking change. I have plans for some other big breaking changes to the collection format, and I would implement an importer to upgrade people from the old format to the new one to make the transition pretty smooth, so I'm not opposed to making this change if it improves the user experience overall.
What do you think?
- added a commit that references this issue
on Jul 4, 2025 I didn't forget about this! Just put up a PR to add this. It's part of a major collection format overhaul in 4.0, so it'll still be a bit before it gets released.
- added 12 commits that reference this issue
on Jul 5, 2025 - added 2 commits that reference this issue
on Jul 30, 2025 - added a commit that references this issue
on Aug 9, 2025 Released in 4.0! https://slumber.lucaspickering.me/user_guide/json_schema.html
Did you search for existing issues already?
Yup!
Is your feature request related to a problem? Please describe.
Nope
Describe the solution you'd like
Currently, when building or editing a slumber yaml configuration, there's no schema available - this isn't a huge deal, but leaves the user to their own devices as far as building a valid config file.
With a generated schema, the user's IDE can help guide them through building a valid config, and call out potential issues before they go to run the app.
Describe alternatives you've considered
None
Additional context
I looked a bit in to schemars to generate the schema from the
Collectionstruct, but there was enough sprawl there that it made more sense to bring it up and talk about this potential feature more generally.