Json Schema Cheat Sheet
This is a quick reference guide for useful comby options.
Useful command line options
-i | replace files in place |
-d dir | only process files recursively and directories in dir |
-zip zipfile | process files in a ZIP archive |
-jobs n | run n processes in parallel |
-matcher language | select the language to parse the file as (see more) |
-exclude prefix | exclude files with names or paths that start with prefix |
-exclude-dir prefix | same as -exclude but applies only to directories |
– Exclude multiple prefixes with commas:
Understanding JSON Schema¶ JSON Schema is a powerful tool for validating the structure of JSON data. However, learning to use it by reading its specification is like learning to drive a car by looking at its blueprints. You don’t need to know how an electric motor fits together if all you want to do is pick up the groceries. The JSON API specification the following design goals: Standardising the JSON schema (irrespective of the data you’re transmitting) Minimising the number of client requests; Minimising the amount of data transmitted; Understanding how each is achieved is essential in effectively using its features.
See comby -help
for a complete list of flags.
How do I…
- SELECT c1, c2 FROM t1 UNION ALL SELECT c1, c2 FROM t2. Return the intersection of two queries. SELECT c1, c2 FROM t1 INTERSECT SELECT c1, c2 FROM t2. Subtract a result set from another result set. SELECT c1, c2 FROM t1 MINUS SELECT c1, c2 FROM t2. Query rows using pattern matching%,.
- JSON Schema Cheat Sheet Cheat Sheets, Programmierung Cheat Sheet, Javascript, JSON Since June 2011, several major search engines have been collaborating on.
Run multiple search-and-replace templates?
Have a look at using configuration files. Alternatively, use adirectory of rewrite templates with the -templates
option and run it like so:
It’s important to use the -f
option for filtering files when using-templates
, or comby
will think it is an anonymous argument for a commandline template.
The path/to/directory
should contain folders, one for each rewrite pattern,that contain two files: one named match
and the other named rewrite
. An optionalrule can be put in the same directory, in a file called rule
. For example,
See the catalog directory layout for a sample catalog of templates.
Extract matches?
First way: Add -match-only -json-lines
will print matched content, matchedvalues for holes, and ranges in JSON format. One line is printed per match.
Use jq to extract values you’re interested infrom the JSON. See the JSON schema for what the JSONoutput contains.
Second way: Add -newline-separated -stdout
if you’re only interested inthe matched fragments and don’t want to fiddle with JSON.
This will print all matches terminal, one entry per line. If -match-only
isremoved, all rewritten-values are printed.
Review changes before accepting them?
Interactively review changes on the command line using -review
, just like in codemod:
You’ll see, for example:
Get raw patches?
Add -diff
to get patches as unified diffs.
Select the language to parse?
Comby will try and infer the language to parse based on file extensions, andwill fall back to the generic parser if it does not recognize an extension. Seta language using the -matcher
flag to force using a language parser, like-matcher .js
or -matcher .c
. See all languages by running comby -list
.Note: you can use -matcher .js
to parse files as a Javascript file even ifthey end in a different suffix, like my.custom.file.suffix
Convert Json To Json Schema
Pipe input to comby?
Add -stdin
to have comby
accept input from pipes, and -stdout
to write to print to standard out.
Json Schema Cheat Sheet Pdf
Specify rules on the command line?
Json Schema Cheat Sheet Excel
Use the -rule
option to specify rules: