File tree Expand file tree Collapse file tree 8 files changed +96
-15
lines changed
Expand file tree Collapse file tree 8 files changed +96
-15
lines changed Original file line number Diff line number Diff line change 10141014 }
10151015 }
10161016
1017- $ usedRefs = array_merge (...$ usedRefs );
1018-
10191017 $ scopedSchemas = [];
1018+ foreach (['Capabilities ' , 'PublicCapabilities ' ] as $ class ) {
1019+ if (isset ($ schemas [$ class ])) {
1020+ $ scopedSchemas [$ class ] = $ schemas [$ class ];
1021+ $ usedRefs [] = Helpers::collectUsedRefs ($ schemas [$ class ]);
1022+ }
1023+ }
1024+
1025+ $ usedRefs = array_merge (...$ usedRefs );
10201026 while ($ usedRef = array_shift ($ usedRefs )) {
10211027 if (!str_starts_with ((string )$ usedRef , '#/components/schemas/ ' )) {
10221028 continue ;
10391045 $ usedSchemas [] = $ schemaName ;
10401046 }
10411047
1042- if (isset ($ schemas ['Capabilities ' ])) {
1043- $ scopedSchemas ['Capabilities ' ] = $ schemas ['Capabilities ' ];
1044- }
1045- if (isset ($ schemas ['PublicCapabilities ' ])) {
1046- $ scopedSchemas ['PublicCapabilities ' ] = $ schemas ['PublicCapabilities ' ];
1047- }
1048-
10491048 if ($ scopedSchemas === []) {
10501049 $ scopedSchemas = new stdClass ();
10511050 } else {
Original file line number Diff line number Diff line change 1111
1212use OCP \Capabilities \ICapability ;
1313
14+ /**
15+ * @psalm-import-type NotificationsSchemaOnlyInCapabilities from ResponseDefinitions
16+ */
1417class Capabilities implements ICapability {
1518 /**
16- * @return array{test: array{a: int}}
19+ * @return array{test: array{a: int, b: NotificationsSchemaOnlyInCapabilities }}
1720 */
1821 public function getCapabilities (): array {
1922 return [];
Original file line number Diff line number Diff line change 7070 * ref2: null|NotificationsPushDevice,
7171 * ref3: string|null|NotificationsPushDevice,
7272 * }
73+ *
74+ * @psalm-type NotificationsSchemaOnlyInCapabilities = array{
75+ * key: string,
76+ * }
7377 */
7478class ResponseDefinitions {
7579}
Original file line number Diff line number Diff line change 2929 "test" : {
3030 "type" : " object" ,
3131 "required" : [
32- " a"
32+ " a" ,
33+ " b"
3334 ],
3435 "properties" : {
3536 "a" : {
3637 "type" : " integer" ,
3738 "format" : " int64"
39+ },
40+ "b" : {
41+ "$ref" : " #/components/schemas/SchemaOnlyInCapabilities"
3842 }
3943 }
4044 }
115119 "type" : " string"
116120 }
117121 }
122+ },
123+ "SchemaOnlyInCapabilities" : {
124+ "type" : " object" ,
125+ "required" : [
126+ " key"
127+ ],
128+ "properties" : {
129+ "key" : {
130+ "type" : " string"
131+ }
132+ }
118133 }
119134 }
120135 },
Original file line number Diff line number Diff line change 2929 "test" : {
3030 "type" : " object" ,
3131 "required" : [
32- " a"
32+ " a" ,
33+ " b"
3334 ],
3435 "properties" : {
3536 "a" : {
3637 "type" : " integer" ,
3738 "format" : " int64"
39+ },
40+ "b" : {
41+ "$ref" : " #/components/schemas/SchemaOnlyInCapabilities"
3842 }
3943 }
4044 }
8286 }
8387 }
8488 }
89+ },
90+ "SchemaOnlyInCapabilities" : {
91+ "type" : " object" ,
92+ "required" : [
93+ " key"
94+ ],
95+ "properties" : {
96+ "key" : {
97+ "type" : " string"
98+ }
99+ }
85100 }
86101 }
87102 },
Original file line number Diff line number Diff line change 2929 "test" : {
3030 "type" : " object" ,
3131 "required" : [
32- " a"
32+ " a" ,
33+ " b"
3334 ],
3435 "properties" : {
3536 "a" : {
3637 "type" : " integer" ,
3738 "format" : " int64"
39+ },
40+ "b" : {
41+ "$ref" : " #/components/schemas/SchemaOnlyInCapabilities"
3842 }
3943 }
4044 }
8286 }
8387 }
8488 }
89+ },
90+ "SchemaOnlyInCapabilities" : {
91+ "type" : " object" ,
92+ "required" : [
93+ " key"
94+ ],
95+ "properties" : {
96+ "key" : {
97+ "type" : " string"
98+ }
99+ }
85100 }
86101 }
87102 },
Original file line number Diff line number Diff line change 2929 "test": {
3030 "type": "object",
3131 "required": [
32- "a"
32+ "a",
33+ "b"
3334 ],
3435 "properties": {
3536 "a": {
3637 "type": "integer",
3738 "format": "int64"
39+ },
40+ "b": {
41+ "$ref": "#/components/schemas/SchemaOnlyInCapabilities"
3842 }
3943 }
4044 }
307311 ]
308312 }
309313 }
314+ },
315+ "SchemaOnlyInCapabilities": {
316+ "type": "object",
317+ "required": [
318+ "key"
319+ ],
320+ "properties": {
321+ "key": {
322+ "type": "string"
323+ }
324+ }
310325 }
311326 }
312327 },
Original file line number Diff line number Diff line change 2929 "test" : {
3030 "type" : " object" ,
3131 "required" : [
32- " a"
32+ " a" ,
33+ " b"
3334 ],
3435 "properties" : {
3536 "a" : {
3637 "type" : " integer" ,
3738 "format" : " int64"
39+ },
40+ "b" : {
41+ "$ref" : " #/components/schemas/SchemaOnlyInCapabilities"
3842 }
3943 }
4044 }
307311 ]
308312 }
309313 }
314+ },
315+ "SchemaOnlyInCapabilities" : {
316+ "type" : " object" ,
317+ "required" : [
318+ " key"
319+ ],
320+ "properties" : {
321+ "key" : {
322+ "type" : " string"
323+ }
324+ }
310325 }
311326 }
312327 },
You can’t perform that action at this time.
0 commit comments