[英]Where to put @SWG\Definition to be reused with Swagger-PHP and Nelmio API-DOC Bundle
我想在某處編寫一個@SWG \\ Definition,並在我的Symfony 3應用程序中的多個REST API動作的@SWG \\ Response批注的@SWG \\ Schema中引用它。 我正在使用Nelmio的api-doc-bundle的dev-master版本,但似乎可以找到暗示該定義應該去哪里的任何內容。 Swagger-PHP文檔敦促盡可能避免重復,我希望遵循該建議。 有什么提示嗎?
典型...最后分解,然后在不久后提出解決方案...
我發現可以將文檔數據預加載到Symfony的app / config / config.yml中。
nelmio_api_doc:
documentation:
definitios:
Error:
type: object
properties:
success:
type: boolean
example: false
error:
type: string
example: message
現在,我可以在所有REST操作中使用類似的內容
/**
* @API\Operation(
* ...
* @SWG\Response(
* response="default",
* description="Failure",
* @SWG\Schema(ref="#definitions/Error")
* )
* )
*/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.