Relative Content

Tag Archive for jsonjsonschemaneovim

Conditional schema not working as expected

I’m trying to write a JSON schema for a config file, so the config file object has a tasks array containing several properties, one of them being an enum “restart”.
I want my configuration to have a “restartAttempts” property only if “restart” is set to “on-failure”, so I thought I could use “if”, “then” blocks in my schema, but it turns out that it’s not working as expected, even if I provide “restart”: “on-failure”, I still get a syntax error in my lsp telling me property restartAttempts is not allowed. Here is the schema: