Skip to content

Commit 2029ffb

Browse files
authored
Merge pull request #80 from byjg/4.9
4.9
2 parents 0fee120 + 56d6651 commit 2029ffb

File tree

4 files changed

+49
-0
lines changed

4 files changed

+49
-0
lines changed

.github/FUNDING.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# These are supported funding model platforms
2+
3+
github: byjg

CONTRIBUTING.md

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Contributing to byjg/php-swagger-test
2+
3+
First of all, thank you for taking the time to contribute!
4+
5+
## How to Contribute
6+
7+
### Issues
8+
9+
If you encounter any issues, have questions, or need clarification, please open an issue on our [Issues page](https://github.com/your-repo/issues). This helps us track and prioritize bug fixes and enhancements.
10+
11+
### Branches
12+
13+
We have three main branches in this project:
14+
15+
- **master**: Contains the latest code. It is generally stable, but we recommend using it with caution.
16+
- **a.b**: Use this branch for creating PRs. The naming convention follows `a.b`, where `a` is the major release and `b` is the minor release of the current version. For example, if the current release is 4.9.2, use the branch `4.9` for your PR. You can also use `4.9.x-dev` in your composer for development purposes.
17+
- **future release**: This branch is typically `(a+1).0`. For instance, if the current release is 4.9.2, the future release branch will be `5.0`.
18+
19+
20+
### Code Style and Guidelines
21+
22+
- **Follow PSR Standards**: We follow [PSR-1](https://www.php-fig.org/psr/psr-1/), [PSR-2](https://www.php-fig.org/psr/psr-2/), and [PSR-12](https://www.php-fig.org/psr/psr-12/).
23+
- **Write Clear Commit Messages**: Use the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification.
24+
- **Documentation**: Update the documentation for any new features or changes.
25+
26+
### Common Practices
27+
28+
- **Keep Pull Requests Small**: Smaller PRs are easier to review and merge. Focus on one feature or fix per PR.
29+
- **Write Tests**: Ensure your changes are covered by tests. We aim for a high level of test coverage.
30+
- **Respect Reviewers' Time**: Be responsive to feedback and willing to make necessary changes.
31+
32+
### Community
33+
34+
- **Be Respectful**.
35+
- **Collaborate**: We encourage collaboration and open discussion. Don’t hesitate to ask for help or provide feedback.
36+
37+
Thank you for contributing to byjg/php-swagger-test! Your help is appreciated and makes a big difference.

src/Base/Body.php

+5
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,11 @@ protected function matchSchema($name, $schemaArray, $body)
414414
return true;
415415
}
416416

417+
// Match any object
418+
if (count($schemaArray) === 1 && isset($schemaArray['type']) && $schemaArray['type'] === 'object') {
419+
return true;
420+
}
421+
417422
throw new GenericSwaggerException("Not all cases are defined. Please open an issue about this. Schema: $name");
418423
}
419424

src/Base/Schema.php

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use ByJG\ApiTools\Exception\GenericSwaggerException;
77
use ByJG\ApiTools\Exception\HttpMethodNotFoundException;
88
use ByJG\ApiTools\Exception\InvalidDefinitionException;
9+
use ByJG\ApiTools\Exception\InvalidRequestException;
910
use ByJG\ApiTools\Exception\NotMatchedException;
1011
use ByJG\ApiTools\Exception\PathNotFoundException;
1112
use ByJG\ApiTools\OpenApi\OpenApiSchema;
@@ -98,6 +99,9 @@ public function getPathDefinition($path, $method)
9899
$pathItemPattern = '~^' . preg_replace('~{(.*?)}~', '(?<\1>[^/]+)', $pathItem) . '$~';
99100

100101
$matches = [];
102+
if (empty($uri->getPath())) {
103+
throw new InvalidRequestException('The path is empty');
104+
}
101105
if (preg_match($pathItemPattern, $uri->getPath(), $matches)) {
102106
$pathDef = $this->jsonFile[self::SWAGGER_PATHS][$pathItem];
103107
if (!isset($pathDef[$method])) {

0 commit comments

Comments
 (0)