This repository has been archived by the owner on Jan 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update README, add JSON Swagger def tests
- Loading branch information
Showing
3 changed files
with
203 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
/* | ||
* This file is part of the KleijnWeb\SwaggerBundle package. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace KleijnWeb\SwaggerBundle\Tests\Functional; | ||
|
||
use KleijnWeb\SwaggerBundle\Test\ApiTestCase; | ||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; | ||
|
||
/** | ||
* @author John Kleijn <john@kleijnweb.nl> | ||
*/ | ||
class JsonDataApiTest extends WebTestCase | ||
{ | ||
use ApiTestCase; | ||
|
||
/** | ||
* Use config_basic.yml | ||
* | ||
* @var bool | ||
*/ | ||
protected $env = 'basic'; | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function canInitSchemaManager() | ||
{ | ||
static::initSchemaManager(__DIR__ . '/PetStore/app/swagger/data.json'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
{ | ||
"swagger": "2.0", | ||
"info": { | ||
"description": "Data api", | ||
"version": "1.0.0" | ||
}, | ||
"basePath": "/data/v1", | ||
"paths": { | ||
"/entity/{type}": { | ||
"get": { | ||
"operationId": "find", | ||
"parameters": [ | ||
{ | ||
"in": "query", | ||
"name": "lastModified", | ||
"required": true, | ||
"type": "string", | ||
"format": "date-time" | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "Found resources", | ||
"schema": { | ||
"type": "array", | ||
"items": { | ||
"type": "object" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"post": { | ||
"parameters": [ | ||
{ | ||
"in": "body", | ||
"name": "data", | ||
"required": true, | ||
"schema": { | ||
"type": "object" | ||
} | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "The created resource", | ||
"schema": { | ||
"type": "object" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"/entity/{type}/findByCriteria": { | ||
"post": { | ||
"operationId": "findByCriteria", | ||
"parameters": [ | ||
{ | ||
"in": "body", | ||
"name": "criteria", | ||
"required": true, | ||
"schema": { | ||
"$ref": "#/definitions/Criteria" | ||
} | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "Found resources", | ||
"schema": { | ||
"type": "array", | ||
"items": { | ||
"type": "object" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"/entity/{type}/{id}": { | ||
"put": { | ||
"parameters": [ | ||
{ | ||
"in": "path", | ||
"name": "id", | ||
"required": true, | ||
"type": "integer" | ||
}, | ||
{ | ||
"in": "body", | ||
"name": "data", | ||
"required": true, | ||
"schema": { | ||
"type": "object" | ||
} | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "The modified resource", | ||
"schema": { | ||
"type": "object" | ||
} | ||
} | ||
} | ||
}, | ||
"delete": { | ||
"parameters": [ | ||
{ | ||
"in": "path", | ||
"name": "id", | ||
"required": true, | ||
"type": "integer" | ||
} | ||
], | ||
"responses": { | ||
"204": { | ||
"description": "Empty response", | ||
"schema": { | ||
"type": null | ||
} | ||
} | ||
} | ||
}, | ||
"get": { | ||
"parameters": [ | ||
{ | ||
"in": "path", | ||
"name": "id", | ||
"required": true, | ||
"type": "integer" | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "The requested resource", | ||
"schema": { | ||
"type": "object" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"definitions": { | ||
"Criteria": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/FieldCriteria" | ||
} | ||
}, | ||
"FieldCriteria": { | ||
"properties": { | ||
"fieldName": { | ||
"type": "string" | ||
}, | ||
"operator": { | ||
"type": "string" | ||
}, | ||
"value": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} | ||
} |