1<?xml version="1.0" encoding="UTF-8"?><!--
2  Copyright 2025 The Android Open Source Project
3
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7
8       http://www.apache.org/licenses/LICENSE-2.0
9
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15  -->
16
17<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
18
19    <!--
20    This file lists down the current schema for representing metadata for an AppFunction
21    as understood by the AppSearch indexer.
22
23    Rules to modify this file:
24
25    1. Legacy properties of AppFunctionStaticMetadata should not be removed/renamed/modified.
26
27    2. Self referencing document schemas like AppFunctionDataTypeMetadata can not be indexed or
28       tokenized.
29
30    3. Refer to AppSearchSchema class for deciding the right value of attributes like
31       cardinality, indexingType, tokenizerType, etc. These can differ based on the type of
32       property.
33    -->
34
35    <!-- Definition for AppFunctionDataTypeMetadataDocument -->
36    <xs:documentType name="AppFunctionNamedDataTypeMetadataDocument">
37        <xs:element name="name" cardinality="2" type="xs:string" />
38        <xs:element name="dataTypeMetadata" cardinality="2"
39            type="appfn:AppFunctionDataTypeMetadataDocument" />
40    </xs:documentType>
41
42    <!-- Definition for AppFunctionDataTypeMetadataDocument -->
43    <xs:documentType name="AppFunctionDataTypeMetadataDocument">
44        <xs:element name="type" cardinality="3" type="xs:long" />
45        <xs:element name="itemType" cardinality="2"
46            type="appfn:AppFunctionDataTypeMetadataDocument" />
47        <xs:element name="properties" cardinality="1"
48            type="appfn:AppFunctionNamedDataTypeMetadataDocument" />
49        <xs:element name="allOf" cardinality="1" type="appfn:AppFunctionDataTypeMetadataDocument" />
50        <xs:element name="required" cardinality="1" type="xs:string" />
51        <xs:element name="dataTypeReference" cardinality="2" type="xs:string" />
52        <xs:element name="isNullable" cardinality="2" type="xs:boolean" />
53        <xs:element name="objectQualifiedName" cardinality="2" type="xs:string" />
54    </xs:documentType>
55
56    <!-- Definition for AppFunctionParameterMetadataDocument -->
57    <xs:documentType name="AppFunctionParameterMetadataDocument">
58        <xs:element name="name" cardinality="2" type="xs:string" />
59        <xs:element name="isRequired" cardinality="2" type="xs:boolean" />
60        <xs:element name="dataTypeMetadata" cardinality="2"
61            type="appfn:AppFunctionDataTypeMetadataDocument" />
62    </xs:documentType>
63
64    <!-- Definition for AppFunctionResponseMetadataDocument -->
65    <xs:documentType name="AppFunctionResponseMetadataDocument">
66        <xs:element name="isNullable" cardinality="2" type="xs:boolean" />
67        <xs:element name="valueType" cardinality="2"
68            type="appfn:AppFunctionDataTypeMetadataDocument" />
69    </xs:documentType>
70
71    <!-- Definition for AppFunctionComponentMetadataDocument -->
72    <xs:documentType name="AppFunctionComponentMetadataDocument">
73        <xs:element name="dataTypes" cardinality="1"
74            type="appfn:AppFunctionNamedDataTypeMetadataDocument" />
75    </xs:documentType>
76
77    <!-- Definition for AppFunctionStaticMetadata -->
78    <xs:documentType name="AppFunctionStaticMetadata">
79        <!-- Start of legacy properties. These should not be removed/renamed/modified to maintain
80        compatibility with legacy document schema defined in platform.-->
81        <xs:element name="functionId" cardinality="2" indexingType="1" tokenizerType="2"
82            type="xs:string" />
83        <xs:element name="packageName" cardinality="2" indexingType="1" tokenizerType="2"
84            type="xs:string" />
85        <xs:element name="schemaName" cardinality="2" indexingType="1" tokenizerType="2"
86            type="xs:string" />
87        <xs:element name="schemaVersion" cardinality="2" indexingType="1" type="xs:long" />
88        <xs:element name="schemaCategory" cardinality="2" indexingType="1" tokenizerType="2"
89            type="xs:string" />
90        <xs:element name="enabledByDefault" cardinality="2" type="xs:boolean" />
91        <xs:element name="restrictCallersWithExecuteAppFunctions" cardinality="2"
92            type="xs:boolean" />
93        <xs:element name="displayNameStringRes" cardinality="2" type="xs:long" />
94        <xs:element name="mobileApplicationQualifiedId" cardinality="2" joinableValueType="1"
95            type="xs:string" />
96        <!-- End of legacy properties.-->
97
98        <xs:element name="description" cardinality="2" type="xs:string" />
99        <xs:element name="parameters" cardinality="1"
100            type="appfn:AppFunctionParameterMetadataDocument" />
101        <xs:element name="components" cardinality="2"
102            type="appfn:AppFunctionComponentMetadataDocument" />
103        <xs:element name="response" cardinality="2"
104            type="appfn:AppFunctionResponseMetadataDocument" />
105    </xs:documentType>
106</xs:schema>
107