You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+39Lines changed: 39 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -147,6 +147,45 @@ It is optional to pass configuration object. Every configuration setting is opti
147
147
| generateValidations | boolean | Whether to generate validations in the form of assertions in case class body. | false |
148
148
| 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 |
149
149
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 forreading URLs will be addedin future version.
170
+
171
+
Options:
172
+
-v, --version Library version
173
+
-d, --max-depth <number> Maximum depth to parse nested JSON schema (default: 0)
-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")
-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 helpforcommand
184
+
185
+
Example call:
186
+
$ js2cc ./local/sample-schema.json -n Person -s useOptions -o sample-output.scala --debug
187
+
```
188
+
150
189
## Browser Support
151
190
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.
0 commit comments