Skip to content

Commit

Permalink
Fix use of "$refs" (#959)
Browse files Browse the repository at this point in the history
Also adds `swagger-cli` as second validator for example specs.
  • Loading branch information
DerManoMann authored Jun 25, 2021
1 parent e9041b7 commit 41ed0eb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 26 deletions.
11 changes: 4 additions & 7 deletions Examples/using-refs/ProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ class ProductController
* path="/products/{product_id}",
* @OA\Response(
* response="default",
* description="successful operation",
* @OA\JsonContent(ref="#/components/responses/product")
* ref="#/components/responses/product"
* )
* )
*/
Expand All @@ -33,8 +32,7 @@ public function getProduct($id)
* @OA\RequestBody(ref="#/components/requestBodies/product_in_body"),
* @OA\Response(
* response="default",
* description="successful operation",
* @OA\JsonContent(ref="#/components/responses/product")
* ref="#/components/responses/product"
* )
* )
*/
Expand All @@ -46,11 +44,10 @@ public function updateProduct($id)
* @OA\Post(
* tags={"Products"},
* path="/products",
* @OA\Parameter(ref="#/components/requestBodies/product_in_body"),
* @OA\RequestBody(ref="#/components/requestBodies/product_in_body"),
* @OA\Response(
* response="default",
* description="successful operation",
* @OA\JsonContent(ref="#/components/responses/product")
* ref="#/components/responses/product"
* )
* )
*/
Expand Down
23 changes: 5 additions & 18 deletions Examples/using-refs/using-refs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@ paths:
operationId: 133f11c148f628647767a323bf78c68d
responses:
default:
description: 'successful operation'
content:
application/json:
schema:
$ref: '#/components/responses/product'
$ref: '#/components/responses/product'
patch:
tags:
- Products
Expand All @@ -23,11 +19,7 @@ paths:
$ref: '#/components/requestBodies/product_in_body'
responses:
default:
description: 'successful operation'
content:
application/json:
schema:
$ref: '#/components/responses/product'
$ref: '#/components/responses/product'
parameters:
-
$ref: '#/components/parameters/product_id_in_path_required'
Expand All @@ -36,16 +28,11 @@ paths:
tags:
- Products
operationId: 779b6345f19f6b865527e6bd67819d2d
parameters:
-
$ref: '#/components/requestBodies/product_in_body'
requestBody:
$ref: '#/components/requestBodies/product_in_body'
responses:
default:
description: 'successful operation'
content:
application/json:
schema:
$ref: '#/components/responses/product'
$ref: '#/components/responses/product'
components:
schemas:
Product:
Expand Down
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@
"@phpstan",
"@psalm"
],
"validate-examples": "for ff in `find Examples -name *.yaml`; do spectral lint $ff; done",
"validate-examples": {
"spectral": "for ff in `find Examples -name *.yaml`; do spectral lint $ff; done",
"swagger-cli": "for ff in `find Examples -name *.yaml`; do swagger-cli validate $ff; done"
},
"docs": "./docs/node_modules/.bin/vuepress dev docs/",
"deploy_docs": "./docs/node_modules/.bin/vuepress build docs/ && cp -r .git docs/.vuepress/dist/.git && cd docs/.vuepress/dist/ && git symbolic-ref HEAD refs/heads/gh-pages && git add --all"
}
Expand Down

0 comments on commit 41ed0eb

Please sign in to comment.