Merge pull request #866 from quicktype/fix-csharp-union-array

Fix C# union array
This commit is contained in:
Mark Probst 2018-05-29 08:52:54 -07:00 коммит произвёл GitHub
Родитель 8df7e5e475 cb42245ced
Коммит b26154faa4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 469 добавлений и 3 удалений

Просмотреть файл

@ -230,8 +230,9 @@ export class CSharpRenderer extends ConvenienceRenderer {
}
protected csType(t: Type, follow: (t: Type) => Type = followTargetType, withIssues: boolean = false): Sourcelike {
const actualType = follow(t);
return matchType<Sourcelike>(
follow(t),
actualType,
_anyType => maybeAnnotated(withIssues, anyTypeIssueAnnotation, this._csOptions.typeForAny),
_nullType => maybeAnnotated(withIssues, nullTypeIssueAnnotation, this._csOptions.typeForAny),
_boolType => "bool",
@ -239,7 +240,7 @@ export class CSharpRenderer extends ConvenienceRenderer {
_doubleType => this.doubleType,
_stringType => "string",
arrayType => {
const itemsType = this.csType(arrayType.items, noFollow, withIssues);
const itemsType = this.csType(arrayType.items, follow, withIssues);
if (this._csOptions.useList) {
return ["List<", itemsType, ">"];
} else {
@ -247,7 +248,7 @@ export class CSharpRenderer extends ConvenienceRenderer {
}
},
classType => this.nameForNamedType(classType),
mapType => ["Dictionary<string, ", this.csType(mapType.values, noFollow, withIssues), ">"],
mapType => ["Dictionary<string, ", this.csType(mapType.values, follow, withIssues), ">"],
enumType => this.nameForNamedType(enumType),
unionType => {
const nullable = nullableFromUnion(unionType);

Просмотреть файл

@ -391,6 +391,7 @@ const skipTypeScriptTests = [
"pokedex.json", // Enums are screwed up: https://github.com/YousefED/typescript-json-schema/issues/186
"github-events.json",
"bug855-short.json",
"bug863.json",
"00c36.json",
"010b1.json",
"050b0.json",

Просмотреть файл

@ -0,0 +1,460 @@
[
{
"NANORACECOUNT": 2,
"MINLVL": 1,
"ENFCOUNT": 3,
"NUMMEMBERS": 22,
"NEUTERCOUNT": 7,
"KEEPERCOUNT": 2,
"OPIFEXCOUNT": 3,
"ORG_DIMENSION": 5,
"MONSTERCOUNT": 0,
"SOLIDERCOUNT": 1,
"BTCOUNT": 1,
"AGENTCOUNT": 0,
"FIXERCOUNT": 1,
"MACOUNT": 6,
"GOVERNINGNAME": "Republic",
"SOLITUSCOUNT": 10,
"TRADERCOUNT": 1,
"METACOUNT": 2,
"MAXLVL": 220,
"ORG_INSTANCE": 1030147,
"DOCTORCOUNT": 1,
"OBJECTIVE": "",
"ATROXCOUNT": 7,
"SHADECOUNT": 0,
"DESCRIPTION": "",
"HISTORY": "",
"AVGLVL": 77.8182,
"NAME": "All 'Bout Dat Action",
"MALECOUNT": 9,
"NANOCOUNT": 1,
"SIDE_NAME": "Clan",
"ENGINEEERCOUNT": 1,
"ADVENTURERCOUNT": 2,
"SIDE": 1,
"FEMALECOUNT": 6
},
[
{
"SEX": "Neuter",
"BREED": "Atrox",
"PVPRATING": 1300,
"NAME": "Swiftkeep",
"FIRSTNAME": "",
"PVPTITLE": "Freshman",
"LASTNAME": "",
"CHAR_DIMENSION": 5,
"RANK_TITLE": "President",
"RANK": 0,
"ALIENLEVEL": 6,
"PROF_TITLE": "Warden",
"HEADID": 40111,
"LEVELX": 60,
"PROF": "Keeper",
"CHAR_INSTANCE": 378933,
"DEFENDER_RANK_TITLE": "Student"
},
{
"SEX": "Male",
"BREED": "Solitus",
"PVPRATING": 1300,
"NAME": "Theadventure",
"FIRSTNAME": "",
"PVPTITLE": "Freshman",
"LASTNAME": "",
"CHAR_DIMENSION": 5,
"RANK_TITLE": "Advisor",
"RANK": 1,
"ALIENLEVEL": 0,
"PROF_TITLE": "Preserver",
"HEADID": 223809,
"LEVELX": 86,
"PROF": "Adventurer",
"CHAR_INSTANCE": 804659691,
"DEFENDER_RANK_TITLE": "None"
},
{
"SEX": "Male",
"BREED": "Opifex",
"PVPRATING": 1300,
"NAME": "Brokensystem",
"FIRSTNAME": "",
"PVPTITLE": "Freshman",
"LASTNAME": "",
"CHAR_DIMENSION": 5,
"RANK_TITLE": "Advisor",
"RANK": 1,
"ALIENLEVEL": 19,
"PROF_TITLE": "Dictator",
"HEADID": 40269,
"LEVELX": 220,
"PROF": "Bureaucrat",
"CHAR_INSTANCE": 78470,
"DEFENDER_RANK_TITLE": "Supporter"
},
{
"SEX": "Neuter",
"BREED": "Atrox",
"PVPRATING": 1300,
"NAME": "Luckyleopard",
"FIRSTNAME": "Chi",
"PVPTITLE": "Freshman",
"LASTNAME": "Washko",
"CHAR_DIMENSION": 5,
"RANK_TITLE": "Advisor",
"RANK": 1,
"ALIENLEVEL": 0,
"PROF_TITLE": "Foreman",
"HEADID": 40128,
"LEVELX": 60,
"PROF": "Enforcer",
"CHAR_INSTANCE": 174738500,
"DEFENDER_RANK_TITLE": "None"
},
{
"SEX": "Male",
"BREED": "Solitus",
"PVPRATING": 1300,
"NAME": "Squishysteve",
"FIRSTNAME": "",
"PVPTITLE": "Freshman",
"LASTNAME": "",
"CHAR_DIMENSION": 5,
"RANK_TITLE": "Advisor",
"RANK": 1,
"ALIENLEVEL": 0,
"PROF_TITLE": "Monk",
"HEADID": 40681,
"LEVELX": 62,
"PROF": "Martial Artist",
"CHAR_INSTANCE": 544205831,
"DEFENDER_RANK_TITLE": "None"
},
{
"SEX": "Male",
"BREED": "Solitus",
"PVPRATING": 1300,
"NAME": "Restored",
"FIRSTNAME": "",
"PVPTITLE": "Freshman",
"LASTNAME": "",
"CHAR_DIMENSION": 5,
"RANK_TITLE": "Veteran",
"RANK": 2,
"ALIENLEVEL": 0,
"PROF_TITLE": "Embezzler",
"HEADID": 223811,
"LEVELX": 86,
"PROF": "Fixer",
"CHAR_INSTANCE": 804659690,
"DEFENDER_RANK_TITLE": "None"
},
{
"SEX": "Male",
"BREED": "Solitus",
"PVPRATING": 1300,
"NAME": "Swiftboost",
"FIRSTNAME": "",
"PVPTITLE": "Freshman",
"LASTNAME": "",
"CHAR_DIMENSION": 5,
"RANK_TITLE": "Veteran",
"RANK": 2,
"ALIENLEVEL": 0,
"PROF_TITLE": "Mechanic",
"HEADID": 40681,
"LEVELX": 38,
"PROF": "Engineer",
"CHAR_INSTANCE": 804660704,
"DEFENDER_RANK_TITLE": "None"
},
{
"SEX": "Male",
"BREED": "Solitus",
"PVPRATING": 1300,
"NAME": "Prock",
"FIRSTNAME": "",
"PVPTITLE": "Freshman",
"LASTNAME": "",
"CHAR_DIMENSION": 5,
"RANK_TITLE": "Applicant",
"RANK": 4,
"ALIENLEVEL": 0,
"PROF_TITLE": "Merchant",
"HEADID": 40708,
"LEVELX": 51,
"PROF": "Trader",
"CHAR_INSTANCE": 1558700,
"DEFENDER_RANK_TITLE": "None"
},
{
"SEX": "Female",
"BREED": "Opifex",
"PVPRATING": 1300,
"NAME": "Mrsister",
"FIRSTNAME": "",
"PVPTITLE": "Freshman",
"LASTNAME": "",
"CHAR_DIMENSION": 5,
"RANK_TITLE": "Applicant",
"RANK": 4,
"ALIENLEVEL": 0,
"PROF_TITLE": "Master 5th Dan",
"HEADID": 40219,
"LEVELX": 131,
"PROF": "Martial Artist",
"CHAR_INSTANCE": 804660183,
"DEFENDER_RANK_TITLE": "None"
},
{
"SEX": "Neuter",
"BREED": "Atrox",
"PVPRATING": 1300,
"NAME": "Manakeepit",
"FIRSTNAME": "",
"PVPTITLE": "Freshman",
"LASTNAME": "",
"CHAR_DIMENSION": 5,
"RANK_TITLE": "Applicant",
"RANK": 4,
"ALIENLEVEL": 4,
"PROF_TITLE": "Warden",
"HEADID": 40111,
"LEVELX": 87,
"PROF": "Keeper",
"CHAR_INSTANCE": 801056370,
"DEFENDER_RANK_TITLE": "Starter"
},
{
"SEX": "Male",
"BREED": "Solitus",
"PVPRATING": 1300,
"NAME": "Worked",
"FIRSTNAME": "",
"PVPTITLE": "Freshman",
"LASTNAME": "",
"CHAR_DIMENSION": 5,
"RANK_TITLE": "Applicant",
"RANK": 4,
"ALIENLEVEL": 0,
"PROF_TITLE": "Soldier",
"HEADID": 40681,
"LEVELX": 81,
"PROF": "Soldier",
"CHAR_INSTANCE": 807715454,
"DEFENDER_RANK_TITLE": "None"
},
{
"SEX": "Female",
"BREED": "Opifex",
"PVPRATING": 1300,
"NAME": "Grits",
"FIRSTNAME": "",
"PVPTITLE": "Freshman",
"LASTNAME": "",
"CHAR_DIMENSION": 5,
"RANK_TITLE": "Applicant",
"RANK": 4,
"ALIENLEVEL": 0,
"PROF_TITLE": "Monk",
"HEADID": 40209,
"LEVELX": 54,
"PROF": "Martial Artist",
"CHAR_INSTANCE": 315184,
"DEFENDER_RANK_TITLE": "None"
},
{
"SEX": "Neuter",
"BREED": "Atrox",
"PVPRATING": 1300,
"NAME": "Thataction",
"FIRSTNAME": "",
"PVPTITLE": "Freshman",
"LASTNAME": "",
"CHAR_DIMENSION": 5,
"RANK_TITLE": "Applicant",
"RANK": 4,
"ALIENLEVEL": 0,
"PROF_TITLE": "Foreman",
"HEADID": 40113,
"LEVELX": 65,
"PROF": "Enforcer",
"CHAR_INSTANCE": 804659684,
"DEFENDER_RANK_TITLE": "None"
},
{
"SEX": "Female",
"BREED": "Nano",
"PVPRATING": 1300,
"NAME": "Yolopenos",
"FIRSTNAME": "",
"PVPTITLE": "Freshman",
"LASTNAME": "",
"CHAR_DIMENSION": 5,
"RANK_TITLE": "Applicant",
"RANK": 4,
"ALIENLEVEL": 0,
"PROF_TITLE": "ArchPriest",
"HEADID": 40136,
"LEVELX": 102,
"PROF": "Meta-Physicist",
"CHAR_INSTANCE": 807715109,
"DEFENDER_RANK_TITLE": "None"
},
{
"SEX": "Neuter",
"BREED": "Atrox",
"PVPRATING": 1300,
"NAME": "Swiftforces",
"FIRSTNAME": "",
"PVPTITLE": "Freshman",
"LASTNAME": "",
"CHAR_DIMENSION": 5,
"RANK_TITLE": "Applicant",
"RANK": 4,
"ALIENLEVEL": 0,
"PROF_TITLE": "Worker",
"HEADID": 40100,
"LEVELX": 42,
"PROF": "Enforcer",
"CHAR_INSTANCE": 810588411,
"DEFENDER_RANK_TITLE": "None"
},
{
"SEX": "Neuter",
"BREED": "Atrox",
"PVPRATING": 1300,
"NAME": "Boutdatbot",
"FIRSTNAME": "",
"PVPTITLE": "Freshman",
"LASTNAME": "",
"CHAR_DIMENSION": 5,
"RANK_TITLE": "Applicant",
"RANK": 4,
"ALIENLEVEL": 0,
"PROF_TITLE": "Novice",
"HEADID": 40111,
"LEVELX": 1,
"PROF": "Nano-Technician",
"CHAR_INSTANCE": 804660195,
"DEFENDER_RANK_TITLE": "None"
},
{
"SEX": "Male",
"BREED": "Solitus",
"PVPRATING": 1300,
"NAME": "Currensy",
"FIRSTNAME": "",
"PVPTITLE": "Freshman",
"LASTNAME": "",
"CHAR_DIMENSION": 5,
"RANK_TITLE": "Applicant",
"RANK": 4,
"ALIENLEVEL": 0,
"PROF_TITLE": "Master 5th Dan",
"HEADID": 40673,
"LEVELX": 117,
"PROF": "Martial Artist",
"CHAR_INSTANCE": 281296483,
"DEFENDER_RANK_TITLE": "None"
},
{
"SEX": "Female",
"BREED": "Solitus",
"PVPRATING": 1300,
"NAME": "Slentu",
"FIRSTNAME": "",
"PVPTITLE": "Freshman",
"LASTNAME": "",
"CHAR_DIMENSION": 5,
"RANK_TITLE": "Applicant",
"RANK": 4,
"ALIENLEVEL": 0,
"PROF_TITLE": "Surgeon",
"HEADID": 40663,
"LEVELX": 100,
"PROF": "Doctor",
"CHAR_INSTANCE": 804659700,
"DEFENDER_RANK_TITLE": "None"
},
{
"SEX": "Neuter",
"BREED": "Atrox",
"PVPRATING": 1300,
"NAME": "Zrano",
"FIRSTNAME": "",
"PVPTITLE": "Freshman",
"LASTNAME": "",
"CHAR_DIMENSION": 5,
"RANK_TITLE": "Applicant",
"RANK": 4,
"ALIENLEVEL": 0,
"PROF_TITLE": "Adventurer",
"HEADID": 40099,
"LEVELX": 100,
"PROF": "Adventurer",
"CHAR_INSTANCE": 704390080,
"DEFENDER_RANK_TITLE": "None"
},
{
"SEX": "Female",
"BREED": "Solitus",
"PVPRATING": 1300,
"NAME": "Lasuli",
"FIRSTNAME": "",
"PVPTITLE": "Freshman",
"LASTNAME": "",
"CHAR_DIMENSION": 5,
"RANK_TITLE": "Applicant",
"RANK": 4,
"ALIENLEVEL": 0,
"PROF_TITLE": "Monk",
"HEADID": 40664,
"LEVELX": 73,
"PROF": "Martial Artist",
"CHAR_INSTANCE": 801056131,
"DEFENDER_RANK_TITLE": "None"
},
{
"SEX": "Female",
"BREED": "Nano",
"PVPRATING": 1300,
"NAME": "Iandrath",
"FIRSTNAME": "",
"PVPTITLE": "Freshman",
"LASTNAME": "",
"CHAR_DIMENSION": 5,
"RANK_TITLE": "Applicant",
"RANK": 4,
"ALIENLEVEL": 2,
"PROF_TITLE": "Devotee",
"HEADID": 40135,
"LEVELX": 43,
"PROF": "Meta-Physicist",
"CHAR_INSTANCE": 807716616,
"DEFENDER_RANK_TITLE": "Amateur"
},
{
"SEX": "Male",
"BREED": "Solitus",
"PVPRATING": 1300,
"NAME": "Mossyrock",
"FIRSTNAME": "",
"PVPTITLE": "Freshman",
"LASTNAME": "",
"CHAR_DIMENSION": 5,
"RANK_TITLE": "Applicant",
"RANK": 4,
"ALIENLEVEL": 0,
"PROF_TITLE": "Monk",
"HEADID": 40717,
"LEVELX": 53,
"PROF": "Martial Artist",
"CHAR_INSTANCE": 753553096,
"DEFENDER_RANK_TITLE": "None"
}
],
"2018/05/19 08:39:19"
]

Просмотреть файл

@ -132,6 +132,7 @@ export const RubyLanguage: Language = {
"recursive.json",
"combinations.json",
"bug427.json",
"bug863.json",
"kitchen-sink.json",
"github-events.json",
"nbl-stats.json",
@ -203,6 +204,7 @@ export const GoLanguage: Language = {
skipDiffViaSchema: [
"combinations.json",
"bug427.json",
"bug863.json",
"github-events.json",
"reddit.json",
"nbl-stats.json",
@ -299,6 +301,7 @@ export const ElmLanguage: Language = {
},
diffViaSchema: true,
skipDiffViaSchema: [
"bug863.json",
"reddit.json",
"github-events.json",
"nbl-stats.json",
@ -453,6 +456,7 @@ export const TypeScriptLanguage: Language = {
diffViaSchema: true,
skipDiffViaSchema: [
"bug427.json",
"bug863.json",
"kitchen-sink.json",
"nbl-stats.json",
"00c36.json",