Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
743 commits
Select commit Hold shift + click to select a range
74117f4
test: align request tab signer ordering
vitormattos Mar 13, 2026
2a2516d
test: align sign tab document types
vitormattos Mar 13, 2026
1f3471c
test: align signers list with local keys
vitormattos Mar 13, 2026
53a8514
test: cover local signer keys in files store
vitormattos Mar 13, 2026
9ac2c63
refactor: reshape shared frontend api aliases
vitormattos Mar 13, 2026
c20d4ca
refactor: split files store public and draft state
vitormattos Mar 13, 2026
3f43015
refactor: narrow sign store document contract
vitormattos Mar 13, 2026
f0ae37b
refactor: define visible elements frontend models
vitormattos Mar 13, 2026
710f11d
test: align validation view contract fixtures
vitormattos Mar 13, 2026
fc07f59
refactor: simplify document validation props
vitormattos Mar 13, 2026
0c5707f
refactor: simplify envelope validation props
vitormattos Mar 13, 2026
663952c
refactor: replace signer details composite model
vitormattos Mar 13, 2026
4265bda
refactor: simplify validation signers list model
vitormattos Mar 13, 2026
8221cd8
refactor: align request signature tab with draft store
vitormattos Mar 13, 2026
31bc05d
refactor: normalize visible elements document input
vitormattos Mar 13, 2026
966c8fc
refactor: align pdf editor signer contract
vitormattos Mar 13, 2026
171f1f3
refactor: derive sign partial document contract
vitormattos Mar 13, 2026
e0bd618
refactor: tighten sign pdf document aliases
vitormattos Mar 13, 2026
c0d89c9
test: align sign pdf view fixtures
vitormattos Mar 13, 2026
40128d9
refactor: derive sign tab document type from store
vitormattos Mar 13, 2026
435f3a0
test: align sign tab fixtures with store contract
vitormattos Mar 13, 2026
36c8d26
refactor: derive signer row type from selected file
vitormattos Mar 13, 2026
fbaeb5d
refactor: derive signers list types from store
vitormattos Mar 13, 2026
587b14e
test: align signers component store mocks
vitormattos Mar 13, 2026
be44ccc
refactor: derive file card state from files store
vitormattos Mar 13, 2026
27e8f17
refactor: reuse signer detail record in signer row
vitormattos Mar 13, 2026
a4c57d6
refactor: simplify app files tab envelope types
vitormattos Mar 13, 2026
fdfc133
refactor: simplify signing order diagram signer types
vitormattos Mar 13, 2026
128167c
refactor: reuse file entry source in file actions
vitormattos Mar 13, 2026
1b6d9af
refactor: normalize visible elements input contracts
vitormattos Mar 14, 2026
176d8cb
refactor: normalize sign view document boundary
vitormattos Mar 14, 2026
3f8156d
refactor: normalize sign pdf document inputs
vitormattos Mar 14, 2026
75680d9
refactor: add loaded validation document aliases
vitormattos Mar 14, 2026
1214b90
refactor: split validation document branches
vitormattos Mar 14, 2026
dfd5ed9
refactor: tighten file validation document contract
vitormattos Mar 14, 2026
89a82ab
refactor: tighten envelope validation document contract
vitormattos Mar 14, 2026
af747cd
test: align file validation spec with loaded document type
vitormattos Mar 14, 2026
f4eb581
test: align envelope validation spec with loaded document type
vitormattos Mar 14, 2026
2f8660b
refactor: separate raw and normalized sign pdf files
vitormattos Mar 14, 2026
a896266
fix: guard file status class rendering
vitormattos Mar 14, 2026
cdeb162
refactor: normalize selected file status in file card
vitormattos Mar 14, 2026
f481da3
test: cover file card status rendering
vitormattos Mar 14, 2026
21afaf0
fix: narrow file card status typing
vitormattos Mar 14, 2026
5d70b20
refactor: add file status aliases
vitormattos Mar 14, 2026
92950c6
fix: tighten file store status typing
vitormattos Mar 14, 2026
60f9c95
refactor: use shared file status aliases
vitormattos Mar 14, 2026
84697cf
test: align visible elements file status contract
vitormattos Mar 14, 2026
2aeceab
refactor: add selected file view type
vitormattos Mar 14, 2026
e5ecbc5
refactor: add selected file view getter
vitormattos Mar 14, 2026
2beff32
refactor: use selected file view in file card
vitormattos Mar 14, 2026
f770a58
test: mock selected file view in file card
vitormattos Mar 14, 2026
77f45d8
test: cover selected file view getter
vitormattos Mar 14, 2026
c449904
refactor: use selected file view in sidebar
vitormattos Mar 14, 2026
ff2c06e
test: mock selected file view in sidebar
vitormattos Mar 14, 2026
da0e5fa
refactor: use selected file view for request title
vitormattos Mar 14, 2026
bb0ce3d
refactor: use selected file view in app files tab
vitormattos Mar 14, 2026
da28cc0
test: mock selected file view in app files tab
vitormattos Mar 14, 2026
e7a0c9c
refactor: widen validation details signer input
vitormattos Mar 14, 2026
507a068
refactor: keep envelope validation ui state local
vitormattos Mar 14, 2026
d2f2dfe
test: cover envelope validation local ui state
vitormattos Mar 14, 2026
9c012c3
refactor: align validation view with openapi records
vitormattos Mar 14, 2026
f33a565
refactor: remove validation view model aliases
vitormattos Mar 14, 2026
a672175
refactor: define pdf editor public types
vitormattos Mar 14, 2026
1f34b1e
refactor: extract pdf editor model helpers
vitormattos Mar 14, 2026
c7036a4
refactor: align signer menu with pdf editor types
vitormattos Mar 14, 2026
525763c
refactor: align signature box with pdf editor types
vitormattos Mar 14, 2026
2b83698
refactor: isolate pdf editor orchestration
vitormattos Mar 14, 2026
1142736
refactor: reuse pdf editor public api in visible elements
vitormattos Mar 14, 2026
219a5f3
refactor: reuse pdf editor public api in sign pdf
vitormattos Mar 14, 2026
232d91c
test: cover pdf editor model helpers
vitormattos Mar 14, 2026
eb0b2ec
refactor: remove standalone pdf editor types file
vitormattos Mar 14, 2026
80c4a6f
refactor: colocate pdf editor model types
vitormattos Mar 14, 2026
cae33a2
refactor: import signer menu model locally
vitormattos Mar 14, 2026
e4baa95
refactor: import signature box model locally
vitormattos Mar 14, 2026
ed637ac
refactor: keep pdf editor types local
vitormattos Mar 14, 2026
cfd574b
refactor: keep visible elements pdf editor api local
vitormattos Mar 14, 2026
8de0b1e
refactor: keep sign pdf editor api local
vitormattos Mar 14, 2026
40464fe
refactor: align pdf editor model with openapi contracts
vitormattos Mar 14, 2026
35d63f4
refactor: make pdf editor placement api use visible element records
vitormattos Mar 14, 2026
d79c772
refactor: align signer menu with editor signer record
vitormattos Mar 14, 2026
cb6a847
refactor: align signature box with editor signer record
vitormattos Mar 14, 2026
7c748e9
refactor: adapt visible elements to editor openapi contract
vitormattos Mar 14, 2026
1552faf
refactor: pass visible element records to sign pdf editor
vitormattos Mar 14, 2026
2457e26
test: cover openapi-based pdf editor model
vitormattos Mar 14, 2026
b8c765f
test: align pdf editor spec with visible element contract
vitormattos Mar 14, 2026
0fd9334
refactor: use openapi signer records in pdf editor model
vitormattos Mar 14, 2026
8805dff
refactor: use openapi signer records in pdf editor
vitormattos Mar 14, 2026
b9a4866
refactor: use openapi signer records in signer menu
vitormattos Mar 14, 2026
ea71e9b
refactor: use openapi signer records in signature box
vitormattos Mar 14, 2026
9214b46
refactor: normalize visible elements signers to openapi summary
vitormattos Mar 14, 2026
10ee287
refactor: normalize sign pdf signers to openapi summary
vitormattos Mar 14, 2026
e7120f8
refactor: internalize visible elements service types
vitormattos Mar 14, 2026
2f8d1fa
refactor: align request visible elements with service contract
vitormattos Mar 14, 2026
f77a901
refactor: align sign pdf visible elements contract
vitormattos Mar 14, 2026
96c583d
refactor: align sign partial visible elements contract
vitormattos Mar 14, 2026
0eed71f
test: cover sign pdf visible elements normalization
vitormattos Mar 14, 2026
a82e684
test: cover sign visible elements normalization
vitormattos Mar 14, 2026
ef369be
refactor: relax visible elements service input boundary
vitormattos Mar 14, 2026
b1adef4
refactor: accept service signer boundary in visible elements
vitormattos Mar 14, 2026
4a3c88e
refactor: align sign pdf types with visible elements boundary
vitormattos Mar 14, 2026
a0ed1b7
test: align signature box signer fixture
vitormattos Mar 14, 2026
1a105cc
test: align signer menu fixtures
vitormattos Mar 14, 2026
1d02bfe
test: align pdf editor model signer fixtures
vitormattos Mar 14, 2026
aa1539d
fix: import request visible elements modal components
vitormattos Mar 14, 2026
d22950c
fix: avoid id doc approval on signer flow
vitormattos Mar 14, 2026
6093742
test: cover signer flow sign url selection
vitormattos Mar 14, 2026
7e94d1c
fix: preserve sign page config state
vitormattos Mar 14, 2026
c20f3bf
fix: initialize signature file state once
vitormattos Mar 14, 2026
3f13035
fix: preserve manage password signature state
vitormattos Mar 14, 2026
fbb8846
test: cover manage password signature init
vitormattos Mar 14, 2026
8b1fb4e
test: cover idempotent signature file init
vitormattos Mar 14, 2026
9cf8c99
test: cover forgot password certificate actions
vitormattos Mar 14, 2026
78739fb
refactor: use signer detail contract in signer row
vitormattos Mar 14, 2026
b4131a7
test: align signer row fixture with signer detail
vitormattos Mar 14, 2026
3de39fd
fix: simplify identify signer state
vitormattos Mar 15, 2026
9fd23ed
refactor: remove dead signer select state
vitormattos Mar 15, 2026
f6554e6
test: cover identify signer state reset
vitormattos Mar 15, 2026
76e2b89
test: cover blank signer search reset
vitormattos Mar 15, 2026
6c18840
fix: drop legacy signer edit fallback
vitormattos Mar 15, 2026
a0b8dd6
fix: type visible element ids as numbers
vitormattos Mar 15, 2026
beb17d8
refactor: narrow pending envelope signer ids
vitormattos Mar 15, 2026
a2821f3
fix: stop forwarding legacy signer ids
vitormattos Mar 15, 2026
622c2ab
refactor: require numeric signing ids
vitormattos Mar 15, 2026
a5cf346
refactor: narrow visible element signer ids
vitormattos Mar 15, 2026
7024e16
refactor: align files store signer ids
vitormattos Mar 15, 2026
2f1af01
refactor: align sign store visible element ids
vitormattos Mar 15, 2026
05cf971
refactor: narrow sign pdf visible element ids
vitormattos Mar 15, 2026
d0cb4a3
refactor: compare sign request ids numerically
vitormattos Mar 15, 2026
2d52ace
test: align pdf editor numeric ids
vitormattos Mar 15, 2026
0b8f32f
test: cover identify signer without legacy id
vitormattos Mar 15, 2026
4eb8219
test: align visible elements numeric ids
vitormattos Mar 15, 2026
a866cd4
test: cover request signature numeric signer ids
vitormattos Mar 15, 2026
c106663
test: align sign view numeric ids
vitormattos Mar 15, 2026
7f598e0
test: align sign pdf numeric ids
vitormattos Mar 15, 2026
359ca7e
refactor: export visible elements boundary types
vitormattos Mar 15, 2026
7823001
refactor: reuse openapi visible element types
vitormattos Mar 15, 2026
eef2d40
refactor: require detailed file sizes in response definitions
vitormattos Mar 15, 2026
8bf5605
fix: default envelope validation size
vitormattos Mar 15, 2026
e091bea
feat: include detailed file sizes in file list service
vitormattos Mar 15, 2026
345ec88
fix: default validation metadata size
vitormattos Mar 15, 2026
714329b
chore: regenerate full openapi schema
vitormattos Mar 15, 2026
b027b69
chore: regenerate openapi schema
vitormattos Mar 15, 2026
3a764ea
feat: request detailed sizes in file status list
vitormattos Mar 15, 2026
c076b9b
refactor: require envelope file size
vitormattos Mar 15, 2026
5fe0d78
refactor: use openapi validation document types
vitormattos Mar 15, 2026
c6cfe8d
refactor: require validation file sizes
vitormattos Mar 15, 2026
17bcd51
refactor: use openapi validation file type
vitormattos Mar 15, 2026
76d2a3e
test: cover detailed file sizes in file status list
vitormattos Mar 15, 2026
f0acae6
test: align validation details with openapi types
vitormattos Mar 15, 2026
ecbbd1f
test: require validation file sizes
vitormattos Mar 15, 2026
5886453
test: use openapi validation file fixtures
vitormattos Mar 15, 2026
f1feed2
chore: regenerate full openapi types
vitormattos Mar 15, 2026
0fb3431
chore: regenerate openapi types
vitormattos Mar 15, 2026
8687e03
test: cover detailed file sizes in file list service
vitormattos Mar 15, 2026
70032a8
build: use composer patches in phpunit bin
vitormattos Mar 15, 2026
fd9ea2d
build: add phpunit bin patch definitions
vitormattos Mar 15, 2026
44aba78
chore: update phpunit bin composer lock
vitormattos Mar 15, 2026
8630507
fix: normalize file list size type
vitormattos Mar 15, 2026
2c07d66
refactor: require file entry status fields
vitormattos Mar 15, 2026
3f38de6
refactor: remove file entry status fallbacks
vitormattos Mar 15, 2026
17fb688
refactor: remove file entry grid status fallbacks
vitormattos Mar 15, 2026
7a88044
feat(utils): add sign request status text helper
vitormattos Mar 15, 2026
be189ae
refactor(request): initialize draft signer status
vitormattos Mar 15, 2026
ffec61a
refactor(sidebar): update local signer request status
vitormattos Mar 15, 2026
d750384
refactor(store): require signer status text
vitormattos Mar 15, 2026
270193a
refactor(sign): remove placeholder document state
vitormattos Mar 15, 2026
bede519
refactor(sidebar): gate sign tab by document
vitormattos Mar 15, 2026
69d0eab
refactor(sign): rely on sign document contract
vitormattos Mar 15, 2026
c71262b
refactor(signers): pass signer as contract
vitormattos Mar 15, 2026
3dace36
refactor(signers): forward signer objects
vitormattos Mar 15, 2026
38a6840
refactor(request): forward signer object
vitormattos Mar 15, 2026
17ec672
test(request): cover draft signer status
vitormattos Mar 15, 2026
04c41b2
test(sidebar): require document for sign tab
vitormattos Mar 15, 2026
bab1d19
test(sign): cover document status contract
vitormattos Mar 15, 2026
e354a64
test(signers): cover signer status contract
vitormattos Mar 15, 2026
e29dc55
test(store): require signer status text
vitormattos Mar 15, 2026
8281084
test(sign): clear document on reset
vitormattos Mar 15, 2026
ad10fc6
refactor(validation): require numeric file status
vitormattos Mar 15, 2026
40eb120
test(validation): require numeric file status
vitormattos Mar 15, 2026
b8a8d61
refactor(validation): use validation file contract
vitormattos Mar 15, 2026
3507322
test(validation): cover validation file contract
vitormattos Mar 15, 2026
6ec52bd
chore(licensing): annotate vendor-bin patches metadata
vitormattos Mar 15, 2026
dd53edd
fix: relax signer status text in signer item
vitormattos Mar 15, 2026
198778d
fix: allow partial signer state in files store
vitormattos Mar 15, 2026
024f11f
test: complete file entry action fixture status
vitormattos Mar 15, 2026
07d342f
test: cover identify method token signing
vitormattos Mar 15, 2026
71f6f68
fix: guard sign request uuid before document load
vitormattos Mar 15, 2026
4d4369b
test: speed up request signature tab setup
vitormattos Mar 15, 2026
6437208
refactor: align request signing progress with OpenAPI payload
vitormattos Mar 16, 2026
0418b03
refactor: pass signing progress payload directly
vitormattos Mar 16, 2026
17ae929
refactor: align validation signing progress with OpenAPI
vitormattos Mar 16, 2026
20b3229
test: cover request signing progress OpenAPI payload
vitormattos Mar 16, 2026
beb698b
test: cover validation signing progress OpenAPI payload
vitormattos Mar 16, 2026
2804783
refactor: rename shared draft type aliases
vitormattos Mar 16, 2026
9a4a102
refactor: clarify files store draft boundaries
vitormattos Mar 16, 2026
757edc3
refactor: use explicit app files settings draft
vitormattos Mar 16, 2026
c38be75
refactor: use explicit visible elements draft types
vitormattos Mar 16, 2026
5d31ac0
refactor: add signing document adapter
vitormattos Mar 16, 2026
9516d1c
test: cover signing document adapter
vitormattos Mar 16, 2026
981353b
refactor: use signing document adapter in sign pdf
vitormattos Mar 16, 2026
d3ae0f9
refactor: use signing document adapter in sign view
vitormattos Mar 16, 2026
cc57dc4
refactor: require identify methods in signer schema
vitormattos Mar 16, 2026
9e7c461
refactor: document canonical identify methods payload
vitormattos Mar 16, 2026
a16fed2
refactor: normalize request signers by identify methods
vitormattos Mar 16, 2026
a49a2d7
refactor: read identify methods in identify service
vitormattos Mar 16, 2026
4270e94
refactor: remove legacy identify handling in request service
vitormattos Mar 16, 2026
86f21a5
refactor: drop legacy signer identify alias
vitormattos Mar 16, 2026
139d13d
fix: keep numeric selection ids in files store
vitormattos Mar 16, 2026
7a043ca
refactor: edit signers through identify methods
vitormattos Mar 16, 2026
d11364d
refactor: match signers by identify methods
vitormattos Mar 16, 2026
0155a12
refactor: edit request signers with canonical ids
vitormattos Mar 16, 2026
842d4e6
fix: align file view with numeric selected id
vitormattos Mar 16, 2026
102a5f0
fix: type request selection as numeric file id
vitormattos Mar 16, 2026
fbde273
fix: use numeric temporary envelope ids
vitormattos Mar 16, 2026
2ea115f
refactor: align signing document adapter types
vitormattos Mar 16, 2026
be378a6
chore: regenerate openapi request signature schema
vitormattos Mar 16, 2026
677417d
chore: regenerate full openapi request signature schema
vitormattos Mar 16, 2026
e807d64
chore: regenerate openapi types
vitormattos Mar 16, 2026
0d356ac
chore: regenerate full openapi types
vitormattos Mar 16, 2026
99fe85a
test: cover canonical signer normalization
vitormattos Mar 16, 2026
b1f33cc
test: cover identify method entity hydration
vitormattos Mar 16, 2026
baa2fda
test: cover identify methods request behavior
vitormattos Mar 16, 2026
4409d9a
test: align docmdp validator signer payloads
vitormattos Mar 16, 2026
80baa5f
test: align environment controller signer payloads
vitormattos Mar 16, 2026
a0e1cb0
test: align request signature api payloads
vitormattos Mar 16, 2026
fa99f65
test: align file api signer payloads
vitormattos Mar 16, 2026
9c6d0b5
test: align file element api signer payloads
vitormattos Mar 16, 2026
092e00b
test: align notify api signer payloads
vitormattos Mar 16, 2026
bd78c42
test: align sign file api signer payloads
vitormattos Mar 16, 2026
c063625
test: align identify signer component spec
vitormattos Mar 16, 2026
31177e0
test: align visible elements component spec
vitormattos Mar 16, 2026
2545e82
test: align request signature tab spec
vitormattos Mar 16, 2026
35b8d77
test: cover numeric temp ids in files store
vitormattos Mar 16, 2026
aca76be
test: cover numeric temp ids in open action
vitormattos Mar 16, 2026
82958b8
test: align signing document adapter spec
vitormattos Mar 16, 2026
19a0a92
fix: narrow openapi workflow diff check
vitormattos Mar 16, 2026
ae8cba2
test: migrate create-to-sign feature to identifyMethods
vitormattos Mar 16, 2026
a7faed8
test: migrate account signature feature to identifyMethods
vitormattos Mar 16, 2026
fa7012f
test: migrate file list feature to identifyMethods
vitormattos Mar 16, 2026
21b716c
test: migrate file validate feature to identifyMethods
vitormattos Mar 16, 2026
d910718
test: migrate webdav properties feature to identifyMethods
vitormattos Mar 16, 2026
e51ef07
test: migrate custom message notification feature to identifyMethods
vitormattos Mar 16, 2026
944c19b
test: migrate sign identify account feature to identifyMethods
vitormattos Mar 16, 2026
3506135
test: migrate page validate feature to identifyMethods
vitormattos Mar 16, 2026
c9dd85a
test: migrate sign cancel feature to identifyMethods
vitormattos Mar 16, 2026
8e865ea
test: migrate sign request feature to identifyMethods
vitormattos Mar 16, 2026
45630e8
test: migrate sequential signing feature to identifyMethods
vitormattos Mar 16, 2026
bd99cfc
test: migrate signed feature to identifyMethods
vitormattos Mar 16, 2026
0177da2
test: migrate tsa feature to identifyMethods
vitormattos Mar 16, 2026
ad3d2e2
fix: typing compatible with Nextcloud 32
vitormattos Mar 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,10 @@ jobs:

