glideapps / quicktype

Generate types and converters from JSON, Schema, and GraphQL
https://app.quicktype.io
Apache License 2.0
12.37k stars 1.07k forks source link

Issue adding .net 6 to the dev container. #1999

Closed bzuidgeest closed 2 years ago

bzuidgeest commented 2 years ago

I am trying to add support for .NET 6 system.text.json framework to quicktype. I have a draft of the language generator, but I need it to pass at least some tests. Unfortunately as is the docker container has no support for .net 6.0. So I'm trying to add it.

I changed to dockerfile file commenting out the current line for dotnet and adding two new lines like this (line34):

# RUN apt-get -y install dotnet-sdk-2.1 --assume-yes RUN apt-get -y install dotnet-runtime-2.1 --assume-yes RUN apt-get -y install dotnet-sdk-6.0 --assume-yes

This works in as far as it adds the new versions of the framework and generated the new image. But when I try to run the tests for the old newtonsoft based c# code it failed. It worked fine for the newtonsoft based code with the olds SDK. The thing is I get an error about missing json output, but when I run the code in the runs folder manually I get the expected json output. This makes me think the test script itself my be faulty or at least expect somthing it isn't getting. But I am not even sure how to figure out the exact commandline the test is running. So my first question is: Is there a way to add something to the test script. That outputs the litteral command line that is executed? Second question, what is the test script expecting? The code just pipes json to the command line. I did put the code in a json validator and it validated fine.

any help getting the test env working would be great.

dotnet run -- ../../../test/inputs/json/priority/combinations2.json

**Runnig this as a test of the test :) FIXTURE=csharp npm test -- "test/inputs/json/priority/combinations2.json"

results in: root@53a12e68dcbf:/quicktype# FIXTURE=csharp npm test -- "test/inputs/json/priority/combinations2.json"**

quicktype@15.1.0 test /quicktype jest && script/test "test/inputs/json/priority/combinations2.json"

PASS src/tests/cli/ci.test.ts tryHash ✓ should get undefined if any parameter is (3ms) ✓ should get a string if all parameters are (1ms) getProvider ✓ should get a provider for Travis (1ms) ✓ should get undefined provider for empty environment

Test Suites: 1 passed, 1 total Tests: 4 passed, 4 total Snapshots: 0 total Time: 1.406s Ran all test suites.

