{"action":"created","issue":{"url":"https://api.github.com/repos/zircote/swagger-php/issues/523","repository_url":"https://api.github.com/repos/zircote/swagger-php","labels_url":"https://api.github.com/repos/zircote/swagger-php/issues/523/labels{/name}","comments_url":"https://api.github.com/repos/zircote/swagger-php/issues/523/comments","events_url":"https://api.github.com/repos/zircote/swagger-php/issues/523/events","html_url":"https://github.com/zircote/swagger-php/issues/523","id":324606134,"node_id":"MDU6SXNzdWUzMjQ2MDYxMzQ=","number":523,"title":"I have two model,each containing another one in the other.How to make it circulate only one layer？","user":{"login":"jc91715","id":24908449,"node_id":"MDQ6VXNlcjI0OTA4NDQ5","avatar_url":"https://avatars2.githubusercontent.com/u/24908449?v=4","gravatar_id":"","url":"https://api.github.com/users/jc91715","html_url":"https://github.com/jc91715","followers_url":"https://api.github.com/users/jc91715/followers","following_url":"https://api.github.com/users/jc91715/following{/other_user}","gists_url":"https://api.github.com/users/jc91715/gists{/gist_id}","starred_url":"https://api.github.com/users/jc91715/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jc91715/subscriptions","organizations_url":"https://api.github.com/users/jc91715/orgs","repos_url":"https://api.github.com/users/jc91715/repos","events_url":"https://api.github.com/users/jc91715/events{/privacy}","received_events_url":"https://api.github.com/users/jc91715/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-19T06:31:02Z","updated_at":"2018-08-08T16:14:50Z","closed_at":null,"author_association":"NONE","body":"Project Model\r\n```\r\n/**\r\n * @SWG\\Definition(\r\n * )\r\n */\r\n\r\nclass Project\r\n{\r\n         /**\r\n     * @SWG\\Property(\r\n     *     description=\"Interacts in the project\",\r\n     *     type=\"array\",\r\n     *     @SWG\\Items(ref=\"#/definitions/Interact\")\r\n     * )\r\n     * @var string\r\n     */\r\n    public $interacts;\r\n}\r\n```\r\nInteract Model\r\n```\r\n/**\r\n * @SWG\\Definition(\r\n * )\r\n */\r\nclass Interact\r\n{\r\n        /**\r\n     * @SWG\\Property(\r\n     *     description=\"Projects in the interact\",\r\n     *     type=\"array\",\r\n     *     @SWG\\Items(ref=\"#/definitions/Project\")\r\n     * )\r\n     * @var string\r\n     */\r\n    public $projects;\r\n}\r\n```\r\n\r\nWhen I get the activities under the project, it gets these.\r\n```\r\n     *                @SWG\\Property(\r\n     *                      property=\"project\",\r\n     *                      type=\"object\",\r\n     *                      ref=\"#/definitions/Project\"\r\n     *                  )\r\n\r\n```\r\n```\r\n{\r\n\r\n    \"project\": {\r\n      \"tittle\": \"string\",\r\n      \"desc\": \"string\",\r\n      \"content\": \"string\",\r\n  \r\n      \"interacts\": [\r\n        {\r\n          \"title\": \"string\",\r\n          \"desc\": \"string\",\r\n          \"type\": \"string\",\r\n          \"link\": \"string\",\r\n          \"projects\": [\r\n            null\r\n          ]\r\n        }\r\n      ]\r\n    }\r\n  \r\n}\r\n```\r\n\r\nIt contains more than one time。\r\n```\r\n          \"projects\": [\r\n            null\r\n          ]\r\n```\r\n\r\nI don't know how I should try to avoid it。Let it contain only one time\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/zircote/swagger-php/issues/comments/411463935","html_url":"https://github.com/zircote/swagger-php/issues/523#issuecomment-411463935","issue_url":"https://api.github.com/repos/zircote/swagger-php/issues/523","id":411463935,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMTQ2MzkzNQ==","user":{"login":"bfanger","id":207248,"node_id":"MDQ6VXNlcjIwNzI0OA==","avatar_url":"https://avatars1.githubusercontent.com/u/207248?v=4","gravatar_id":"","url":"https://api.github.com/users/bfanger","html_url":"https://github.com/bfanger","followers_url":"https://api.github.com/users/bfanger/followers","following_url":"https://api.github.com/users/bfanger/following{/other_user}","gists_url":"https://api.github.com/users/bfanger/gists{/gist_id}","starred_url":"https://api.github.com/users/bfanger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bfanger/subscriptions","organizations_url":"https://api.github.com/users/bfanger/orgs","repos_url":"https://api.github.com/users/bfanger/repos","events_url":"https://api.github.com/users/bfanger/events{/privacy}","received_events_url":"https://api.github.com/users/bfanger/received_events","type":"User","site_admin":false},"created_at":"2018-08-08T16:14:50Z","updated_at":"2018-08-08T16:14:50Z","author_association":"COLLABORATOR","body":"Sadly you can't exclude properties sometimes, you'll need to create 2 definitions per model. one with the nested array and one without.\r\n\r\nYou can reuse the ProductWithoutInteracts annotation inside the ProductWithInteracts by [using the allOf composition](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#composition-and-inheritance-polymorphism)"}}
{"actor":{"display_login":"bfanger"}}