All Projects β†’ fadado β†’ JBOL

fadado / JBOL

Licence: MIT License
JBOL is a collection of modules for the JQ language.

Programming Languages

JSONiq
15 projects
shell
77523 projects
Makefile
30231 projects

Projects that are alternatives of or similar to JBOL

schema
SpaceAPI JSON schema files.
Stars: ✭ 20 (-64.29%)
Mutual labels:  json-schema
universal-json-schema
πŸ“œ Universal JSON Schema Form - Currently Support for React - Material UI components for building Web forms from JSON Schema.
Stars: ✭ 102 (+82.14%)
Mutual labels:  json-schema
openui5-validator
A library to validate OpenUI5 fields
Stars: ✭ 17 (-69.64%)
Mutual labels:  json-schema
garden-schema
A simple data validation and cleaning library based on OpenAPI 3.0 Schema.
Stars: ✭ 21 (-62.5%)
Mutual labels:  json-schema
phpunit-json-assertions
JSON assertions for PHPUnit (including JSON Schema)
Stars: ✭ 30 (-46.43%)
Mutual labels:  json-schema
jq.cr
thin JSON::Any wrapper to emulate jq for crystal
Stars: ✭ 15 (-73.21%)
Mutual labels:  jq
element-schema-form
A schema-based element-ui form component for Vue2.x.
Stars: ✭ 31 (-44.64%)
Mutual labels:  json-schema
ty
Here is a schema checker which can return well typed results. Tell your friends!
Stars: ✭ 21 (-62.5%)
Mutual labels:  json-schema
json-schema-migrate
Migrate JSON-Schema draft-04 to draft-07, draft-2019-09 or draft-2020-12
Stars: ✭ 18 (-67.86%)
Mutual labels:  json-schema
portainer-stack-utils
CLI client for Portainer
Stars: ✭ 66 (+17.86%)
Mutual labels:  jq
jfq
JSONata on the command line
Stars: ✭ 29 (-48.21%)
Mutual labels:  jq
jsons2xsd
Highly configurable converter from JSON-schema to XML-schema (XSD).
Stars: ✭ 65 (+16.07%)
Mutual labels:  json-schema
sql-ddl-to-json-schema
SQL DDL to JSON Schema Converter
Stars: ✭ 138 (+146.43%)
Mutual labels:  json-schema
sjq
Command-line JSON processor with Scala syntax
Stars: ✭ 54 (-3.57%)
Mutual labels:  jq
Maat
Validation and transformation library powered by deductive ascending parser. Made to be extended for any kind of project.
Stars: ✭ 27 (-51.79%)
Mutual labels:  json-schema
sf-java-ui
Json Schema Form java based library allow developers to define schema and form using field annotations
Stars: ✭ 23 (-58.93%)
Mutual labels:  json-schema
ontology
Global Insurance Ontology
Stars: ✭ 71 (+26.79%)
Mutual labels:  json-schema
statham-schema
Statham is a Python Model Parsing Library for JSON Schema.
Stars: ✭ 21 (-62.5%)
Mutual labels:  json-schema
php-json-schema-model-generator
Creates (immutable) PHP model classes from JSON-Schema files including all validation rules as PHP code
Stars: ✭ 36 (-35.71%)
Mutual labels:  json-schema
vim-jqplay
Run jq interactively in Vim
Stars: ✭ 56 (+0%)
Mutual labels:  jq

β‰ˆ JBOL β‰ˆ

JBOL is a collection of modules and tools for the JQ language.

jq is a lightweight and flexible command-line JSON processor, and to use jq you must program in the JQ language, a lazy functional language with an evaluation model similar to the goal-directed style of SNOBOL and Icon languages. If you are interested in JBOL you can also see jqt, a related project offering a template engine implemented on top of jq.

The name JBOL has been chosen to honor the inspirational SNOBOL influence.

Modules

All JBOL modules reside in the fadado.github.io directory

Tools

Thin Bash wrappers around JQ filters:

jgen

jgen generates JSON schemas for instance documents.

jval

jval validates instance documents against a JSON schema. jval supports the entire JSON schema draft v4 specification, except for remote references. It’s tested against the official JSON-Schema-Test-Suite, and the only failed tests are in the files definitions.json, ref.json and refRemote.json.

