-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquicktype-cli.txt
More file actions
309 lines (253 loc) · 26.8 KB
/
quicktype-cli.txt
File metadata and controls
309 lines (253 loc) · 26.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
Synopsis
$ quicktype [--lang LANG] [--src-lang SRC_LANG] [--out FILE] FILE|URL ...
LANG ... cs|go|rs|cr|cjson|c++|objc|java|ts|js|javascript-prop-
types|flow|swift|scala3|Smithy|kotlin|elm|schema|ruby|dart|py|pike|haskell|typescript-
zod|typescript-effect-schema|php
SRC_LANG ... json|schema|graphql|postman|typescript
Description
Given JSON sample data, quicktype outputs code for working with that data in
C#, Go, Rust, Crystal, C (cJSON), C++, Objective-C, Java, TypeScript,
JavaScript, JavaScript PropTypes, Flow, Swift, Scala3, Smithy, Kotlin, Elm,
JSON Schema, Ruby, Dart, Python, Pike, Haskell, TypeScript Zod, TypeScript
Effect Schema, PHP.
Options
-o, --out FILE The output file. Determines --lang and --top-level.
-t, --top-level NAME The name for the top level type.
-l, --lang LANG The target language.
-s, --src-lang SRC_LANG The source language (default is json).
--src FILE|URL|DIRECTORY The file, url, or data directory to type.
--src-urls FILE Tracery grammar describing URLs to crawl.
--no-maps Don't infer maps, always use classes.
--no-enums Don't infer enums, always use strings.
--no-uuids Don't convert UUIDs to UUID objects.
--no-date-times Don't infer dates or times.
--no-integer-strings Don't convert stringified integers to integers.
--no-boolean-strings Don't convert stringified booleans to booleans.
--no-combine-classes Don't combine similar classes.
--no-ignore-json-refs Treat $ref as a reference in JSON.
--graphql-schema FILE GraphQL introspection file.
--graphql-introspect URL Introspect GraphQL schema from a server.
--http-method METHOD HTTP method to use for the GraphQL introspection query.
--http-header HEADER Header(s) to attach to all HTTP requests, including the
GraphQL introspection query.
-S, --additional-schema FILE Register the $id's of additional JSON Schema files.
--alphabetize-properties Alphabetize order of class properties.
--all-properties-optional Make all class properties optional.
--quiet Don't show issues in the generated code.
--debug OPTIONS or all Comma separated debug options: print-graph, print-
reconstitution, print-gather-names, print-transformations,
print-schema-resolving, print-times, provenance
--telemetry enable|disable Enable anonymous telemetry to help improve quicktype
-h, --help Get some help.
-v, --version Display the version of quicktype
Options for C#
--framework NewtonSoft|SystemTextJson Serialization framework
--namespace NAME Generated namespace
--csharp-version 5|6 C# version
--density normal|dense Property density
--array-type array|list Use T[] or List<T>
--number-type double|decimal Type to use for numbers
--any-type object|dynamic Type to use for "any"
--[no-]virtual Generate virtual properties (off by default)
--features complete|attributes-only|just-types-and- Output features
namespace|just-types
--base-class EntityData|Object Base class
--[no-]check-required Fail if required properties are missing (off by default)
--[no-]keep-property-name Keep original field name generate (off by default)
Options for Go
--[no-]just-types Plain types only (off by default)
--[no-]just-types-and-package Plain types with package only (off by default)
--package NAME Generated package name
--[no-]multi-file-output Renders each top-level object in its own Go file (off by
default)
--field-tags TAGS list of tags which should be generated for fields
--[no-]omit-empty If set, all non-required objects will be tagged with
",omitempty" (off by default)
Options for Rust
--density normal|dense Density
--visibility private|crate|public Field visibility
--[no-]derive-debug Derive Debug impl (off by default)
--[no-]derive-clone Derive Clone impl (off by default)
--[no-]derive-partial-eq Derive PartialEq impl (off by default)
--[no-]edition-2018 Edition 2018 (on by default)
--[no-]leading-comments Leading Comments (on by default)
--[no-]skip-serializing-none Skip serializing empty Option fields (off by default)
Options for C (cJSON)
--source-style single-source|multi-source Source code generation type, whether to generate single or
multiple source files
--integer-size int8_t|int16_t|int32_t|int64_t Integer code generation type (int64_t by default)
--typedef-alias no-typedef|add-typedef Add typedef alias to unions, structs, and enums (no
typedef by default)
--print-style print-formatted|print-unformatted Which cJSON print should be used (formatted by default)
--hashtable-size SIZE Hashtable size, used when maps are created (64 by default)
--type-style pascal-case|underscore-case|camel-case|upper- Naming style for types
underscore-case|pascal-case-upper-acronyms|camel-case-
upper-acronyms
--member-style underscore-case|pascal-case|camel- Naming style for members
case|upper-underscore-case|pascal-case-upper-
acronyms|camel-case-upper-acronyms
--enumerator-style upper-underscore-case|underscore- Naming style for enumerators
case|pascal-case|camel-case|pascal-case-upper-
acronyms|camel-case-upper-acronyms
Options for C++
--[no-]just-types Plain types only (off by default)
--namespace NAME Name of the generated namespace(s)
--code-format with-struct|with-getter-setter Generate classes with getters/setters, instead of structs
--wstring use-string|use-wstring Store strings using Utf-16 std::wstring, rather than Utf-8
std::string
--const-style west-const|east-const Put const to the left/west (const T) or right/east (T
const)
--source-style single-source|multi-source Source code generation type, whether to generate single
or multiple source files
--include-location local-include|global-include Whether json.hpp is to be located globally or locally
--type-style pascal-case|underscore-case|camel-case|upper- Naming style for types
underscore-case|pascal-case-upper-acronyms|camel-case-
upper-acronyms
--member-style underscore-case|pascal-case|camel- Naming style for members
case|upper-underscore-case|pascal-case-upper-
acronyms|camel-case-upper-acronyms
--enumerator-style upper-underscore-case|underscore- Naming style for enumerators
case|pascal-case|camel-case|pascal-case-upper-
acronyms|camel-case-upper-acronyms
--enum-type NAME Type of enum class
--[no-]boost Require a dependency on boost. Without boost, C++17 is
required (on by default)
--[no-]hide-null-optional Hide null value for optional field (off by default)
Options for Objective-C
--[no-]just-types Plain types only (off by default)
--class-prefix PREFIX Class prefix
--features all|interface|implementation Interface and implementation
--[no-]extra-comments Extra comments (off by default)
--[no-]functions C-style functions (off by default)
Options for Java
--array-type array|list Use T[] or List<T>
--[no-]just-types Plain types only (off by default)
--datetime-provider java8|legacy Date time provider type
--acronym-style original|pascal|camel|lowerCase Acronym naming style
--package NAME Generated package name
--[no-]lombok Use lombok (off by default)
--[no-]lombok-copy-annotations Copy accessor annotations (on by default)
Options for TypeScript
--[no-]just-types Interfaces only (off by default)
--[no-]nice-property-names Transform property names to be JavaScripty (off by
default)
--[no-]explicit-unions Explicitly name unions (off by default)
--[no-]runtime-typecheck Verify JSON.parse results at runtime (on by default)
--[no-]runtime-typecheck-ignore-unknown-properties Ignore unknown properties when verifying at runtime (off
by default)
--acronym-style original|pascal|camel|lowerCase Acronym naming style
--converters top-level|all-objects Which converters to generate (top-level by default)
--raw-type json|any Type of raw input (json by default)
--[no-]prefer-unions Use union type instead of enum (off by default)
--[no-]prefer-types Use types instead of interfaces (off by default)
--[no-]prefer-const-values Use string instead of enum for string enums with single
value (off by default)
Options for JavaScript
--[no-]runtime-typecheck Verify JSON.parse results at runtime (on by default)
--[no-]runtime-typecheck-ignore-unknown-properties Ignore unknown properties when verifying at runtime (off
by default)
--acronym-style original|pascal|camel|lowerCase Acronym naming style
--converters top-level|all-objects Which converters to generate (top-level by default)
--raw-type json|any Type of raw input (json by default)
Options for JavaScript PropTypes
--acronym-style original|pascal|camel|lowerCase Acronym naming style
--converters top-level|all-objects Which converters to generate (top-level by default)
Options for Flow
--[no-]just-types Interfaces only (off by default)
--[no-]nice-property-names Transform property names to be JavaScripty (off by
default)
--[no-]explicit-unions Explicitly name unions (off by default)
--[no-]runtime-typecheck Verify JSON.parse results at runtime (on by default)
--[no-]runtime-typecheck-ignore-unknown-properties Ignore unknown properties when verifying at runtime (off
by default)
--acronym-style original|pascal|camel|lowerCase Acronym naming style
--converters top-level|all-objects Which converters to generate (top-level by default)
--raw-type json|any Type of raw input (json by default)
--[no-]prefer-unions Use union type instead of enum (off by default)
--[no-]prefer-types Use types instead of interfaces (off by default)
--[no-]prefer-const-values Use string instead of enum for string enums with single
value (off by default)
Options for Swift
--[no-]just-types Plain types only (off by default)
--struct-or-class struct|class Structs or classes
--density dense|normal Code density
--[no-]initializers Generate initializers and mutators (on by default)
--[no-]coding-keys Explicit CodingKey values in Codable types (on by default)
--access-level internal|public Access level
--[no-]alamofire Alamofire extensions (off by default)
--[no-]support-linux Support Linux (off by default)
--type-prefix PREFIX Prefix for type names
--protocol none|equatable|hashable Make types implement protocol
--acronym-style original|pascal|camel|lowerCase Acronym naming style
--[no-]objective-c-support Objects inherit from NSObject and @objcMembers is added to
classes (off by default)
--[no-]optional-enums If no matching case is found enum value is set to null
(off by default)
--[no-]sendable Mark generated models as Sendable (off by default)
--[no-]swift-5-support Renders output in a Swift 5 compatible mode (off by
default)
--[no-]multi-file-output Renders each top-level object in its own Swift file (off
by default)
--[no-]mutable-properties Use var instead of let for object properties (off by
default)
Options for Scala3
--framework just-types|circe|upickle Serialization framework
--package PACKAGE Package
Options for Smithy
--framework just-types Serialization framework
--package PACKAGE Package
Options for Kotlin
--framework just-types|jackson|klaxon|kotlinx Serialization framework
--acronym-style original|pascal|camel|lowerCase Acronym naming style
--package PACKAGE Package
Options for Elm
--[no-]just-types Plain types only (off by default)
--module NAME Generated module name
--array-type array|list Use Array or List
Options for Ruby
--[no-]just-types Plain types only (off by default)
--strictness strict|coercible|none Type strictness
--namespace NAME Specify a wrapping Namespace
Options for Dart
--[no-]null-safety Null Safety (on by default)
--[no-]just-types Types only (off by default)
--[no-]coders-in-class Put encoder & decoder in Class (off by default)
--[no-]from-map Use method names fromMap() & toMap() (off by default)
--[no-]required-props Make all properties required (off by default)
--[no-]final-props Make all properties final (off by default)
--[no-]copy-with Generate CopyWith method (off by default)
--[no-]use-freezed Generate class definitions with @freezed compatibility
(off by default)
--[no-]use-hive Generate annotations for Hive type adapters (off by
default)
--[no-]use-json-annotation Generate annotations for json_serializable (off by
default)
--part-name NAME Use this name in `part` directive
Options for Python
--python-version 3.5|3.6|3.7 Python version
--[no-]just-types Classes only (off by default)
--[no-]nice-property-names Transform property names to be Pythonic (on by default)
Options for Haskell
--[no-]just-types Plain types only (off by default)
--module NAME Generated module name
--array-type array|list Use Array or List
Options for PHP
--[no-]with-get Create Getter (on by default)
--[no-]fast-get getter without validation (off by default)
--[no-]with-set Create Setter (off by default)
--[no-]with-closing PHP Closing Tag (off by default)
--acronym-style original|pascal|camel|lowerCase Acronym naming style
Examples
Generate C# to parse a Bitcoin API
$ quicktype -o LatestBlock.cs https://blockchain.info/latestblock
Generate Go code from a directory of samples containing:
- Foo.json
+ Bar
- bar-sample-1.json
- bar-sample-2.json
- Baz.url
$ quicktype -l go samples
Generate JSON Schema, then TypeScript
$ quicktype -o schema.json https://blockchain.info/latestblock
$ quicktype -o bitcoin.ts --src-lang schema schema.json
Learn more at quicktype.io