payload: {"action":"created","issue":{"url":"https://api.github.com/repos/vojtechhabarta/typescript-generator/issues/448","repository_url":"https://api.github.com/repos/vojtechhabarta/typescript-generator","labels_url":"https://api.github.com/repos/vojtechhabarta/typescript-generator/issues/448/labels{/name}","comments_url":"https://api.github.com/repos/vojtechhabarta/typescript-generator/issues/448/comments","events_url":"https://api.github.com/repos/vojtechhabarta/typescript-generator/issues/448/events","html_url":"https://github.com/vojtechhabarta/typescript-generator/pull/448","id":546169201,"node_id":"MDExOlB1bGxSZXF1ZXN0MzU5ODk2NTU1","number":448,"title":"Nullability in Kotlin and Java","user":{"login":"vojtechhabarta","id":1191407,"node_id":"MDQ6VXNlcjExOTE0MDc=","avatar_url":"https://avatars3.githubusercontent.com/u/1191407?v=4","gravatar_id":"","url":"https://api.github.com/users/vojtechhabarta","html_url":"https://github.com/vojtechhabarta","followers_url":"https://api.github.com/users/vojtechhabarta/followers","following_url":"https://api.github.com/users/vojtechhabarta/following{/other_user}","gists_url":"https://api.github.com/users/vojtechhabarta/gists{/gist_id}","starred_url":"https://api.github.com/users/vojtechhabarta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vojtechhabarta/subscriptions","organizations_url":"https://api.github.com/users/vojtechhabarta/orgs","repos_url":"https://api.github.com/users/vojtechhabarta/repos","events_url":"https://api.github.com/users/vojtechhabarta/events{/privacy}","received_events_url":"https://api.github.com/users/vojtechhabarta/received_events","type":"User","site_admin":false},"labels":[{"id":701239970,"node_id":"MDU6TGFiZWw3MDEyMzk5NzA=","url":"https://api.github.com/repos/vojtechhabarta/typescript-generator/labels/Kotlin","name":"Kotlin","color":"497bb7","default":false,"description":null}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2020-01-07T09:18:26Z","updated_at":"2020-01-08T17:27:29Z","closed_at":null,"author_association":"OWNER","pull_request":{"url":"https://api.github.com/repos/vojtechhabarta/typescript-generator/pulls/448","html_url":"https://github.com/vojtechhabarta/typescript-generator/pull/448","diff_url":"https://github.com/vojtechhabarta/typescript-generator/pull/448.diff","patch_url":"https://github.com/vojtechhabarta/typescript-generator/pull/448.patch"},"body":"This is continuation of #442.\r\n\r\n## Introduction\r\n\r\n### Nullable types in TypeScript\r\n\r\nIn _strict_ mode TypeScript supports [non-nullable types](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-0.html#null--and-undefined-aware-types). This means that for example `string` type doesn't permit `null` and `undefined` values. If some variable should be able to store those values its type could be union `string | null | undefined`.\r\n\r\nExample with arrays:\r\n``` typescript\r\nconst list1: string[] = [\"text\", null];  // error\r\nconst list2: (string | null)[] = [\"text\", null];  // ok\r\n```\r\n\r\n### Nullable types in Kotlin\r\n\r\nIn Kotlin regular types don't permit `null` values. Nullable types can be created using `?` character.\r\n\r\nExample with lists:\r\n``` kotlin\r\nval list1: List<String> = listOf(\"text\", null)  // error\r\nval list2: List<String?> = listOf(\"text\", null)  // ok\r\n```\r\n\r\n### Nullable types in Java\r\n\r\nJava doesn't have concept of nullability. But in Java 8 (and later) it is possible to use annotations also on types. So for example list which allows `null` values can be written as `List<@Nullable String>`. Please note that such nullable annotation must have `TYPE_USE` target. So it is possible to use for example `org.checkerframework.checker.nullness.qual.Nullable` but not `javax.annotation.Nullable`.\r\n\r\nExample with lists:\r\n``` java\r\nList<@NonNull String> list1 = Arrays.asList(\"text\", null);  // can be reported\r\nList<@Nullable String> list2 = Arrays.asList(\"text\", null);  // ok\r\n```\r\n\r\n## Typescript-generator's support for nullability\r\n\r\nTypescript-generator is now able to represent internally and emit nullable types. For Kotlin classes nullability is detected automatically using Kotlin reflection. For Java classes it is needed to configure used nullable annotation(s) using `nullableAnnotations` parameter.\r\n\r\nHow exactly will nullable types look like in generated output is specified using `nullabilityDefinition` parameter. Let's say we have following Java class:\r\n``` java\r\npublic class Lists {\r\n    public List<String> list1;\r\n    public @Nullable List<String> list2;\r\n    public List<@Nullable String> list3;\r\n    public @Nullable List<@Nullable String> list4;\r\n}\r\n```\r\nWhen `nullabilityDefinition` parameter is set to `nullAndUndefinedUnion` (default) output will be:\r\n``` typescript\r\ninterface Lists {\r\n    list1: string[];\r\n    list2?: Nullable<string[]>;\r\n    list3: Nullable<string>[];\r\n    list4?: Nullable<Nullable<string>[]>;\r\n}\r\ntype Nullable<T> = T | null | undefined;\r\n```\r\nOr when `nullabilityDefinition` parameter is set to `nullInlineUnion` output will be:\r\n``` typescript\r\ninterface Lists {\r\n    list1: string[];\r\n    list2: string[] | null;\r\n    list3: (string | null)[];\r\n    list4: (string | null)[] | null;\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/vojtechhabarta/typescript-generator/issues/comments/572172847","html_url":"https://github.com/vojtechhabarta/typescript-generator/pull/448#issuecomment-572172847","issue_url":"https://api.github.com/repos/vojtechhabarta/typescript-generator/issues/448","id":572172847,"node_id":"MDEyOklzc3VlQ29tbWVudDU3MjE3Mjg0Nw==","user":{"login":"RobbinBaauw","id":5289010,"node_id":"MDQ6VXNlcjUyODkwMTA=","avatar_url":"https://avatars2.githubusercontent.com/u/5289010?v=4","gravatar_id":"","url":"https://api.github.com/users/RobbinBaauw","html_url":"https://github.com/RobbinBaauw","followers_url":"https://api.github.com/users/RobbinBaauw/followers","following_url":"https://api.github.com/users/RobbinBaauw/following{/other_user}","gists_url":"https://api.github.com/users/RobbinBaauw/gists{/gist_id}","starred_url":"https://api.github.com/users/RobbinBaauw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RobbinBaauw/subscriptions","organizations_url":"https://api.github.com/users/RobbinBaauw/orgs","repos_url":"https://api.github.com/users/RobbinBaauw/repos","events_url":"https://api.github.com/users/RobbinBaauw/events{/privacy}","received_events_url":"https://api.github.com/users/RobbinBaauw/received_events","type":"User","site_admin":false},"created_at":"2020-01-08T17:27:29Z","updated_at":"2020-01-08T17:27:29Z","author_association":"CONTRIBUTOR","body":"Good! I think sticking to the Jackson default is indeed best. I'd prefer `nullInlineUnion`, as you're only 1 click away from viewing the type instead of 2. \r\n\r\nNote that I didn't check the entire PR, I mostly checked whether the reason that I propagated the types through the chain (because of nested types) was handled, and it was. Looking forward to a new release with this!"}}
other: {"actor":{"display_login":"RobbinBaauw"}}