Comments (4)
Hi There!
At this moment the code does not offer support for reference parameters.
Probably I can implemented something in a few weeks. If you have some piece of code would be helpful.
from php-swagger-test.
JSON schema:
openapi: 3.0.0
info:
paths:
'/tests/{test_id}':
get:
parameters:
-
$ref: '#/components/parameters/count'
-
$ref: '#/components/parameters/offset'
responses:
'200':
description: 'Empty response'
content:
application/json:
schema:
description: 'Empty response'
parameters:
-
$ref: '#/components/parameters/test_id'
components:
parameters:
count:
name: count
in: query
required: false
schema:
type: integer
default: 10
maximum: 500
readOnly: true
offset:
name: offset
in: query
required: false
schema:
type: integer
default: 0
readOnly: true
test_id:
name: test_id
in: path
required: true
schema:
type: string
This schema is not valid for Swagger v2.0, i can't test on master branch
PHP code:
<?php
$openApiSchema = file_get_contents('openapi.json');
$this->swaggerSchema = new \ByJG\Swagger\SwaggerSchema($openApiSchema, true);
$bodyResponseDef = $swaggerSchema->getResponseParameters(
$requestURI,
$requestMethod,
$responseStatusCode
);
$this->assertTrue($bodyResponseDef->match(json_decode($responseContent, true)));
Errors:
[PHPUnit\Framework\Exception] Undefined index: parameters
.
trace:
/webroot/vendor/codeception/codeception/src/Codeception/Subscriber/ErrorHandler.php:83
/webroot/vendor/byjg/swagger-test/src/SwaggerSchema.php:103
/webroot/vendor/byjg/swagger-test/src/SwaggerSchema.php:209
/webroot/tests/_support/Helper/Api.php:87
/webroot/vendor/codeception/codeception/src/Codeception/Step.php:265
/webroot/vendor/codeception/codeception/src/Codeception/Scenario.php:72
...
/webroot/vendor/codeception/codeception/codecept:43
- When i resolve references, i have other exception:
[PHPUnit\Framework\Exception] Undefined index: count
.count
is parameter from query
/webroot/vendor/codeception/codeception/src/Codeception/Subscriber/ErrorHandler.php:83
/webroot/vendor/byjg/swagger-test/src/SwaggerSchema.php:123
/webroot/vendor/byjg/swagger-test/src/SwaggerSchema.php:103
/webroot/vendor/byjg/swagger-test/src/SwaggerSchema.php:209
/webroot/tests/_support/Helper/Api.php:87
/webroot/vendor/codeception/codeception/src/Codeception/Step.php:265
/webroot/vendor/codeception/codeception/src/Codeception/Scenario.php:72
...
/webroot/vendor/codeception/codeception/codecept:43
from php-swagger-test.
Hello @JurisU, this definition will not work on master branch because the OpenApi Spec 3.0 still in development on branches oas30
and issue-23
(this issue)
from php-swagger-test.
I commit a version that resolves the issue.
We have the same behavior from the Swagger 2.0 validating only the "path". I would like to know if is interesting to validate parameters in other parts --> "query", "header", "path" or "cookie". (at least "query" should be interesting).
from php-swagger-test.
Related Issues (20)
- issue while consuming json HOT 3
- SwaggerTestCase->assertRequest locked onto specific to that test schema HOT 4
- Variables in servers object HOT 3
- ByJG\ApiTools\Exception\GenericSwaggerException: Not all cases are defined. HOT 10
- Not supported PHPUnit 8.5 HOT 7
- nullable value matching HOT 2
- Typo: getDefintion should be getDefinition HOT 5
- Unable to run successful tests for the repo (PHPStorm 2020.1) HOT 3
- Error matching ResponseBody without 'content' HOT 9
- Library does not support 'oneOf', 'anyOf', 'allOf' and 'not' HOT 24
- Referencing to components in external JSON files is missing HOT 1
- Library as trait(s) instead of inheritance class HOT 3
- Splitting out the request/response validation from the actual request
- Responses using ref aren't supported
- PHP 8 Compatibility HOT 5
- Guidance on setting up basic functional tests
- Add label #hacktoberfest to project HOT 3
- PHP 8.1 deprecation warning HOT 5
- Nullable does not work with 'oneOf'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-swagger-test.