GitXplorerGitXplorer
r

SAMU-JSV

public
0 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
bb3c6a3f8f8a71f521802b28bd9782744a76b78a

Small improvements (jsv redirect to jsv/, ANS logo, no popup on load, schema version)

rromainfd committed a year ago
Unverified
f4492cc9a85a9ba859276e4c3a701ad2656089b2

Making it work for our schema + deployable on K8s cluster

rromainfd committed a year ago
Unverified
5c812f5d66a738447547409edc542803e5d83f6d

Merge pull request #14 from szimmer1/rvm_compat

jjlblcc committed 8 years ago
Unverified
38075780cfa12519dcb45951e6fd658cfd4f0678

RVM compatibility: Added .ruby-version, Gemfile, and Gemfile.lock

sszimmer1 committed 8 years ago
Unverified
9f2159ec5197052985e79d52b0da4751f356a1a9

Update README.md

jjlblcc committed 8 years ago
Unverified
dd799ec8ff4353bd07b2208e04f430c82217f5ac

Merge pull request #13 from korvent/master

jjlblcc committed 8 years ago

README

The README file for this repository.

Hub Santé - JSON Schema Viewer (JSV)

Site de manipulation des structures de données JSON Schema

Deploy

docker buildx build --platform linux/amd64 -t romainfd/hub-jsv:latest .
docker push romainfd/hub-jsv:latest
# Make sure you are on correct Kubernetes context
kubectl replace --force -f ../SAMU-Hub-Sante/hub/infra/web/json-schema-viewer.yaml

Comments

Run locally

grunt prod 
python -m http.server

Schemas are passed from hub-schemas/ to schemas/ using Gruntfile.js's copy:prod:files task

Schema id should match his name with trailing # (e.g. schema.json#) to run OK


JSON Schema Viewer Build Status

JavaScript tool for visualizing json-schemas, includes validator.

Fair warning, the code "just works" - it could use a good refactoring. Pull requests welcome. The JSV was built to support a specific use case, so support for JSON schema(draft v4) keywords are added on an as-needed basis. You may also notice a few extensions to the spec, e.g. example, translation, version, deprecated, etc.

The demo is rendering the mdJson-schemas. There's also a basic example without the jQuery Mobile interface elements.

JSDocs are here

Built using:

Installation

  1. Clone repository: git clone https://github.com/jlblcc/json-schema-viewer.git
  2. Enter project directory: cd json-schema-viewer
  3. Install dependencies via Bower: bower install
  4. Install dependencies via NPM: npm install
  5. Build project via Grunt: grunt
    • grunt dev: Development build. This will create dev.html and basic.html in the project root(these files are .gitignored). This build will load all unminified js files individually.
    • grunt prod: Production build. This will create a production version at ./prod/<%= pkg.version %>/<%= now %>/<%= ver %>. The production version includes concatenated and minified js/css. Note: jQuery/JQuery Mobile are not included in the js builds. The prod directory is also .gitignored.
  6. Serve with your favorite web server:

Use in Browser

          (function($) {

            var loc = window.location;
            //if not already set, set the root schema location
            //this allows dev ENV to override the schema location
            var schema = JSV.schema ? JSV.schema : loc.origin + loc.pathname.substring(0, loc.pathname.lastIndexOf('/') + 1) + 'schemas/schema/schema.json';

            JSV.init({
              schema : schema,
              plain : true, //don't use JQM
              viewerHeight : $('#main-body').height(), //set initial dimensions of SVG
              viewerWidth : $('#main-body').width()
            }, function() {
              $('#jsv-tree').css('width', '100%');
              //set diagram width to 100%, this DOES NOT resize the svg container
              //it will not adjust to window resize, needs a listener to support that
              JSV.resetViewer();
              $('#loading').fadeOut('slow');
            });
          })(jQuery);

The JSV.schema property must be set to the url of your schema.

Example: http://jlblcc.github.io/json-schema-viewer/basic.html

##Development

Edit the templates to modify layout:

  • index.html: jQuery Mobile interface. Copied to /dev.html on grunt dev.
  • basic.html: a basic example without jQuery Mobile or Sass dependency(css included in <head>).
  • latest.html: redirects to the last production build. Copied to /index.html on grunt prod.

##Grunt

See [Gruntfile.js] (https://github.com/jlblcc/json-schema-viewer/blob/master/Gruntfile.js) or the JSDocs for details on the available Grunt tasks. grunt --help will also list available tasks.

This project was inspired by robschmuecker’s block #7880033.