Code Monkey home page Code Monkey logo

spectral-language-server's Introduction

spectral-language-server

Awesome Spectral JSON/YAML linter with OpenAPI/AsyncAPI support

Spectral is a flexible object linter with out of the box support for OpenAPI v2 and v3, JSON Schema, and AsyncAPI.

Usage

You can install this via npm i -g spectral-language-server

After that, you get the following command.

  • spectral-language-server

Build

Requirements

You should install yarn for the building vscode.

Commands

  • npm i -g yarn
  • yarn install
  • ./script/build.sh
  • node ./script/depcheck.js
  • npm run release

LICENSE

This package licensed under the MIT.

See the LICENSE

spectral-language-server's People

Contributors

danwiseprogramming avatar leviticusnelson avatar luizcorreia avatar williamgoulois avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

spectral-language-server's Issues

Dist files missing from installed package

I'm getting the following error when trying to run this:

➜ spectral-language-server
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module '/home/bsmith/.asdf/installs/nodejs/16.14.0/.npm/lib/node_modules/spectral-language-server/dist/spectral-language-server/server.js'
Require stack:
- /home/bsmith/.asdf/installs/nodejs/16.14.0/.npm/lib/node_modules/spectral-language-server/bin/spectral-language-server
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/home/bsmith/.asdf/installs/nodejs/16.14.0/.npm/lib/node_modules/spectral-language-server/bin/spectral-language-server:3:1)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/bsmith/.asdf/installs/nodejs/16.14.0/.npm/lib/node_modules/spectral-language-server/bin/spectral-language-server'
  ]
}
➜ l /home/bsmith/.asdf/installs/nodejs/16.14.0/.npm/lib/node_modules/spectral-language-server
total 20K
drwxr-xr-x   2 4.0K Feb 14 21:36 bin/
drwxr-xr-x 153 4.0K Feb 14 21:37 node_modules/
-rw-r--r--   1 1.1K Feb 14 21:36 LICENSE
-rw-r--r--   1  896 Feb 14 21:36 package.json
-rw-r--r--   1  624 Feb 14 21:36 README.md

The only explanation I've found so far is the dist directory being in the .gitignore file. According to the npm docs:

If there is a .gitignore or .npmignore file, then ignored files in that and all child directories will be excluded from the package. If both files exist, then the .gitignore is ignored, and only the .npmignore is used.

Other sources say that files should override it, though.

Can not be installed on Windows

Works like a charm on Linux, but on Windows I get:

npm ERR! code 1
npm ERR! path C:\Users\<USER>\AppData\Roaming\npm\node_modules\spectral-language-server
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c ./script/vscode-spectral-build.sh
npm ERR! '.' is not recognized as an internal or external command,
npm ERR! operable program or batch file.

Installation is broken - permission denied when pulling 'vscode-spectral'

Problem description

When a user does not have a GitHub account or has not added their SSH key to their GitHub account, they may get this error in a loop:

$ yarn install v1.22.19
... [Omitted for brevity]
$ ./script/vscode-spectral-build.sh
Cloning into 'vscode-spectral'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
./script/vscode-spectral-build.sh: line 14: cd: /Users/<redacted>/Downloads/spectral-language-server-master/script/../tmp/vscode-spectral: No such file or directory
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
./script/vscode-spectral-build.sh: line 20: cd: /Users/<redacted>/Downloads/spectral-language-server-master/script/../tmp/vscode-spectral: No such file or directory
yarn config v1.22.19
warning ../../package.json: No license field
success Set "ignore-engines" to "true".
✨  Done in 0.03s.
yarn install v1.22.19
warning ../../package.json: No license field
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] 🔍  Resolving packages...
success Already up-to-date.

Proposed solution

In order to avoid this, cloning using HTTPS should be used instead.

Post install script fails

Running npm i -g spectral-language-server fails.
Seeing this error:

7543 verbose Darwin 21.4.0
7544 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "i" "-g" "spectral-language-server"
7545 verbose node v14.21.3
7546 verbose npm  v6.14.18
7547 error code ELIFECYCLE
7548 error syscall spawn
7549 error file sh
7550 error errno ENOENT
7551 error [email protected] postinstall: `./script/vscode-spectral-build.sh`
7551 error spawn ENOENT
7552 error Failed at the [email protected] postinstall script.
7552 error This is probably not a problem with npm. There is likely additional logging output above.
7553 verbose exit [ 1, true ]

Error: Cannot find module 'vscode-languageserver/lib/utils/is'

Hello! I seem to be struggling to run the executable - after installing spectral-language-server and running the ./node_modules/.bin/spectral-language-server I receive this error:

/Users/williamboman/.local/share/nvim/lsp_servers/spectral/node_modules/.bin/spectral-language-server"	"stderr"	"node:internal/modules/cjs/loader:930
  throw err;
  ^

Error: Cannot find module 'vscode-languageserver/lib/utils/is'
Require stack:
- /Users/williamboman/.local/share/nvim/lsp_servers/spectral/node_modules/spectral-language-server/dist/spectral-language-server/server.js
- /Users/williamboman/.local/share/nvim/lsp_servers/spectral/node_modules/spectral-language-server/bin/spectral-language-server
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:927:15)
    at Function.Module._load (node:internal/modules/cjs/loader:772:27)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:93:18)
    at Object.<anonymous> (/Users/williamboman/.local/share/nvim/lsp_servers/spectral/node_modules/spectral-language-server/dist/spectral-language-server/server.js:7:14)
    at Module._compile (node:internal/modules/cjs/loader:1095:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1124:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:816:12)
    at Module.require (node:internal/modules/cjs/loader:999:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/williamboman/.local/share/nvim/lsp_servers/spectral/node_modules/spectral-language-server/dist/spectral-language-server/server.js',
    '/Users/williamboman/.local/share/nvim/lsp_servers/spectral/node_modules/spectral-language-server/bin/spectral-language-server'
  ]
}

Can't start on neovim

Hi!

I follow this lsp config spectral.

It doesn't work.

Here's a screenshot

spectral

spectral seems to be loaded by neovim properly but it was not attached to the buffer.

If you look at the root directory, the value is NA. It might be the reason for it not to work?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.