Git Product home page Git Product logo

atom-json-schema's Introduction

Json Schema

Adds support for JSON Schema in Atom.

Whats it do

Using is-my-json-valid for schema validation, Json Schema warns the user if their json file doesn't match the commonly defined schema. Also using the defined Json Schema we can offer auto completion results for enum values.

Extentions

Json Schema was built for use with OmniSharp. There is an extension point that lets you plug in custom intellisense providers. This is to help with tools like Npm or NuGet, where package.json and project.json both have their package references. This this extension point you can plug in calls off to the associated webservice / localcache / whatever you want.

Npm support

As stated above, NPM support is added out of the box. Search is limited to starts with (if anyone knows how to fuzzy search against skimdb log an issue!). We can add the package for you, as well as the latest version as values.

Bower support

Bower support is planned, I still have to figure out the best way to find version numbers (or if its even possible since bower uses git...).

Make your own schema provider

The schema interface is declared in typescript as follows:

interface IAutocompleteProvider {
    fileMatchs: string[];
    pathMatch: (path: string) => boolean;
    getSuggestions: (options: IAutocompleteProviderOptions) => Promise<Suggestion[]>;
    dispose(): void;
}

interface IAutocompleteProviderOptions {
    editor: Atom.TextEditor;
    bufferPosition: TextBuffer.Point; // the position of the cursor
    prefix: string;
    scopeDescriptor: { scopes: string[] };
    activatedManually: boolean;
    path: string;
}
  • fileMatchs are the files that the provider applies to
  • pathMatch is a callback method that lets you determine. The path that is give is based on where the user has their cursor in the file.
  • getSuggestions identical to autocomplete+ with a few extra options.
    • path is the path part of the file such as dependencies or dependencies.lodash

Then in your package.json add...

"jsonschema.provider": {
  "versions": {
    "0.1.0": "consumeProvider"
  }
}

TODO

  • Bower support?
  • JSPM support?
  • Allow for custom $schema's

atom-json-schema's People

Contributors

david-driscoll avatar luisrudge avatar

Watchers

 avatar  avatar

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.