@@ -86,6 +86,8 @@ fn capabilities_schema(plugin_manifests: &BTreeMap<String, Manifest>) -> RootSch
8686 } ) ) ;
8787 }
8888
89+ let mut definitions = Vec :: new ( ) ;
90+
8991 if let Some ( Schema :: Object ( obj) ) = schema. definitions . get_mut ( "PermissionEntry" ) {
9092 let permission_entry_any_of_schemas = obj. subschemas ( ) . any_of . as_mut ( ) . unwrap ( ) ;
9193
@@ -96,17 +98,20 @@ fn capabilities_schema(plugin_manifests: &BTreeMap<String, Manifest>) -> RootSch
9698
9799 for ( plugin, manifest) in plugin_manifests {
98100 if let Some ( global_scope_schema) = & manifest. global_scope_schema {
99- let global_scope_schema_def: Schema = serde_json:: from_value ( global_scope_schema. clone ( ) )
100- . unwrap_or_else ( |e| panic ! ( "invalid JSON schema for plugin {plugin}: {e}" ) ) ;
101+ let global_scope_schema_def: RootSchema =
102+ serde_json:: from_value ( global_scope_schema. clone ( ) )
103+ . unwrap_or_else ( |e| panic ! ( "invalid JSON schema for plugin {plugin}: {e}" ) ) ;
101104
102105 let global_scope_schema = Schema :: Object ( SchemaObject {
103106 array : Some ( Box :: new ( ArrayValidation {
104- items : Some ( global_scope_schema_def. into ( ) ) ,
107+ items : Some ( Schema :: Object ( global_scope_schema_def. schema ) . into ( ) ) ,
105108 ..Default :: default ( )
106109 } ) ) ,
107110 ..Default :: default ( )
108111 } ) ;
109112
113+ definitions. push ( global_scope_schema_def. definitions ) ;
114+
110115 let mut required = BTreeSet :: new ( ) ;
111116 required. insert ( "identifier" . to_string ( ) ) ;
112117
@@ -170,6 +175,10 @@ fn capabilities_schema(plugin_manifests: &BTreeMap<String, Manifest>) -> RootSch
170175 }
171176 }
172177
178+ for definitions_map in definitions {
179+ schema. definitions . extend ( definitions_map) ;
180+ }
181+
173182 schema
174183}
175184
0 commit comments