quicktype icon indicating copy to clipboard operation
quicktype copied to clipboard

dart-null-safty and more

Open stha-ums opened this issue 4 years ago • 3 comments

Following are the things I worked on:

added detect enum option
added null-safety
make all properties nullable
keep properties name, enum, and union name same as Key in JSON (this is useful while generated for Freezed with JsonSerializer) .

This is the second PR with only changes in dart.ts. The PR sent before was failing to build so this is 2nd try.

stha-ums avatar Jul 23 '21 17:07 stha-ums

  • added null-safety

Closes #1673, #1692, #1711, #1723, #1729, #1737, #1739, #1741, #1744, #1747, #1748, #1751, #1753, #1755, #1758, #1760

Fun fact : Since #1673, about 18% of this repo's issues are about Dart's Null Safety.

Originally posted by @NatoBoram in https://github.com/quicktype/quicktype/issues/1740#issuecomment-873036544

stha-ums avatar Jul 23 '21 17:07 stha-ums

@stha-ums Thank you!

There are still some failures with Dart:

* [169/1065] dart() test/runs/dart-d06247/bug863.json: 456 ms
  |  
  | Unhandled exception:
  | NoSuchMethodError: The method 'map' was called on null.
  | Receiver: null
  | Tried calling: map(Closure: (dynamic) => TentacledChild)
  | #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
  | #1      new FluffyChild.fromJson (file:///app/test/runs/dart-720d70/TopLevel.dart:219:62)
  | #2      new PurpleChild.fromJson.<anonymous closure> (file:///app/test/runs/dart-720d70/TopLevel.dart:139:82)
  | #3      MappedListIterable.elementAt (dart:_internal/iterable.dart:417:31)
  | #4      ListIterator.moveNext (dart:_internal/iterable.dart:343:26)
  | #5      new List.from (dart:core-patch/array_patch.dart:57:19)
  | #6      new PurpleChild.fromJson (file:///app/test/runs/dart-720d70/TopLevel.dart:139:19)
  | #7      new TopLevelChild.fromJson.<anonymous closure> (file:///app/test/runs/dart-720d70/TopLevel.dart:73:82)
  | #8      MappedListIterable.elementAt (dart:_internal/iterable.dart:417:31)
  | #9      ListIterator.moveNext (dart:_internal/iterable.dart:343:26)
  | #10     new List.from (dart:core-patch/array_patch.dart:57:19)
  | #11     new TopLevelChild.fromJson (file:///app/test/runs/dart-720d70/TopLevel.dart:73:19)
  | #12     new TopLevel.fromJson.<anonymous closure> (file:///app/test/runs/dart-720d70/TopLevel.dart:29:86)
  | #13     MappedListIterable.elementAt (dart:_internal/iterable.dart:417:31)
  | #14     ListIterator.moveNext (dart:_internal/iterable.dart:343:26)
  | #15     new List.from (dart:core-patch/array_patch.dart:57:19)
  | #16     new TopLevel.fromJson (file:///app/test/runs/dart-720d70/TopLevel.dart:29:19)
  | #17     topLevelFromJson (file:///app/test/runs/dart-720d70/TopLevel.dart:7:51)
  | #18     main.<anonymous closure> (file:///app/test/runs/dart-720d70/parser.dart:7:22)
  | #19     _RootZone.runUnary (dart:async/zone.dart:1450:54)
  | #20     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
  | #21     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)

There's also some weird Python failure, which can't have anything to do with your PR. I'll look into that.

schani avatar Jul 23 '21 19:07 schani

The amount of duplicate issues raised for this has grown significantly since last PR.

  • #1673
  • #1692
  • #1711
  • #1723
  • #1729
  • #1737
  • #1739
  • #1741
  • #1744
  • #1747
  • #1748
  • #1751
  • #1753
  • #1755
  • #1758
  • #1760
  • #1769
  • #1783
  • #1785
  • #1786
  • #1790
  • #1792
  • #1794
  • #1799
  • #1800
  • #1801
  • #1802
  • #1810
  • #1812
  • #1818
  • #1826
  • #1830
  • #1843
  • #1855
  • #1857
  • #1861
  • #1889
  • #1898

Since #1673, about 17% of this repo's issues are about Dart's Null Safety and @required.

NatoBoram avatar Nov 25 '21 17:11 NatoBoram

@NatoBoram @stha-ums Hello! We have fixed our CI and package publishing. I would be happy to assist in getting this merged.

dvdsgl avatar Jan 01 '23 17:01 dvdsgl

moving to #1904

dvdsgl avatar Jan 01 '23 18:01 dvdsgl