Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/quicktype-vscode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ This extension is available for free in the [Visual Studio Code Marketplace](htt

- `quicktype.justTypes`: Generate only types, or also produce (de)serialization code when using "Open quicktype". When using "Paste", you can pick between the commands for "types" and "code", without having to set this option.

- `quicktype.csharp.framework`: Serialization framework for generated C#: `SystemTextJson` (default, built into .NET, no NuGet needed) or `NewtonSoft`.

- `quicktype.inferMaps`, `quicktype.inferEnums`, `quicktype.inferDateTimes`, `quicktype.inferUuids`, `quicktype.inferBoolStrings`, `quicktype.inferIntegerStrings`: Tell quicktype whether it should try to infer those types from the input JSON. This is not a precise science, so sometimes the guess will be wrong, which is why you can turn them off through these options. Also, quicktype doesn't support dates, UUIDs and stringified integers/booleans in all target languages yet.

## Contribute!
Expand Down
9 changes: 9 additions & 0 deletions packages/quicktype-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@
"default": true,
"description": "Produce only types; no (de-)serialization code"
},
"quicktype.csharp.framework": {
"type": "string",
"enum": [
"NewtonSoft",
"SystemTextJson"
],
"default": "SystemTextJson",
"description": "C# serialization framework: built-in System.Text.Json (default) or Newtonsoft.Json (NuGet)"
},
"quicktype.inferMaps": {
"type": "boolean",
"default": true,
Expand Down
5 changes: 5 additions & 0 deletions packages/quicktype-vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ async function runQuicktype(
justTypes && lang.optionDefinitions.some((o) => o.name === "just-types")
? ({ "just-types": "true" } as RendererOptions)
: {};
// quicktype-core names the C# language "cs"; "csharp" is an alias.
if (lang.names.includes("csharp")) {
(rendererOptions as RendererOptions<"csharp">).framework =
configuration.get("csharp.framework", "SystemTextJson");
}

const inputData = new InputData();
switch (kind) {
Expand Down