Skip to content

Commit 2e49b0b

Browse files
authored
Merge pull request #42 from cchandurkar/develop
v1.6.1 Release
2 parents 6ba2806 + 561b94b commit 2e49b0b

File tree

10 files changed

+756
-69
lines changed

10 files changed

+756
-69
lines changed

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,45 @@ It is optional to pass configuration object. Every configuration setting is opti
147147
| generateValidations | boolean | Whether to generate validations in the form of assertions in case class body. | false |
148148
| generateEnumerations | boolean | Whether to generate enumerations for `enum` fields. It generates an object extending scala's `Enumeration` class and use it in parameter type. | false |
149149

150+
## CLI
151+
152+
It also comes with the CLI. Install the package globally and run:
153+
154+
```bash
155+
js2cc --help
156+
```
157+
OR use with npx
158+
159+
```bash
160+
npx js2cc --help
161+
```
162+
163+
```bash
164+
Usage: js2cc <src> [options]
165+
166+
Convert JSON schemas into scala case class
167+
168+
Arguments:
169+
src Path to json schema. It must be a local file. Support for reading URLs will be added in future version.
170+
171+
Options:
172+
-v, --version Library version
173+
-d, --max-depth <number> Maximum depth to parse nested JSON schema (default: 0)
174+
-s, --option-setting <type> Wrap non-required fields in `Option` (choices: "noOptions", "useOptions", "useOptionsForAll", default: "useOptions")
175+
-n, --top-level-case-class-name <string> Name of the top-level case class (Applies only if JSON schema does not have top-level `title` property. (default: "MyCaseClass")
176+
-d, --default-generic-type <string> Default generic type for unparsable data types (default: "Any")
177+
-p, --parse-refs Parse local and remote references (default: true)
178+
-c, --generate-comments Generate scaladoc comments (default: false)
179+
-v, --generate-validations Generate assertions from validations in JSON schema (default: false)
180+
-e, --generate-enumerations Generate enumerations (default: false)
181+
-o, --output <string> File name to write output to. If not provided, output will be written to console. (default: false)
182+
-D, --debug Write more detailed output to console (default: false)
183+
-h, --help display help for command
184+
185+
Example call:
186+
$ js2cc ./local/sample-schema.json -n Person -s useOptions -o sample-output.scala --debug
187+
```
188+
150189
## Browser Support
151190
This library supports recent versions of every major web browsers. Refer to the browserified build `dist/js2cc.min.js` that you can directly use in `<script />` tag of HTML page. It already bundles all the required polyfills.
152191

0 commit comments

Comments
 (0)