glideapps / quicktype

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

Use `Name` as a prefix to all class names #1372

Open agarny opened 4 years ago

agarny commented 4 years ago

I thought that #266 fixed what I am after, but maybe not. Basically, say that I have the following JSON code:

{
  "object": "user",
  "url": "https://api.wanikani.com/v2/user",
  "data_updated_at": "2018-04-06T14:26:53.022245Z",
  "data": {
    "id": "5a6a5234-a392-4a87-8f3f-33342afe8a42",
    "username": "example_user",
    "level": 5,
    "max_level_granted_by_subscription": 60,
    "profile_url": "https://www.wanikani.com/users/example_user",
    "started_at": "2012-05-11T00:52:18.958466Z",
    "subscribed": true,
    "current_vacation_started_at": null,
    "subscription": {
      "active": true,
      "type": "recurring",
      "max_level_granted": 60,
      "period_ends_at": "2018-12-11T13:32:19.485748Z"
    },
    "preferences": {
      "default_voice_actor_id": 1,
      "lessons_autoplay_audio": false,
      "lessons_batch_size": 10,
      "lessons_presentation_order": "ascending_level_then_subject",
      "reviews_autoplay_audio": false,
      "reviews_display_srs_indicator": true
    }
  }
}

then, for Dart and with a name of WaniKaniUser, I will end up with the WaniKaniUser, Data, Preferences and Subscription classes while I would find it much better if I was to end up with the WaniKaniUser, WaniKaniUserData, WaniKaniUserDataPreferences and WaniKaniUserDataSubscription classes instead.

dexcell commented 4 years ago

+1

bsquizz commented 3 years ago

Running into this with Go type names as well