- name: Check openapi*.json and typescript changes
run: |
bash -c "[[ ! \"`git status --porcelain `\" ]] || (echo 'Please run \"composer run openapi\" and commit the openapi*.json files and (if applicable) src/types/openapi/openapi*.ts, see the section \"Show changes on failure\" for details' && exit 1)"
git diff --quiet -- openapi*.json src/types/openapi/openapi*.ts || (echo 'Please run "composer run openapi" and commit the openapi*.json files and (if applicable) src/types/openapi/openapi*.ts, see the section "Show changes on failure" for details' && exit 1)

- name: Show changes on failure
if: failure()
run: |
git status
git --no-pager diff
git --no-pager diff -- openapi*.json src/types/openapi/openapi*.ts
exit 1 # make it red to grab attention
132 changes: 132 additions & 0 deletions .patches/byjg-swagger-test-php84-implicit-nullable.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
--- a/src/AbstractRequester.php
+++ b/src/AbstractRequester.php
@@ -126,7 +126,7 @@ abstract class AbstractRequester
/**
* @param array|null $query
* @return $this
*/
- public function withQuery(array $query = null): self
+ public function withQuery(?array $query = null): self
{
$uri = $this->psr7Request->getUri();

--- a/src/ApiTestCase.php
+++ b/src/ApiTestCase.php
@@ -80,8 +80,8 @@ abstract class ApiTestCase extends TestCase
string $method,
string $path,
int $statusExpected = 200,
string|array|null $query = null,
- array|string $requestBody = null,
+ array|string|null $requestBody = null,
array $requestHeader = []
): ResponseInterface {
$this->checkSchema();
@@ -137,8 +137,8 @@ abstract class ApiTestCase extends TestCase

return $body;
}