Some of the jval limitations are:

  • Remote references are not supported.
  • Schema-reference resolution does not check recursivity: if there is a nested cross-schema reference, it will not stop.
  • Some checks for the format keyword are not very accurate or consider valid any non empty string.
  • Errors cannot reference exactly the line where are produced.

jxml

jxml transforms JSON values to XML documents.

Installation

If you have the latests GNU Make tool in your system run this command:

$ sudo make install

This will install modules and other data files to /usr/local/share/jbol, and tools to /usr/local/bin.

If you don’t like to install into the /usr/local system directory you can change the destination directory:

$ sudo make install prefix=/your/installation/path

Manual installation

All provided modules are in the fadado.github.io directory. Copy this directory to the top-level JQ modules path with commands equivalent to:

$ sudo mkdir -p /usr/local/share/jbol
$ sudo cp -r fadado.github.io /usr/local/share/jbol

The tools and related schema files can be installed with commands equivalent to:

$ sudo mkdir -p /usr/local/bin
$ sudo cp bin/* /usr/local/bin
$ sudo cp -r schemata /usr/local/share/jbol

Usage

In your JQ scripts include or import modules with directives like

import "fadado.github.io/string" as str;
import "fadado.github.io/string/table" as table;
import "fadado.github.io/string/regexp" as re;

and then use the modules services in your code:

def remove_digits($s):
    $s | table::translate("01234567890"; "")
;
def normalize_space($s):
    $s | [re::split] | str::join(" ")
;

Finally, run your script with the jq appropriated -L option:

$ jq -L/usr/local/share/jbol -f script.jq

To use the tools ask first for help:

$ jgen --help
jgen -- Generates JSON schemas for instance documents

Usage: jgen [-h | --help | -v | --version]
       jgen [options...] [files...]

jgen generates a JSON schema for each instance document read from the
standard input.  One or more files may be specified, in which case jgen will
read input from those instead.

Options:
    -a, --verbose-array     Add array constraints
    -c, --compact           Compact output
    -h, --help              Show this help
    -k, --sort-keys         Sort output keys 
    -n, --verbose-number    Add number constraints
    -o, --verbose-object    Add object constraints
    -r, --required          Add the 'required' keyword
    -s, --verbose-string    Add string constraints
    -v, --version           Print version information
$ jval --help
jval -- Validates instance documents against a JSON schema

Usage: jval [-h | --help | -v | --version]
       jval [options...] schema [file...]

jval validates against an schema a JSON instance document read from the
standard input.  One or more files may be specified, in which case jval will
read input from those instead.

Options:
    -h, --help              Show this help
    -q, --quiet             Suppress all normal output (status is zero or one)
    -s, --schema            Validates a JSON schema against the Schema meta-schema
    -v, --version           Print version information
    -y, --hyper             Validates a JSON schema against the Hyper-Schema meta-schema
$ jxml --help
jxml -- Transforms JSON to XML

Usage: jxml [-h | --help | -v | --version]
       jxml [options...] file

jxml transforms JSON values to XML documents.

Options:
    -h, --help              Show this help
    -r, --root              Set the root element name
    -e, --element           Set the array elements name
    -t, --tab=size          Set the whitespace string for indentation
    -v, --version           Print version information

Tests end examples

The Makefile has rules to help you run the tests included in the tests directory. To run all tests simply execute make, or make check to force the execution, again, of previously successful tests.

Several JQ scripts are included in the examples directory. The Makefile has rules to help you run the examples, but you should study first the code to know how each example works.

As an example, calling 'make nqsmart` runs this script generating in a smart way the solutions for the classical 8 queens problem:

include "fadado.github.io/prelude";
import "fadado.github.io/array" as array;

# Smart N-Queens

def queens($n; $columns):
    def safe($j):
        length as $i | every(
            range($i) as $k
            | .[$k] as $l
            | (($i-$k)|fabs) != (($j-$l)|fabs)
        )
    ;
    def qput:
        if length == $n # assert(($columns - .) == [])
        then . # one solution found
        else
            # for each available column
            ($columns - .)[] as $column
            | select(safe($column))
            | array::push($column)
            | qput
        end
    ;
    #
    [] | qput
;

8 as $N | queens($N; [range($N)])

# vim:ai:sw=4:ts=4:et:syntax=jq

To run the examples and tests the Makefile puts the jq binary full pathname in the macro JQ (defined by default as /usr/local/bin/jq). You can modify this macro definition when calling make using this syntax:

$ make nqsmart JQ=/usr/bin/jq
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].