Hi,
While developing an Jira app, I added yaml-language-server to ensure my `bitbucket-pipelines.yml` is correct. Unfortunately, when opening the file in the editor I get this error:
$ref '/components/schemas/pipelines_configuration' in 'https://bitbucket.org/product/features/pipelines' cannot be resolved.
I'm using the default yaml-langage-server configuration , which pulls the schema for `bitbucket-pipelines.yml` from https://api.bitbucket.org/schemas/pipelines-configuration, which appears to be the correct URL.
EDIT: after some investigation, it appears that JSON schema draft 7 doesn't support definig a "$ref" at the root. "pipelines_configuration" should be directly embedded in the root, not refrenced with a "$ref" property. This makes the schema resolve
I am having the same issue. Definitely looks like a configuration mistake. Atlassian, please fix this.
As a workaround, I downloaded the scheme and modified it locally like the OP suggested: removed $ref from root and moved contents of the main schema to json root.
// before
{
"$id": "https://bitbucket.org/product/features/pipelines"
"$ref": "#/components/schemas/pipelines_configuration"
"components": {
"schemas": {
// ...other schemas
"pipelines_configuration": {
"properties": { ...schema properties },
"type": "object"
}
}
}
}
// after
{
"$id": "https://bitbucket.org/product/features/pipelines"
"properties": { ...schema properties },
"type": "object"
"components": {
"schemas": {
// ...other schemas
}
}
}
Then I pointed my YAML language server (in my case using nvim-lspconfig + nvim-schemastore) at that local file instead of remote schema.
vim.lsp.config('yamlls', {
settings = {
yaml = {
schemas = require('schemastore').yaml.schemas {
replace = {
['bitbucket-pipelines'] = {
description = 'Patched pipelines schema',
name = 'bitbucket-pipelines',
fileMatch = 'bitbucket-pipelines.yml',
url = 'file://<path-to-local-file>',
}
}
},
}
}
})
This fixed my issue, I have no error now and got proper LSP autocompletion and validation. Hope it helps others.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.