Use reserved namespace "QuickType" in C# to avoid the conflict between the top-level type and namespace name.
This commit is contained in:
Родитель
1da6805c05
Коммит
b96ba31e49
|
@ -19,7 +19,7 @@ import IRGraph (IRClassData(..), IRType(..), IRUnionRep, Named, forUnion_, isUni
|
|||
import Options (Option, booleanOption, enumOption)
|
||||
|
||||
forbiddenNames :: Array String
|
||||
forbiddenNames = ["Converter", "JsonConverter", "Type", "Serialize"]
|
||||
forbiddenNames = ["QuickType", "Converter", "JsonConverter", "Type", "Serialize"]
|
||||
|
||||
listOption :: Option Boolean
|
||||
listOption = enumOption "array-type" "Select C# type to use for JSON arrays" [Tuple "array" false, Tuple "list" true]
|
||||
|
@ -119,7 +119,7 @@ csharpDoc = do
|
|||
oneOfThese <- getForSingleOrMultipleTopLevels "" " one of these"
|
||||
line $ "// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do" <> oneOfThese <> ":"
|
||||
line "//"
|
||||
line $ "// using " <> module_ <> ";"
|
||||
line $ "// using QuickType;"
|
||||
forEachTopLevel_ \topLevelName topLevelType -> do
|
||||
line "//"
|
||||
line $ "// var data = " <> module_ <> ".FromJson(jsonString);"
|
||||
|
@ -127,7 +127,7 @@ csharpDoc = do
|
|||
line "// For POCOs visit quicktype.io?poco"
|
||||
line "//"
|
||||
|
||||
line $ "namespace " <> module_
|
||||
line "namespace QuickType"
|
||||
line "{"
|
||||
indent do
|
||||
let using s = line $ "using " <> s <> ";"
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace QuickType
|
|||
{
|
||||
var path = args[0];
|
||||
var json = System.IO.File.ReadAllText(path);
|
||||
var output = QuickType.FromJson(json).ToJson();
|
||||
var output = TopLevel.FromJson(json).ToJson();
|
||||
Console.WriteLine("{0}", output);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -231,7 +231,7 @@ class CSharpJSONFixture extends JSONFixture {
|
|||
setupCommand = "dotnet restore --no-cache";
|
||||
diffViaSchema = true;
|
||||
output = "QuickType.cs";
|
||||
topLevel = "QuickType";
|
||||
topLevel = "TopLevel";
|
||||
|
||||
async test(sample: string) {
|
||||
compareJsonFileToJson({
|
||||
|
|
Загрузка…
Ссылка в новой задаче