{"action":"created","comment":{"url":"https://api.github.com/repos/marshmallow-code/apispec/pulls/comments/86290369","pull_request_review_id":6954591,"id":86290369,"diff_hunk":"@@ -453,7 +453,7 @@ class Meta:\n     :rtype: dict, a JSON Schema Object\n     \"\"\"\n     Meta = getattr(schema, 'Meta', None)\n-    if getattr(Meta, 'fields', None) or getattr(Meta, 'additional', None):\n+    if (getattr(Meta, 'fields', None) or getattr(Meta, 'additional', None)) and not getattr(Meta, 'model', None):","path":"apispec/ext/marshmallow/swagger.py","position":null,"original_position":5,"commit_id":"0d7e303ac13a4452e91158102bfd1f74994aab98","original_commit_id":"161af732eb2821994086b8ed9d906b2339141406","user":{"login":"khorolets","id":3235740,"avatar_url":"https://avatars.githubusercontent.com/u/3235740?v=3","gravatar_id":"","url":"https://api.github.com/users/khorolets","html_url":"https://github.com/khorolets","followers_url":"https://api.github.com/users/khorolets/followers","following_url":"https://api.github.com/users/khorolets/following{/other_user}","gists_url":"https://api.github.com/users/khorolets/gists{/gist_id}","starred_url":"https://api.github.com/users/khorolets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khorolets/subscriptions","organizations_url":"https://api.github.com/users/khorolets/orgs","repos_url":"https://api.github.com/users/khorolets/repos","events_url":"https://api.github.com/users/khorolets/events{/privacy}","received_events_url":"https://api.github.com/users/khorolets/received_events","type":"User","site_admin":false},"body":"@stasfilin Thank you.\r\n\r\n@sloria I've updated PR\r\n\r\n/cc @frol ","created_at":"2016-11-03T06:21:11Z","updated_at":"2016-11-03T06:21:11Z","html_url":"https://github.com/marshmallow-code/apispec/pull/96#discussion_r86290369","pull_request_url":"https://api.github.com/repos/marshmallow-code/apispec/pulls/96","_links":{"self":{"href":"https://api.github.com/repos/marshmallow-code/apispec/pulls/comments/86290369"},"html":{"href":"https://github.com/marshmallow-code/apispec/pull/96#discussion_r86290369"},"pull_request":{"href":"https://api.github.com/repos/marshmallow-code/apispec/pulls/96"}}},"pull_request":{"url":"https://api.github.com/repos/marshmallow-code/apispec/pulls/96","id":91943153,"html_url":"https://github.com/marshmallow-code/apispec/pull/96","diff_url":"https://github.com/marshmallow-code/apispec/pull/96.diff","patch_url":"https://github.com/marshmallow-code/apispec/pull/96.patch","issue_url":"https://api.github.com/repos/marshmallow-code/apispec/issues/96","number":96,"state":"open","locked":false,"title":"Update the condition to show warning about Meta.fields","user":{"login":"khorolets","id":3235740,"avatar_url":"https://avatars.githubusercontent.com/u/3235740?v=3","gravatar_id":"","url":"https://api.github.com/users/khorolets","html_url":"https://github.com/khorolets","followers_url":"https://api.github.com/users/khorolets/followers","following_url":"https://api.github.com/users/khorolets/following{/other_user}","gists_url":"https://api.github.com/users/khorolets/gists{/gist_id}","starred_url":"https://api.github.com/users/khorolets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khorolets/subscriptions","organizations_url":"https://api.github.com/users/khorolets/orgs","repos_url":"https://api.github.com/users/khorolets/repos","events_url":"https://api.github.com/users/khorolets/events{/privacy}","received_events_url":"https://api.github.com/users/khorolets/received_events","type":"User","site_admin":false},"body":"Closes #95: fields2jsonschema warning about Shema Object\r\n\r\nIf we have `ModelShema` with:\r\n\r\n```python\r\nclass Meta:\r\n        # pylint: disable=missing-docstring\r\n        model = User\r\n        fields = (\r\n            User.id.key,\r\n            User.username.key,\r\n            User.first_name.key,\r\n            User.middle_name.key,\r\n            User.last_name.key,\r\n            'woopy',\r\n        )\r\n        dump_only = (\r\n            User.id.key,\r\n        )\r\n```\r\n\r\nThe field `'woopy'` doesn't exist in model.\r\n\r\nThen in swagger.json we'll have:\r\n```json\r\n...\r\n\"properties\": {\r\n                        \"first_name\": {\r\n                            \"maxLength\": 30,\r\n                            \"type\": \"string\"\r\n                        },\r\n                        \"id\": {\r\n                            \"format\": \"int32\",\r\n                            \"readOnly\": true,\r\n                            \"type\": \"integer\"\r\n                        },\r\n                        \"last_name\": {\r\n                            \"maxLength\": 30,\r\n                            \"type\": \"string\"\r\n                        },\r\n                        \"middle_name\": {\r\n                            \"maxLength\": 30,\r\n                            \"type\": \"string\"\r\n                        },\r\n                        \"username\": {\r\n                            \"maxLength\": 80,\r\n                            \"type\": \"string\"\r\n                        },\r\n                        \"woopy\": {\r\n                            \"type\": \"string\"\r\n                        }\r\n                    },\r\n...\r\n```\r\n\r\nThe `'woopy'` is there as you can see.\r\n\r\nAlso if we have Shema:\r\n\r\n```python\r\nclass User(Schema):\r\n    class Meta:\r\n        fields = (\r\n            'name',\r\n            'last_name',\r\n        )\r\n```\r\n\r\n```python\r\n>>> from app.simple import User\r\n>>> from apispec.ext.marshmallow.swagger import schema2jsonschema\r\n>>> from pprint import pprint\r\n>>> pprint(schema2jsonschema(User))\r\n... site-packages/apispec/ext/marshmallow/swagger.py:450: UserWarning: Only explicitly-declared fields will be included in the Schema Object. Fields defined in Meta.fields or Meta.additional are ignored.\r\n  \"Only explicitly-declared fields will be included in the Schema Object. \"\r\n{'properties': {}, 'type': 'object'}\r\n```\r\n\r\nAs you can see the warning is there and the fields are not.\r\n\r\nI think we don't need that warning if Meta has `model` and we do need it when it's not.","created_at":"2016-11-02T10:26:31Z","updated_at":"2016-11-03T06:21:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9aced9d89007d8ebd60ed7f7696f6500be39dc96","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/marshmallow-code/apispec/pulls/96/commits","review_comments_url":"https://api.github.com/repos/marshmallow-code/apispec/pulls/96/comments","review_comment_url":"https://api.github.com/repos/marshmallow-code/apispec/pulls/comments{/number}","comments_url":"https://api.github.com/repos/marshmallow-code/apispec/issues/96/comments","statuses_url":"https://api.github.com/repos/marshmallow-code/apispec/statuses/0d7e303ac13a4452e91158102bfd1f74994aab98","head":{"label":"khorolets:skip_swagger_warning_if_modelshema","ref":"skip_swagger_warning_if_modelshema","sha":"0d7e303ac13a4452e91158102bfd1f74994aab98","user":{"login":"khorolets","id":3235740,"avatar_url":"https://avatars.githubusercontent.com/u/3235740?v=3","gravatar_id":"","url":"https://api.github.com/users/khorolets","html_url":"https://github.com/khorolets","followers_url":"https://api.github.com/users/khorolets/followers","following_url":"https://api.github.com/users/khorolets/following{/other_user}","gists_url":"https://api.github.com/users/khorolets/gists{/gist_id}","starred_url":"https://api.github.com/users/khorolets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khorolets/subscriptions","organizations_url":"https://api.github.com/users/khorolets/orgs","repos_url":"https://api.github.com/users/khorolets/repos","events_url":"https://api.github.com/users/khorolets/events{/privacy}","received_events_url":"https://api.github.com/users/khorolets/received_events","type":"User","site_admin":false},"repo":{"id":72628112,"name":"apispec","full_name":"khorolets/apispec","owner":{"login":"khorolets","id":3235740,"avatar_url":"https://avatars.githubusercontent.com/u/3235740?v=3","gravatar_id":"","url":"https://api.github.com/users/khorolets","html_url":"https://github.com/khorolets","followers_url":"https://api.github.com/users/khorolets/followers","following_url":"https://api.github.com/users/khorolets/following{/other_user}","gists_url":"https://api.github.com/users/khorolets/gists{/gist_id}","starred_url":"https://api.github.com/users/khorolets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khorolets/subscriptions","organizations_url":"https://api.github.com/users/khorolets/orgs","repos_url":"https://api.github.com/users/khorolets/repos","events_url":"https://api.github.com/users/khorolets/events{/privacy}","received_events_url":"https://api.github.com/users/khorolets/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/khorolets/apispec","description":"A pluggable API specification generator. Currently supports the OpenAPI 2.0 specification (f.k.a. Swagger 2.0).","fork":true,"url":"https://api.github.com/repos/khorolets/apispec","forks_url":"https://api.github.com/repos/khorolets/apispec/forks","keys_url":"https://api.github.com/repos/khorolets/apispec/keys{/key_id}","collaborators_url":"https://api.github.com/repos/khorolets/apispec/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/khorolets/apispec/teams","hooks_url":"https://api.github.com/repos/khorolets/apispec/hooks","issue_events_url":"https://api.github.com/repos/khorolets/apispec/issues/events{/number}","events_url":"https://api.github.com/repos/khorolets/apispec/events","assignees_url":"https://api.github.com/repos/khorolets/apispec/assignees{/user}","branches_url":"https://api.github.com/repos/khorolets/apispec/branches{/branch}","tags_url":"https://api.github.com/repos/khorolets/apispec/tags","blobs_url":"https://api.github.com/repos/khorolets/apispec/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/khorolets/apispec/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/khorolets/apispec/git/refs{/sha}","trees_url":"https://api.github.com/repos/khorolets/apispec/git/trees{/sha}","statuses_url":"https://api.github.com/repos/khorolets/apispec/statuses/{sha}","languages_url":"https://api.github.com/repos/khorolets/apispec/languages","stargazers_url":"https://api.github.com/repos/khorolets/apispec/stargazers","contributors_url":"https://api.github.com/repos/khorolets/apispec/contributors","subscribers_url":"https://api.github.com/repos/khorolets/apispec/subscribers","subscription_url":"https://api.github.com/repos/khorolets/apispec/subscription","commits_url":"https://api.github.com/repos/khorolets/apispec/commits{/sha}","git_commits_url":"https://api.github.com/repos/khorolets/apispec/git/commits{/sha}","comments_url":"https://api.github.com/repos/khorolets/apispec/comments{/number}","issue_comment_url":"https://api.github.com/repos/khorolets/apispec/issues/comments{/number}","contents_url":"https://api.github.com/repos/khorolets/apispec/contents/{+path}","compare_url":"https://api.github.com/repos/khorolets/apispec/compare/{base}...{head}","merges_url":"https://api.github.com/repos/khorolets/apispec/merges","archive_url":"https://api.github.com/repos/khorolets/apispec/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/khorolets/apispec/downloads","issues_url":"https://api.github.com/repos/khorolets/apispec/issues{/number}","pulls_url":"https://api.github.com/repos/khorolets/apispec/pulls{/number}","milestones_url":"https://api.github.com/repos/khorolets/apispec/milestones{/number}","notifications_url":"https://api.github.com/repos/khorolets/apispec/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/khorolets/apispec/labels{/name}","releases_url":"https://api.github.com/repos/khorolets/apispec/releases{/id}","deployments_url":"https://api.github.com/repos/khorolets/apispec/deployments","created_at":"2016-11-02T10:16:33Z","updated_at":"2016-11-02T10:16:34Z","pushed_at":"2016-11-03T06:20:30Z","git_url":"git://github.com/khorolets/apispec.git","ssh_url":"git@github.com:khorolets/apispec.git","clone_url":"https://github.com/khorolets/apispec.git","svn_url":"https://github.com/khorolets/apispec","homepage":"https://apispec.readthedocs.io/","size":361,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"dev"}},"base":{"label":"marshmallow-code:dev","ref":"dev","sha":"963667053c705658f262dc0bc174c89b9be9e24f","user":{"login":"marshmallow-code","id":10334301,"avatar_url":"https://avatars.githubusercontent.com/u/10334301?v=3","gravatar_id":"","url":"https://api.github.com/users/marshmallow-code","html_url":"https://github.com/marshmallow-code","followers_url":"https://api.github.com/users/marshmallow-code/followers","following_url":"https://api.github.com/users/marshmallow-code/following{/other_user}","gists_url":"https://api.github.com/users/marshmallow-code/gists{/gist_id}","starred_url":"https://api.github.com/users/marshmallow-code/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marshmallow-code/subscriptions","organizations_url":"https://api.github.com/users/marshmallow-code/orgs","repos_url":"https://api.github.com/users/marshmallow-code/repos","events_url":"https://api.github.com/users/marshmallow-code/events{/privacy}","received_events_url":"https://api.github.com/users/marshmallow-code/received_events","type":"Organization","site_admin":false},"repo":{"id":25413181,"name":"apispec","full_name":"marshmallow-code/apispec","owner":{"login":"marshmallow-code","id":10334301,"avatar_url":"https://avatars.githubusercontent.com/u/10334301?v=3","gravatar_id":"","url":"https://api.github.com/users/marshmallow-code","html_url":"https://github.com/marshmallow-code","followers_url":"https://api.github.com/users/marshmallow-code/followers","following_url":"https://api.github.com/users/marshmallow-code/following{/other_user}","gists_url":"https://api.github.com/users/marshmallow-code/gists{/gist_id}","starred_url":"https://api.github.com/users/marshmallow-code/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marshmallow-code/subscriptions","organizations_url":"https://api.github.com/users/marshmallow-code/orgs","repos_url":"https://api.github.com/users/marshmallow-code/repos","events_url":"https://api.github.com/users/marshmallow-code/events{/privacy}","received_events_url":"https://api.github.com/users/marshmallow-code/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/marshmallow-code/apispec","description":"A pluggable API specification generator. Currently supports the OpenAPI 2.0 specification (f.k.a. Swagger 2.0).","fork":false,"url":"https://api.github.com/repos/marshmallow-code/apispec","forks_url":"https://api.github.com/repos/marshmallow-code/apispec/forks","keys_url":"https://api.github.com/repos/marshmallow-code/apispec/keys{/key_id}","collaborators_url":"https://api.github.com/repos/marshmallow-code/apispec/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/marshmallow-code/apispec/teams","hooks_url":"https://api.github.com/repos/marshmallow-code/apispec/hooks","issue_events_url":"https://api.github.com/repos/marshmallow-code/apispec/issues/events{/number}","events_url":"https://api.github.com/repos/marshmallow-code/apispec/events","assignees_url":"https://api.github.com/repos/marshmallow-code/apispec/assignees{/user}","branches_url":"https://api.github.com/repos/marshmallow-code/apispec/branches{/branch}","tags_url":"https://api.github.com/repos/marshmallow-code/apispec/tags","blobs_url":"https://api.github.com/repos/marshmallow-code/apispec/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/marshmallow-code/apispec/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/marshmallow-code/apispec/git/refs{/sha}","trees_url":"https://api.github.com/repos/marshmallow-code/apispec/git/trees{/sha}","statuses_url":"https://api.github.com/repos/marshmallow-code/apispec/statuses/{sha}","languages_url":"https://api.github.com/repos/marshmallow-code/apispec/languages","stargazers_url":"https://api.github.com/repos/marshmallow-code/apispec/stargazers","contributors_url":"https://api.github.com/repos/marshmallow-code/apispec/contributors","subscribers_url":"https://api.github.com/repos/marshmallow-code/apispec/subscribers","subscription_url":"https://api.github.com/repos/marshmallow-code/apispec/subscription","commits_url":"https://api.github.com/repos/marshmallow-code/apispec/commits{/sha}","git_commits_url":"https://api.github.com/repos/marshmallow-code/apispec/git/commits{/sha}","comments_url":"https://api.github.com/repos/marshmallow-code/apispec/comments{/number}","issue_comment_url":"https://api.github.com/repos/marshmallow-code/apispec/issues/comments{/number}","contents_url":"https://api.github.com/repos/marshmallow-code/apispec/contents/{+path}","compare_url":"https://api.github.com/repos/marshmallow-code/apispec/compare/{base}...{head}","merges_url":"https://api.github.com/repos/marshmallow-code/apispec/merges","archive_url":"https://api.github.com/repos/marshmallow-code/apispec/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/marshmallow-code/apispec/downloads","issues_url":"https://api.github.com/repos/marshmallow-code/apispec/issues{/number}","pulls_url":"https://api.github.com/repos/marshmallow-code/apispec/pulls{/number}","milestones_url":"https://api.github.com/repos/marshmallow-code/apispec/milestones{/number}","notifications_url":"https://api.github.com/repos/marshmallow-code/apispec/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/marshmallow-code/apispec/labels{/name}","releases_url":"https://api.github.com/repos/marshmallow-code/apispec/releases{/id}","deployments_url":"https://api.github.com/repos/marshmallow-code/apispec/deployments","created_at":"2014-10-18T23:48:49Z","updated_at":"2016-11-02T02:56:36Z","pushed_at":"2016-11-03T06:20:31Z","git_url":"git://github.com/marshmallow-code/apispec.git","ssh_url":"git@github.com:marshmallow-code/apispec.git","clone_url":"https://github.com/marshmallow-code/apispec.git","svn_url":"https://github.com/marshmallow-code/apispec","homepage":"https://apispec.readthedocs.io/","size":395,"stargazers_count":111,"watchers_count":111,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":28,"mirror_url":null,"open_issues_count":11,"forks":28,"open_issues":11,"watchers":111,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/marshmallow-code/apispec/pulls/96"},"html":{"href":"https://github.com/marshmallow-code/apispec/pull/96"},"issue":{"href":"https://api.github.com/repos/marshmallow-code/apispec/issues/96"},"comments":{"href":"https://api.github.com/repos/marshmallow-code/apispec/issues/96/comments"},"review_comments":{"href":"https://api.github.com/repos/marshmallow-code/apispec/pulls/96/comments"},"review_comment":{"href":"https://api.github.com/repos/marshmallow-code/apispec/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/marshmallow-code/apispec/pulls/96/commits"},"statuses":{"href":"https://api.github.com/repos/marshmallow-code/apispec/statuses/0d7e303ac13a4452e91158102bfd1f74994aab98"}}}}
{"actor":{"display_login":"khorolets"}}