1e41f4b71Sopenharmony_ci# OpenHarmony API Governance Charter
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci## Introduction
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ciTo help the OpenHarmony ecosystem develop and evolve in a healthy and orderly way, this Charter defines the governance process and lifecycle (create, change, deprecate, and delete) of OpenHarmony APIs. It also specifies basic design requirements of OpenHarmony APIs.
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ciThis Charter is formulated by the [API SIG](https://www.openharmony.cn/SIG/api/) and approved by the [PMC](https://www.openharmony.cn/pmc) for release. Any revision to this Charter will be released only after being reviewed by the API SIG and approved by the PMC.
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci## Overview
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ci### Scope and Definition
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ciThe OpenHarmony software stack contains multiple roles. Naturally, OpenHarmony APIs have multiple types.
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ci![](figures/API-Category.png)
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ciDifferent types of APIs have different compatibility requirements, as described in the table below.
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ci| Type| Prepared By| Used By| Compatibility Requirement| Guarding Method|
20e41f4b71Sopenharmony_ci|---|---|---|---|---|
21e41f4b71Sopenharmony_ci| Public API | System and framework| All application developers| 5 API versions| X test suite (XTS)|
22e41f4b71Sopenharmony_ci| Test API | Test framework | All application developers| 3 API versions| To be built|
23e41f4b71Sopenharmony_ci| System API |  System and framework|System application developers|Not guaranteed| To be built|
24e41f4b71Sopenharmony_ci| HDI | HDF| System services| 4 API versions| X test suite (XTS)|
25e41f4b71Sopenharmony_ci| Driver API | HDF | Driver developers| Not guaranteed| None|
26e41f4b71Sopenharmony_ci| Inner API | System parts| System parts| Not guaranteed| None|
27e41f4b71Sopenharmony_ci
28e41f4b71Sopenharmony_ciThe APIs are described as follows:
29e41f4b71Sopenharmony_ci
30e41f4b71Sopenharmony_ci* Public API: APIs provided for all application developers.
31e41f4b71Sopenharmony_ci* Test API: APIs used for testing. They can be used only in the test phase.
32e41f4b71Sopenharmony_ci* System API: APIs provided for privileged system applications. Common applications cannot use these APIs.
33e41f4b71Sopenharmony_ci* HDI: APIs that describe hardware capabilities.
34e41f4b71Sopenharmony_ci* Driver API: APIs provided for driver developers.
35e41f4b71Sopenharmony_ci* Inner API: APIs to implement mutual calling between the system service and framework. They are used only inside the system and do not guarantee compatibility.
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ci### APIs and Programming Languages
38e41f4b71Sopenharmony_ci
39e41f4b71Sopenharmony_ciOpenHarmony aims to build a next-generation Operating System (OS) for the Internet of Everything (IoE) era. The following programming languages and more can be used:
40e41f4b71Sopenharmony_ci
41e41f4b71Sopenharmony_ci* C/C++
42e41f4b71Sopenharmony_ci* JavaScript
43e41f4b71Sopenharmony_ci* TypeScript
44e41f4b71Sopenharmony_ci* ArkTS
45e41f4b71Sopenharmony_ci
46e41f4b71Sopenharmony_ciThe content described in this Charter is irrelevant to the programming language in use. Regardless of the programming language, APIs must comply with this Charter while meeting the programming language requirements.
47e41f4b71Sopenharmony_ci
48e41f4b71Sopenharmony_ci## API Governance
49e41f4b71Sopenharmony_ci
50e41f4b71Sopenharmony_ci### Roles and Responsibilities
51e41f4b71Sopenharmony_ci
52e41f4b71Sopenharmony_ci|**Role**|**Responsibilities in API Governance**|
53e41f4b71Sopenharmony_ci| - | - |
54e41f4b71Sopenharmony_ci|Contributor|Commit API code and design documents.|
55e41f4b71Sopenharmony_ci|Committer|Review the code and submit a pre-review comment on an API commit.|
56e41f4b71Sopenharmony_ci|Domain SIG| Comment on the commits of new API code, so the passed commits can be merged.<br>Provide pre-review comments on updated API code.|
57e41f4b71Sopenharmony_ci|API SIG|Comment on updated API code.|
58e41f4b71Sopenharmony_ci|PMC|Release API version plans. Review amendments of this Charter, revise the terms, and publish this Charter.|
59e41f4b71Sopenharmony_ci
60e41f4b71Sopenharmony_ci### API Review Process
61e41f4b71Sopenharmony_ciThe API review process is as follows:
62e41f4b71Sopenharmony_ci
63e41f4b71Sopenharmony_ci![](figures/API-Workflow.png)
64e41f4b71Sopenharmony_ci
65e41f4b71Sopenharmony_ciThe main process is as follows:
66e41f4b71Sopenharmony_ci
67e41f4b71Sopenharmony_ci1. Initiate API review and commit code (contributor). If any APIs are added or modified, the contributor must additionally submit an API review application to specify the API requirement source, usage scenario, permission design, and privacy protection design. For details, see "API Review Application Composites" below. To avoid rework, the contributor can send an email to submit the API design document to the committer, domain SIG, and API SIG for pre-review before the formal API review application and code commit.
68e41f4b71Sopenharmony_ci1. Review code (committer). After the code review is approved, the committer should submit the APIs to the domain SIG. If the API code involves multiple domains, they should be submitted to the committers of the corresponding domains. The next review step can be performed only after all committers review and approve the code.
69e41f4b71Sopenharmony_ci1. Review APIs (domain SIG). The code of new APIs can be merged only after being reviewed and approved by the domain SIG. If there are changes to existing APIs, the domain SIG should submit them to the API SIG. If the new APIs involve multiple domains, they should be submitted to the SIGs of the corresponding domains. The code can be merged after being reviewed and approved by one of the domain SIGs. If the changed APIs involve multiple domains, they should be submitted to the SIGs of the corresponding domains. The next review step can be performed only after all domain SIGs approve the APIs.
70e41f4b71Sopenharmony_ci1. Review API changes (owner: API SIG): The code of changed APIs can be merged only after being reviewed and approved by the API SIG.
71e41f4b71Sopenharmony_ci1. The review is complete.
72e41f4b71Sopenharmony_ci
73e41f4b71Sopenharmony_ci### API Review Application Composites
74e41f4b71Sopenharmony_ci
75e41f4b71Sopenharmony_ciIf an API is added or changed, the corresponding API review application must be submitted. For details on the application template, see [API Review Template](API-Review-Template.md).
76e41f4b71Sopenharmony_ci
77e41f4b71Sopenharmony_ciFor new APIs, you must:
78e41f4b71Sopenharmony_ci1. (Mandatory) Describe the requirement source and usage scenario.
79e41f4b71Sopenharmony_ci1. (Mandatory) Analyze the API as-is and gaps, and describe the necessity of adding or changing APIs.
80e41f4b71Sopenharmony_ci1. (Mandatory) Describe the API prototype design and usage. (Optional) When necessary, add use examples.
81e41f4b71Sopenharmony_ci1. (Mandatory) Provide the API permission design.
82e41f4b71Sopenharmony_ci1. (Mandatory) Clarify the API privacy protection solution and requirements fulfillment.
83e41f4b71Sopenharmony_ci1. (Mandatory) Submit the corresponding API reference when committing the code. (Optional) When necessary, submit the corresponding developer guide.
84e41f4b71Sopenharmony_ci1. (Optional) Describe the compatibility, performance, power consumption, reliability, and tests. (If "API Design Requirements" of this Charter are not met, the description must be included.)
85e41f4b71Sopenharmony_ci
86e41f4b71Sopenharmony_ciFor changed APIs, except the preceding operations, you must:
87e41f4b71Sopenharmony_ci1. (Mandatory) Describe how earlier APIs are handled (deprecated, hidden, or permanently deleted) and compatibility measures for developing applications using old SDKs.
88e41f4b71Sopenharmony_ci2. (Mandatory) Describe the change impact, substitute APIs, and corresponding application adaptation solution.
89e41f4b71Sopenharmony_ci3. (Mandatory) Update the ChangeLog file. Update the API-diff file (Mandatory if JS or native API changes are involved.)
90e41f4b71Sopenharmony_ci
91e41f4b71Sopenharmony_ci## API Lifecycle and Compatibility Requirements
92e41f4b71Sopenharmony_ci
93e41f4b71Sopenharmony_ciOpenHarmony APIs will evolve in the form of API versions. Each version goes through the release period shown in the following figure,
94e41f4b71Sopenharmony_ci
95e41f4b71Sopenharmony_ciwhich also demonstrates the compatibility requirements for the APIs in different periods.
96e41f4b71Sopenharmony_ci
97e41f4b71Sopenharmony_ci![](figures/API-Lifecycle.png)
98e41f4b71Sopenharmony_ci
99e41f4b71Sopenharmony_ci   1. Canary version: API Preview version released at an earlier date, which cannot ensure API stability.
100e41f4b71Sopenharmony_ci       1. Canary versions are compatible with the previous Release version.
101e41f4b71Sopenharmony_ci       1. Different Canary versions of the same API version are not required to keep compatible.
102e41f4b71Sopenharmony_ci   1. Beta version: publicly released beta version, which cannot ensure API stability.
103e41f4b71Sopenharmony_ci       1. Canary versions are compatible with the previous Release version.
104e41f4b71Sopenharmony_ci       1. Beta versions are not compatible with the early Canary versions of the same API version.
105e41f4b71Sopenharmony_ci       1. Different Beta versions of the same API version are not required to keep compatible.
106e41f4b71Sopenharmony_ci       1. The APIs are frozen after the API Stable version is released. API additions or changes are not allowed for later Beta versions.
107e41f4b71Sopenharmony_ci   1. Release version: official API release version.
108e41f4b71Sopenharmony_ci       Released APIs must comply with the contractual commitments made to developers. In principle, incompatible changes cannot be made on released APIs, and deprecation of released APIs is restricted. The basic requirements for deprecating released APIs are as follows:
109e41f4b71Sopenharmony_ci       1. Add the @deprecated annotation.
110e41f4b71Sopenharmony_ci       1. Provide substitute APIs.
111e41f4b71Sopenharmony_ci       1. Retain the deprecated APIs in at least five API versions released since the deprecation.
112e41f4b71Sopenharmony_ci
113e41f4b71Sopenharmony_ci### API Design Specifications
114e41f4b71Sopenharmony_ci
115e41f4b71Sopenharmony_ciFor details, see [OpenHarmony API Design Specifications](OpenHarmony-API-quality.md).
116