{"action":"closed","issue":{"url":"https://api.github.com/repos/schematics/schematics/issues/341","repository_url":"https://api.github.com/repos/schematics/schematics","labels_url":"https://api.github.com/repos/schematics/schematics/issues/341/labels{/name}","comments_url":"https://api.github.com/repos/schematics/schematics/issues/341/comments","events_url":"https://api.github.com/repos/schematics/schematics/issues/341/events","html_url":"https://github.com/schematics/schematics/issues/341","id":112257512,"number":341,"title":"Classes instead of instances in ModelType","user":{"login":"jmsdnns","id":7950614,"avatar_url":"https://avatars.githubusercontent.com/u/7950614?v=3","gravatar_id":"","url":"https://api.github.com/users/jmsdnns","html_url":"https://github.com/jmsdnns","followers_url":"https://api.github.com/users/jmsdnns/followers","following_url":"https://api.github.com/users/jmsdnns/following{/other_user}","gists_url":"https://api.github.com/users/jmsdnns/gists{/gist_id}","starred_url":"https://api.github.com/users/jmsdnns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmsdnns/subscriptions","organizations_url":"https://api.github.com/users/jmsdnns/orgs","repos_url":"https://api.github.com/users/jmsdnns/repos","events_url":"https://api.github.com/users/jmsdnns/events{/privacy}","received_events_url":"https://api.github.com/users/jmsdnns/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-20T00:07:46Z","updated_at":"2016-04-26T23:08:12Z","closed_at":"2016-04-26T23:08:12Z","body":"I don't like the way the current ModelType paradigm works.\r\n\r\nThe syntax for defining a `ModelType` is to list the _classes_ and not _instances_ of the class. This is less flexible.\r\n\r\nIn PR [#340](https://github.com/schematics/schematics/pull/340) I introduced a `PolyType` which will use a list of validators from type instances each with their own restraints, like `min_length` in the snippet below. Using classes, instead of instances, prevents this level of flexibility. I prefer to change the syntax for using `ModelTypes` than reduce functionality in the new `PolyType`.\r\n\r\nFrom the snippet in PR 340:\r\n\r\n```python\r\nclass Foo(Model):\r\n    bla = ListType(PolyType([IntType(), StringType(min_length=3)]))\r\n```\r\n\r\nAnd the behavior of the `ModelType`:\r\n\r\n```python\r\nclass Band(Model):\r\n    name = StringType()\r\n\r\nclass Person(Model):\r\n    band =  ModelType(Band) # this is the offending line\r\n```\r\n\r\nI would prefer `band = ModelType(Band())`\r\n\r\nAnother consideration is that default data would be possible for ModelTypes now too. I don't have a specific use case for this piece, but it is an interesting consequence of making the system internally consistent."}}