- public function assertRequestException(AbstractRequester $request, string $exceptionClass, string $exceptionMessage = null, bool $matchQueryParams = true): Throwable
+ public function assertRequestException(AbstractRequester $request, string $exceptionClass, ?string $exceptionMessage = null, bool $matchQueryParams = true): Throwable
{
try {
$this->assertRequest($request, $matchQueryParams);
--- a/src/Exception/BaseException.php
+++ b/src/Exception/BaseException.php
@@ -9,7 +9,7 @@ class BaseException extends Exception
{
protected mixed $body;

- public function __construct($message = "", $body = [], $code = 0, Throwable $previous = null)
+ public function __construct($message = "", $body = [], $code = 0, ?Throwable $previous = null)
{
$this->body = $body;
if (!empty($body)) {

--- a/src/Base/Body.php
+++ b/src/Base/Body.php
@@ -328,6 +328,50 @@
return true;
}

+ protected function mergeAllOfSchemas(array $schemas): array
+ {
+ $mergedSchema = [];
+
+ foreach ($schemas as $schema) {
+ if (isset($schema['$ref'])) {
+ $schema = $this->schema->getDefinition($schema['$ref']);
+ }
+
+ $mergedSchema = $this->mergeSchemaDefinitions($mergedSchema, $schema);
+ }
+
+ return $mergedSchema;
+ }
+
+ protected function mergeSchemaDefinitions(array $base, array $append): array
+ {
+ foreach ($append as $key => $value) {
+ if (!array_key_exists($key, $base)) {
+ $base[$key] = $value;
+ continue;
+ }
+
+ if (($key === self::SWAGGER_REQUIRED || $key === 'enum') && is_array($base[$key]) && is_array($value)) {
+ $base[$key] = array_values(array_unique(array_merge($base[$key], $value), SORT_REGULAR));
+ continue;
+ }
+
+ if (is_array($base[$key]) && is_array($value) && $this->isAssociativeArray($base[$key]) && $this->isAssociativeArray($value)) {
+ $base[$key] = $this->mergeSchemaDefinitions($base[$key], $value);
+ continue;
+ }
+
+ $base[$key] = $value;
+ }
+
+ return $base;
+ }
+
+ protected function isAssociativeArray(array $value): bool
+ {
+ return array_keys($value) !== range(0, count($value) - 1);
+ }
+
/**
* @param string $name
* @param array $schemaArray
@@ -362,27 +406,21 @@
}

if (isset($schemaArray['allOf'])) {
- $allOfSchemas = $schemaArray['allOf'];
- foreach ($allOfSchemas as &$schema) {
- if (isset($schema['$ref'])) {
- $schema = $this->schema->getDefinition($schema['$ref']);
- }
- }
- unset($schema);
- $mergedSchema = array_merge_recursive(...$allOfSchemas);
- return $this->matchSchema($name, $mergedSchema, $body);
+ return $this->matchSchema($name, $this->mergeAllOfSchemas($schemaArray['allOf']), $body);
}

- if (isset($schemaArray['oneOf'])) {
+ if (isset($schemaArray['oneOf']) || isset($schemaArray['anyOf'])) {
+ $schemas = $schemaArray['oneOf'] ?? $schemaArray['anyOf'];
$matched = false;
$catchException = null;
- foreach ($schemaArray['oneOf'] as $schema) {
+ foreach ($schemas as $schema) {
try {
$matched = $matched || $this->matchSchema($name, $schema, $body);
} catch (NotMatchedException $exception) {
$catchException = $exception;
}
}
+
if ($catchException !== null && $matched === false) {
throw $catchException;
}
1 change: 1 addition & 0 deletions REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ path = [
"tests/integration/features/**/*.feature",
"tests/psalm-baseline.xml",
"tsconfig.json",
"vendor-bin/**/patches.json",
"vendor-bin/**/composer.json",
"vendor-bin/**/composer.lock"
]
Expand Down
49 changes: 26 additions & 23 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions jsconfig.json

This file was deleted.

Loading
Loading