{"action":"opened","issue":{"url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/issues/218","repository_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript","labels_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/issues/218/labels{/name}","comments_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/issues/218/comments","events_url":"https://api.github.com/repos/bcherny/json-schema-to-typescript/issues/218/events","html_url":"https://github.com/bcherny/json-schema-to-typescript/issues/218","id":405791555,"node_id":"MDU6SXNzdWU0MDU3OTE1NTU=","number":218,"title":"Tuple items with `minItems` and `additionalItems`","user":{"login":"epferrari","id":7064150,"node_id":"MDQ6VXNlcjcwNjQxNTA=","avatar_url":"https://avatars3.githubusercontent.com/u/7064150?v=4","gravatar_id":"","url":"https://api.github.com/users/epferrari","html_url":"https://github.com/epferrari","followers_url":"https://api.github.com/users/epferrari/followers","following_url":"https://api.github.com/users/epferrari/following{/other_user}","gists_url":"https://api.github.com/users/epferrari/gists{/gist_id}","starred_url":"https://api.github.com/users/epferrari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/epferrari/subscriptions","organizations_url":"https://api.github.com/users/epferrari/orgs","repos_url":"https://api.github.com/users/epferrari/repos","events_url":"https://api.github.com/users/epferrari/events{/privacy}","received_events_url":"https://api.github.com/users/epferrari/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-02-01T17:08:02Z","updated_at":"2019-02-01T17:08:02Z","closed_at":null,"author_association":"NONE","body":"We have a use case I don't think is currently covered. We have an array where 2 items must be defined, a max of 3, and the first one has an additional constraint. JsonSchema allows for this, but the generated type isn't what we'd expect.\r\n\r\nschema:\r\n```\r\n{\r\n  \"title\": \"Foo\",\r\n  \"type\": \"array\",\r\n  \"minItems\": 2,\r\n  \"maxItems\": 3,\r\n  \"definitions\": {\r\n    \"foo_0\": {\r\n      \"title\": \"Foo Item\",\r\n      \"type\": \"integer\",\r\n      \"exclusiveMinimum\": 0\r\n    },\r\n    \"foo_n\": {\r\n      \"title\": \"Foo Item\",\r\n      \"type\": \"integer\"\r\n    }\r\n  },\r\n  \"items\": [{\r\n    \"$ref\": \"#/definitions/foo_0\"\r\n  }, {\r\n    \"$ref\": \"#/definitions/foo_n\"\r\n  }],\r\n  \"additionalItems\": {\r\n    \"$ref\": \"#/definitions/foo_n\"\r\n  }\r\n}\r\n```\r\n\r\nactual generated ts:\r\n```\r\nexport type Foo = [FooItem, FooItem1];\r\nexport type FooItem = number;\r\nexport type FooItem1 = number;\r\n```\r\n\r\nexpected generated ts:\r\n```\r\nexport type Foo = [FooItem, FooItem1, FooItem1?];\r\nexport type FooItem = number;\r\nexport type FooItem1 = number;\r\n```\r\n\r\nusing version 6.1.1"}}
{"actor":{"display_login":"epferrari"}}