and running manually does root@53a12e68dcbf:/quicktype/test/runs/csharp-fab22d# dotnet run -- ../../../test/inputs/json/priority/combinations2.json /usr/share/dotnet/sdk/6.0.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framework 'netcoreapp2.0' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [/quicktype/test/runs/csharp-fab22d/test.csproj] /usr/share/dotnet/sdk/6.0.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framework 'netcoreapp2.0' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [/quicktype/test/runs/csharp-fab22d/test.csproj] /usr/share/dotnet/sdk/6.0.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framework 'netcoreapp2.0' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [/quicktype/test/runs/csharp-fab22d/test.csproj] {"Abranchiata":[null,636,[-555,281]],"academe":[-955,[729,569],{"Mephistophelean":799,"Rutaceae":-866,"Shakti":848,"aeolotropism":-465,"carroter":-84,"chondroid":416,"comatula":992,"ectocornea":608,"finestiller":-718,"fodder":941,"glucosuria":905,"hesitant":-806,"immersionist":737,"paramine":67,"polyphage":22,"promic":690,"reinhabitation":595,"stethospasm":361,"unlimitedly":-445,"wired":964}],"acquirable":[[null,null],[344,-491],{"Fulgoridae":-729,"arcade":588,"aru":-259,"bracelet":696,"corollaceous":-514,"ethiops":-762,"eupsychics":997,"hard":-330,"hedgebote":158,"jaculation":949,"phrasemaking":440,"poverishment":-375,"prestable":852,"recoilment":-903,"savagery":-109,"spritsail":-610,"tearstain":-113,"topiarius":483,"unhang":660,"yolden":716}],"aerometry":[-27.1413546249,true],"alexin":[false,[-57,226]],"alleviate":[[null,null],[582,-605],{"apriori":null,"beggarer":null,"brokenheartedly":null,"debilitation":null,"frike":null,"gastrolith":null,"Hulsean":null,"orthocentric":null,"petaly":null,"probudgeting":null,"reacquire":null,"scow":null,"shutoff":null,"subcontiguous":null,"suffumigate":null,"transformable":null,"uncoroneted":null,"unparking":null,"unvarnishedness":null,"wherewithal":null}],"amaas":[353,true,{"catharticalness":-764.797610839,"Chirotherium":366,"disdiapason":"broo","homocerc":true,"nonbookish":null}],"ambassage":["irreprovable",[null,null]],"amphithyron":[null,{"catharticalness":724.600637309,"Chirotherium":-116,"disdiapason":"gossypose","homocerc":false,"nonbookish":null},{"akroasis":-672,"antiphonical":-400,"basebred":-143,"conductometric":-629,"ensilation":833,"eyebolt":926,"fistulated":556,"heteropod":984,"Juniperus":632,"labyrinthically":480,"martyrization":895,"mispolicy":575,"multipara":-398,"Nazirite":992,"nonbookish":null,"possessorial":-627,"shamed":450,"shelfworn":-262,"stagnum":-614,"Those":80,"undecimal":358}],"Andriana":[null,"Carlist"],"ankee":[72,[-325,282],{"Anomoean":null,"barleyhood":null,"befriender":null,"brutishness":null,"cephalalgy":null,"cirurgian":null,"conventionally":null,"jackshay":null,"milammeter":null,"Naja":null,"ombrological":null,"phonasthenia":null,"retrievableness":null,"snakily":null,"swot":null,"tartlet":null,"thiofuran":null,"tracheophone":null,"tuglike":null,"unscratchingly":null}],"annihilator":[null,{"Falasha":null,"demolition":null,"diplococcic":null,"electromobile":null,"electrothermal":null,"exactor":null,"feasibleness":null,"hedgewise":null,"hypallactic":null,"linoleum":null,"mesoblastema":null,"overflown":null,"paripinnate":null,"proxenete":null,"southeastwardly":null,"tonotactic":null,"uncommonly":null,"unsacredly":null,"warehouser":null,"workbasket":null},{"Emydea":-901,"Sorex":185,"abuse":598,"arrastra":584,"attainability":518,"eudidymite":678,"hexagrammoid":-153,"humet":518,"immunogenicity":-631,"interbring":-478,"menacement":-887,"nightfowl":-685,"nonresidence":-173,"nonsaturated":-980,"overfast":234,"snapped":-169,"snig":-418,"tsia":445,"undercroft":205,"unincisive":722}],"annulose":null,"Ansarie":[null,[555,831],{"accension":null,"Alida":null,"asteria":null,"beriberic":null,"edgebone":null,"gastrodialysis":null,"geographic":null,"Ictonyx":null,"metrocele":null,"misgraft":null,"monteith":null,"notcher":null,"prorestriction":null,"Ramist":null,"throatlet":null,"unfair":null,"unsynonymous":null,"water":null,"zestfully":null,"zincic":null}],"aphasia":[-687,[-155,366]],"asprawl":[-814.0,665.752828874,"nonglacial"],"attractive":[null,true],"barksome":{"Orville":644,"amatungula":390,"armful":-956,"autem":-849,"benzylic":-280,"bort":911,"chariot":504,"cursive":-457,"gerip":-315,"gudge":360,"jiff":-647,"matchbook":-940,"mycodermitis":560,"nonperversive":581,"objurgatorily":-316,"pappose":-240,"paxillary":768,"preagonal":141,"prohibitively":549,"tigellate":622},"bedesman":[70.5844790486,true,"aluminographic"],"belard":[721.444737077,{"catharticalness":888.893278588,"Chirotherium":-423,"disdiapason":"wild","homocerc":false,"nonbookish":null},[-384,189]],"bocking":[true,[889,864],{"Conant":613,"bioblast":-441,"broadleaf":-827,"capacitative":416,"criminally":-957,"dentality":244,"disability":569,"duodenary":678,"electrodeposition":-11,"herpetism":947,"oriental":-205,"perniciously":-863,"photochromoscope":-291,"safekeeper":909,"stifledly":774,"teacherless":984,"tetrahexahedral":260,"underling":144,"xylophonic":-273,"zygotene":-986}],"brawlingly":[[null,null],{"abundantly":null,"bathychrome":null,"bromization":null,"cum":null,"encuirassed":null,"freehandedly":null,"immediacy":null,"incredibly":null,"inkpot":null,"maraca":null,"novelist":null,"plankbuilt":null,"recrop":null,"redeploy":null,"runed":null,"scopoline":null,"shrievalty":null,"suffragial":null,"unstimulating":null,"zooxanthin":null},{"Balsamea":588,"Roncaglian":-205,"Tadousac":-865,"dehumidification":-196,"descendental":-323,"eyeline":934,"jaculator":-91,"outburn":520,"oxen":499,"palliasse":716,"parallelopiped":-474,"philomel":83,"polygon":456,"premisrepresentation":108,"preoblige":734,"quiescent":865,"spreaghery":-285,"trigonotype":532,"unbarrel":290,"undivinelike":289}],"brookie":[{"catharticalness":-964.882206096,"Chirotherium":164,"disdiapason":"housewarm","homocerc":true,"nonbookish":null},[258,-834]],"bumboatman":[null,"weirdness",[null,null]],"bystreet":[null,null],"calaverite":["otosalpinx",[-4,848]],"catallactic":[true,[null,null],{"Alcyoniaceae":687,"Astylosternus":-488,"Glires":-127,"antimaterialist":12,"bronchotomy":-61,"chiromantical":239,"demiram":466,"demonolater":55,"engrossment":931,"fishify":635,"fugaciousness":-268,"gaskin":-287,"impenitible":-36,"paradigmatic":-79,"pensility":-1000,"reallocation":718,"sundries":-397,"thecium":719,"trite":420,"volet":-510}],"cemental":[724.982378842,[-506,-394],{"Darghin":-94,"analyzability":-911,"approximatively":510,"apyonin":-531,"bigeye":103,"chartist":339,"frost":-32,"harangue":-420,"hemicardiac":989,"homomorph":-969,"prodistribution":-656,"purveyable":-373,"sarsaparillin":-335,"significative":572,"singe":-623,"subreputable":-942,"sympathizingly":-694,"uncondition":-118,"viewiness":644,"wankapin":787}],"Chytridiaceae":[null,false,{"Batidaceae":null,"Brechites":null,"codespairer":null,"Emery":null,"enervative":null,"excriminate":null,"goshenite":null,"grime":null,"gritten":null,"hectorly":null,"intermediation":null,"meeterly":null,"Narraganset":null,"onymatic":null,"paddlecock":null,"thana":null,"thornily":null,"uckia":null,"unmettle":null,"vorticellid":null}],"Discordia":[{"catharticalness":707.888589592,"Chirotherium":-648,"disdiapason":"lod","homocerc":false,"nonbookish":null},[-722,-14],{"Altaic":930,"amoristic":-438,"blennophthalmia":-546,"disciplinability":-685,"goofer":-604,"laryngograph":-302,"leucitis":210,"lymphocyst":-27,"microcosmology":168,"nauseation":-687,"nonbookish":null,"Patarin":-357,"preliberal":-956,"prettifier":823,"rangework":-905,"redient":964,"subfusiform":-931,"suicidical":-268,"swow":528,"wastrel":61,"wingle":143}],"Endomyces":[-803,"apoplectically"],"Epinephelidae":[-562,false,"undershunter"],"Eupatorium":[[null,null],{"Toucanid":-269,"baronship":-19,"blitz":-96,"crotalum":-546,"custom":-866,"enrober":-475,"extraessentially":736,"gemsbok":-371,"geomance":610,"metabranchial":440,"moraine":991,"mulatta":-309,"nonlogical":902,"respond":440,"soget":838,"spinage":896,"thickety":-420,"tulsi":-594,"unascertained":-888,"unpoisonous":267}],"Gryphosaurus":["untakeableness",[-13,-780],{"amissibility":null,"Burushaski":null,"citronin":null,"coplaintiff":null,"disquisitionary":null,"enoplan":null,"faintness":null,"hebetomy":null,"islandry":null,"lameduck":null,"overbattle":null,"overinterested":null,"phrenologic":null,"rainband":null,"shiningly":null,"stamineous":null,"subscapularis":null,"Tahami":null,"undaubed":null,"underntime":null}],"Koryak":["neuronophagia",{"Gordian":null,"Leptilon":null,"Lusian":null,"Trixy":null,"adet":null,"aneuric":null,"crownbeard":null,"dishorse":null,"eulogically":null,"finesser":null,"furiant":null,"inguinocrural":null,"intermetatarsal":null,"jatamansi":null,"phosphuranylite":null,"presuperfluously":null,"pseudoleucite":null,"silent":null,"surgent":null,"truxilline":null},{"aciurgy":265,"antihistamine":-240,"apomictic":-13,"besnuff":982,"catabaptist":-651,"emphatically":649,"filled":-381,"here":635,"hydrofluoride":-608,"korrigum":-678,"melch":631,"micrurgic":570,"photocollographic":803,"precondemn":-45,"rechoose":-481,"shouldna":127,"tarbogan":-167,"translatorship":-119,"unbecomingness":-224,"vizierate":-117}],"Lavinia":["unclassible",{"catharticalness":-937.750481497,"Chirotherium":183,"disdiapason":"reshape","homocerc":false,"nonbookish":null},{"agitable":-157,"asininity":911,"benefiter":758,"bronzelike":-92,"cholesteatomatous":405,"deprivement":-837,"flippantness":-539,"fogproof":40,"merrymeeting":-1,"nonbookish":null,"overcareful":-330,"panaris":-927,"preacceptance":-611,"quinoxaline":-716,"sig":-820,"superconfusion":-994,"Tacana":23,"tillotter":744,"tranquillize":-264,"unquestionable":872,"uproute":146}],"Oskar":[[475,-944],{"Acrobates":null,"beanshooter":null,"bearhound":null,"Cayuga":null,"guarneri":null,"hypochondriacism":null,"indication":null,"jaculative":null,"nagana":null,"Netherlandish":null,"noctivagous":null,"nonphysiological":null,"praxis":null,"provision":null,"subterhuman":null,"sunlit":null,"syncraniate":null,"teachment":null,"unmutinous":null,"unstoppable":null}],"Rebecca":[-43,"acaricide",{"catharticalness":232.480170747,"Chirotherium":-917,"disdiapason":"propylic","homocerc":false,"nonbookish":null}],"Rhomboganoidei":["dreepy",{"catharticalness":791.008133876,"Chirotherium":590,"disdiapason":"volatilization","homocerc":false,"nonbookish":null},[529,-33]],"Rigsmal":false,"Ruellia":[true,"Zips",{"catharticalness":636.959203601,"Chirotherium":-471,"disdiapason":"victimize","homocerc":false,"nonbookish":null}],"School":[null,321,{"blackleggery":743,"chairwoman":899,"dismembrate":790,"eversive":716,"factually":375,"haymarket":-984,"houseline":419,"meril":544,"naam":-213,"nerve":-635,"nonrestitution":864,"pronotum":61,"rabic":-690,"secretomotor":711,"supposedly":-358,"supraliminally":884,"therology":-189,"vesicatory":-163,"wholeness":582,"yatalite":-588}],"Shakespearolater":[155.033463436,"prebargain",[531,-575]],"Svan":[433.372246258,764.396717608,-886.894560311,-497.861056331,311.56249378],"Wayao":{"axodendrite":-3.80133922696,"balneological":-635.1546417,"cello":615.279618229,"chalicothere":873.013905706,"electrotyper":-629.721321534,"evermore":-727.274353124,"hamble":957.01778877,"lamel":775.283806764,"livestock":619.854139676,"lufbery":-631.921510193,"otohemineurasthenia":-874.605972402,"palame":571.454927526,"reassault":-694.832007828,"schoolmate":-816.767861762,"scorification":-576.648133658,"shirr":167.093636098,"uncautiousness":828.737119491,"unfence":-73.8271115805,"unofficiating":622.295332899,"zieger":373.738702891}} root@53a12e68dcbf:/quicktype/test/runs/csharp-fab22d#

bzuidgeest commented 2 years ago

I figured out the problem somewhat the test script takes in all output from the console. But when doing old .net stuff .net 6 first output several warnings. like below. That wont validate. Not sure how to fix that.

NETSDK1138: The target framework 'netcoreapp2.0' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [/quicktype/test/runs/csharp-fab22d/test.csproj] /usr/share/dotnet/sdk/6.0.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framework 'netcoreapp2.0' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [/quicktype/test/runs/csharp-fab22d/test.csproj] /usr/share/dotnet/sdk/6.0.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framework 'netcoreapp2.0' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [/quicktype/test/runs/csharp-fab22d/test.csproj]

bzuidgeest commented 2 years ago

Fixed it added to language.ts

-p:CheckEolTargetFramework=false suppresses the warning on the console keeping the json output clean.

export const CSharpLanguage: Language = { name: "csharp", base: "test/fixtures/csharp", // https://github.com/dotnet/cli/issues/1582 setupCommand: "dotnet restore -p:CheckEolTargetFramework=false --no-cache", runCommand(sample: string) { return dotnet run -p:CheckEolTargetFramework=false -- "${sample}"; }, diffViaSchema: true, skipDiffViaSchema: ["34702.json", "437e7.json"], allowMissingNull: false,