Socket
Socket
Sign inDemoInstall

@crft/jsonata-code-completion

Package Overview
Dependencies
82
Maintainers
6
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @crft/jsonata-code-completion

jsonata code completion


Version published
Weekly downloads
8
increased by700%
Maintainers
6
Install size
2.41 MB
Created
Weekly downloads
 

Readme

Source

jsonata-code-completion

jsonata code completion built to be used in the monaco editor.

  • monaco (https://microsoft.github.io/monaco-editor/index.html)
  • jsonata (https://github.com/jsonata-js/jsonata)

This is a code completer based on json schemas both for source and target data. Jsonata allows to build a json from another json input. Added with schemas for both input and output, this will add code completion. Note that for vscode, more work has to be done since vscode uses a language server.

usage

The schemas can either be addes as jsonata comments and supports http/s protocol only since fetch does not allow local file system access.

        /*sourceSchema=http://localhost:1234/schemas/testSchema.json*/
        /*targetSchema=http://localhost:1234/schemas/testSchema.json*/

Here url starting with sourceSchema and targetSchema will be extracted and loaded with fetch.

Also schemas can be loaded programmatically:

    let source = `
        {
            "obj": obj.name.{
                "aaa":{
                    "obj1":{`
        var exp = jsonata(source,{recover: true});
        var options = {
            //source: source,
            schemas: {
                sourceSchema: require("../tests/schemas/testSchema.json"),
                targetSchema: require("../tests/schemas/testSchema.json"),

            }
        }
        var proposals = await getProposals(exp.ast(), options);

Here the source and target schema is set from code.

installation

npm install

Quick start

node version: in examples/simpleExample.js

browser:

npm run browserify
node tests/server.js

http://localhost:1234/examples/index.html

Keywords

FAQs

Last updated on 01 May 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc