Skip to content

Commit

Permalink
Merge pull request #680 from tienvx/add-semver-generator-example
Browse files Browse the repository at this point in the history
chore: Add semver generator example
  • Loading branch information
tienvx authored Oct 14, 2024
2 parents b72667d + b431e6c commit db10175
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions example/generators/consumer/tests/Service/GeneratorsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public function testGetGenerators(): void
'boolean' => $this->matcher->boolean(null),
'integer' => $this->matcher->integer(null),
'decimal' => $this->matcher->decimal(null),
'semver' => $this->matcher->semver(null),
'requestId' => 222,
]);

Expand Down Expand Up @@ -115,6 +116,7 @@ public function testGetGenerators(): void
$this->assertIsBool($body['boolean']);
$this->assertIsInt($body['integer']);
$this->assertIsFloat($body['decimal'] + 0);
$this->assertMatchesRegularExpression('/\d+\.\d+\.\d+/', $body['semver']);
$this->assertSame(222, $body['requestId']);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"number": null,
"regex": null,
"requestId": 222,
"semver": null,
"string": "some string",
"time": null,
"url": null,
Expand Down Expand Up @@ -134,6 +135,10 @@
"regex": "\\d+ (miles|kilometers)",
"type": "Regex"
},
"$.semver": {
"regex": "\\d+\\.\\d+\\.\\d+",
"type": "Regex"
},
"$.string": {
"size": 10,
"type": "RandomString"
Expand Down Expand Up @@ -282,6 +287,14 @@
}
]
},
"$.semver": {
"combine": "AND",
"matchers": [
{
"match": "semver"
}
]
},
"$.string": {
"combine": "AND",
"matchers": [
Expand Down
1 change: 1 addition & 0 deletions example/generators/provider/public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
'boolean' => false,
'integer' => -99,
'decimal' => -810.22,
'semver' => '1.2.3',
'requestId' => $body['id'],
])
->withStatus(400);
Expand Down

0 comments on commit db10175

Please sign in to comment.