MiniApp Manifest

W3C Editor's Draft

This version:
https://w3c.github.io/miniapp/specs/manifest/
Latest published version:
https://www.w3.org/TR/miniapp-manifest/
Latest editor's draft:
https://w3c.github.io/miniapp/specs/manifest/
Editors:
Shouren Lan (Huawei)
Zhiqiang Yu (Huawei)
Xiaofeng Zhang (Huawei)
Yongjing Zhang (Huawei)
Participate:
GitHub w3c/miniapp-manifest
File a bug
Commit history
Pull requests

Abstract

This specification is a registry of supplementary members for the Web Application Manifest and Web App Manifest - Application Information specifications that provide additional metadata to an application manifest to describe MiniApps. This JSON-based manifest file enables developers to set up basic information, window style, page route, and other information of a MiniApp. The basic information of a MiniApp includes but is not limited to MiniApp ID, app name, version name, version code, minimum platform version, etc.; window style includes but is not limited to the navigation bar, title, window background, etc.; "pages" are used to specify page route information; and "widgets" are used to describe card information.

本规范定义了基于JSON格式的Manifest文件,使开发者可通过Manifest文件设置MiniApp的基本信息、窗口样式和页面路由等信息。这里,MiniApp基本信息包括但不限于MiniApp ID、名称、版本名称、版本号以及最小平台版本等;窗口样式window包括但不限于导航栏、标题和窗口背景等;pages用于指定页面路由信息;widgets用于描述卡片信息。

Note: At present, only a basic subset of MiniApp Manifest is specified, and it will be gradually updated and supplemented based on different scenario requirements.

备注:目前只是列出MiniApp Manifest的一个基础子集,后续会根据不同的场景需求进行渐进式更新和补充。

Status of This Document

This is a preview

Do not attempt to implement this version of the specification. Do not reference this version as authoritative in any way. Instead, see https://w3c.github.io/miniapp/specs/manifest/ for the Editor's draft.

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at https://www.w3.org/TR/.

This document was published by the MiniApps Working Group as an Editor's Draft.

GitHub Issues are preferred for discussion of this specification.

Publication as an Editor's Draft does not imply endorsement by the W3C Membership.

This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.

This document was produced by a group operating under the W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

This document is governed by the 15 September 2020 W3C Process Document.

1. MiniApp Manifest

A MiniApp manifest extends and profiles the Web App Manifest format [appManifest] and contains metadata associated with a MiniApp.

MiniApp Manifest 是一个JSON文档,其中包含与该MiniApp关联的元数据。

1.1 Requirements

The following members MUST be set in the MiniAppManifest.

The following members MUST be set in the MiniAppManifest.

The following members MUST be set in an ImageResource.

The following members MUST be set in an ImageResource.

The following members MUST be set in a MiniAppWidgetResource.

The following members MUST be set in a MiniAppWidgetResource.

The following member MUST be set in a MiniAppPermissionResource.

The following member MUST be set in a MiniAppPermissionResource.

The priority of all other members is OPTIONAL, but MAY be modified by implementations of the manifest format in the case of specific MiniApp extensions.

1.2 Summary of Members

The following table is a summary of each member:

下表是manifest中每个属性的总结:

Member 属性 Type 类型 Required 必填 Description 描述
appID string Yes ID of the MiniApp ID标识
description string No Description 简述
dir string No Text direction 文本方向
icons src array Yes Application icons 图标
icons src string Yes the source of the icon image in the format of a path string 以路径字符串所表示的图标图片来源
sizes string Yes The applicable resolution sizes of the icon image from the above mentioned src 来自以上src的图标图片所适用的分辨率大小
lang string No Language tag 语言
minPlatformVersion string Yes Minimum platform version supported 支持最小平台版本
name string Yes App name 名称
pages array Yes Route information 路由信息
short_name string No Short name 简称
versionCode string Yes? Version code 版本号
versionName string Yes Version name 版本名称
widgets MiniAppWidgetResource array No Widget 卡片
widgets name string Yes Widget name Widget名字
path string Yes Corresponding page path of Widget. It follows the same path route format as defined in pages. Widget对应页面路径,采用与pages中相同页面路由的格式。
minPlatformVersion string No Minimum platform version supported 支持最小平台版本
window MiniAppWindowResource No Window style 窗口样式
window navigationBarBackgroundColor hexColor No Background color of the navigation bar 导航栏背景颜色
navigationBarTextStyle string No Background title color, valid values: black and white. 导航栏标题颜色,有效值:blackwhite
navigationBarTitleText string No Title text of the navigation bar 导航栏标题文字内容
navigationStyle string No Style of the navigation bar, valid values: default (default style) and custom (customized navigation bar). Note: The capsule button at the right corner is not customizable. 导航栏样式,有效值:default(默认样式)和custom(自定义导航栏)。注意:右上角胶囊按钮不可自定义。
backgroundColor hexColor No Background color of the window 窗口的背景颜色
backgroundTextStyle string No Background text style, valid values: dark and light. 背景文字样式,有效值:darklight
enablePullDownRefresh true | false No Enable pull-to-refresh 是否开启下拉刷新
onReachBottomDistance number No Distance from the bottom when page pull-up bottom event is triggered. The value is a non-negative integer and the unit is in px. 页面上拉触底事件触发时距页面底部距离。取值应为非负整数,单位为 px
orientation string No Screen orientation settings, valid values: portrait and landscape. 屏幕方向设置,有效值:portraitlandscape
fullscreen true | false No Full screen display 全屏显示
designWidth number No The baseline width of the page design in px, based on which the size of the components on the page would be adjusted accordingly. The value is a non-negative integer. px为单位的页面设计基准宽度,元素大小将根据实际设备宽度来缩放。取值应为非负整数。
autoDesignWidth true | false No Whether the designWidth of the page is auto-calculated. When it's true, the value of the designWidth is ignored, and the baseline width is determined by the system automatically according to the pixel density of the screen. 页面设计基准宽度是否自动计算,当设为true时,designWidth将会被忽略,设计基准宽度由设备宽度与屏幕密度计算得出。
reqPermissions MiniAppPermissionResource array No Required permissions 所需权限
reqPermissions name string Yes permission name 权限名称
reason string No The reason to use this permission 该权限的使用目的
Note

Other WebAppManifest members (scope, theme_color, related_applications, prefer_related_applications, and shortcuts) are not currently supported by MiniApp user agents.

2. MiniAppManifest members 字段

As the application manifest is JSON, the members for this specification are of the types number, true | false literals, object, array, and string as defined in The JSON Data Interchange Format. hexcolor is a string expressing RGB color values [css-color-3] in hexadecimal notation: ‘#’ immediately followed by six hexadecimal characters (#rrggbb).

2.1 Members inherited from the WebAppManifest dictionary

2.1.1 dir member 方向

dir member, while specifying the base direction of the localizable members of the manifest, also specifies the default base text direction of the whole MiniApp. The dir member's value can be set to one of the text-direction values as specified in [appManifest].

dir member, while specifying the base direction of the localizable members of the manifest, also specifies the default base text direction of the whole MiniApp. The dir member's value can be set to one of the text-direction values as specified in [appManifest].

2.1.2 icons member 图标

The icons member describes images that serve as iconic representations of MiniApps in various contexts. Both src and sizes are required. src MUST be a relative-url string.

The icons member describes images that serve as iconic representations of MiniApps in various contexts. Both src and sizes are required. src MUST be a relative-url string.

2.1.3 lang member 语言

The lang member, while specifying the primary language of the localizable members, also specifies the primary language of the whole MiniApp.

The lang member, while specifying the primary language of the localizable members, also specifies the primary language of the whole MiniApp.

Note: Use of language

Implementers are encouraged to provide an accurate value that matches the manifest content.

2.1.4 name member 名称

The name member is the descriptive name of the application. This is the name directly displayed to the user. It is used as the display name of MiniApp along with the desktop icon and in the context of MiniApp management.

name,直接呈现给用户的名称,用于在桌面图标和MiniApp管理等处显示MiniApp的名称。

2.1.5 short_name member 简称

The short_name member provides a concise and easy-to-read name for MiniApp. It can be used when there is insufficient space to display the full MiniApp name provided in name.

short_name,为MiniApp提供简短易读的名称,可在没有足够空间显示MiniApp名称时使用。

2.2 Members supplemented from the Application Information

The members listed in this section are defined in Web App Manifest - Application Information [manifest-app-info].

2.2.1 description member 简述

The description member provides a textual description for the MiniApp.

description,为MiniApp提供简短的描述。

2.3 Supplementary manifest members

2.3.1 appID member 标识

The appID member identifies the MiniApp univocally. This member is mainly used for the package management. It supports the update and release of MiniApp versions. The format of appID SHALL be a string defined by the rule below:

appID是MiniApp的唯一标识符,主要用于包管理,支撑MiniApp版本更新和发布。appID的格式是由字母起头的字符串,剩余字符为数字、字母、下划线或点[a-zA-Z_\.]。一种常见的实现方式是使用类似反向域名的命名方式,如com.company.miniapp

appIDrule = ALPHA 1*( ALPHA / DIGIT / "_" / "." )
Note: Naming convention

One common practice is to use the reverse-domain-name-like convention, e.g. com.company.miniapp. One common practice is to use the reverse-domain-name-like convention, e.g. com.company.miniapp.

2.3.2 versionName member 版本名称

The versionName member is a string-type character string that is mainly used for describing the version information. It is also the version name that is displayed to the user. The general format is "1.0.0" as specified in Semantic Versioning [SEMANTIC-VERSIONING]. It plays an important role in version control, MiniApp application, and equipment compatibility.

versionName是一个string类型的字符串,主要用作版本信息描述,也是面向用户显示的版本名称。一般格式为:"1.0.0",详见定义Semantic Versioning [SEMANTIC-VERSIONING],该参数在版本控制、MiniApp应用与设备兼容性等方面发挥重要作用。

2.3.3 versionCode member 版本号

The versionCode member is a number that is mainly used for enhancing the maintainability and security of MiniApp, e.g., a lower version is not compatible with a higher version. versionCode is not displayed to the user and is incrementing according to the version iteration process. Value by default: 1.

versionCode是一个number类型的数值,主要用作提高MiniApp的可维护性和安全性,比如:低版本不能覆盖高版本。此版本号不向用户显示,根据版本迭代过程进行递增。取值是非负整数。默认值:1

2.3.4 minPlatformVersion member 平台版本

The minPlatformVersion member is a string-type character string that indicates the minimum supported version of the required platform to ensure the normal operation of MiniApp (e.g. "1.0.0").

minPlatformVersion是一个string类型的字符串,保证MiniApp正常运行所需平台的最小支持版本。比如:"1.0.0"

2.3.5 pages member 页面路由

The pages member is an array of relative-url string used for specifying which pages are included in a MiniApp. Each item in the array represents a page route. Page route = [path + filename]. During the MiniApp development process, adding or deleting pages is done by configuring the array. When configuring the page route, there is no need to add the file name extension, since the MiniApp platform will automatically parse it. Note: the first item in the pages array stands for the homepage of a MiniApp.

pages数组用于指定MiniApp都包含哪些页面,数组中每一项代表一个页面路由,页面路由 = [路径 + 文件名]。MiniApp开发时新增或删除页面需在数组中进行配置,配置页面路由时文件名不需加后缀名,MiniApp平台会自动解析。备注:pages数组中第一项代表MiniApp首页。

Note

For compatibility with the Web platform, it is RECOMMENDED to use both pages and start_url and use the value "." for scope in the manifest file. The value of start_url MUST be the same as the first entry in pages. If scope.

Issue

Are pages.[0] and start_url aligned in all cases?

2.3.6 window member 窗口

The window member contains sub-attributes, defined in MiniAppWindowResource, used for styling the status bar, navigation bar, title, window background color, etc.

用于设置MiniApp的状态栏、导航条、标题和窗口背景色等样式,如下表所示:

window inherits the text direction and language configuration from dir and lang.

window的文字方向和语言设置继承自dirlang.

2.3.7 widgets member 卡片

The widgets member defines a set of widgets that are a part of a MiniApp. Specifically, a MiniApp package can include MiniApp Pages and Widgets concurrently. As a part of the MiniApp application, widgets share some of the Manifest fields with the MiniApp main program, e.g. dir, lang, appID, name, short_name, icons, versionName, and versionCode. However, a widget also has its private fields, defined in MiniAppWidgetResource.

Widget是MiniApp的一部分。具体来说,MiniApp包中可同时包含 MiniApp Page和Widget。Widget作为MiniApp应用程序的一部分,Widget和MiniApp主体程序共用部分Manifest字段,比如:dirlangappIDnameshort_nameiconsversionNameversionCode。但是Widget也有自己的私有字段,如下表所示:

There are certain differences between the Widget-related APIs and the MiniApp APIs, hence, the declaration of the minimum platform version may be different. If the minPlatformVersion field of a widget is not set explicitly, it is then identical to the minPlatformVersion of the MiniApp by default.

Widget 涉及的API与MiniApp API有一定差别,因此最小平台版本声明可能不同。如不单独设置Widget的minPlatformVersion字段,则默认与MiniApp平台版本相同。

2.3.8 reqPermissions member 所需权限

The reqPermissions member is an array of permission objects. Each MiniAppPermissionResource object declares permission (such as the access to the location information, user contacts, and hardware features like camera) required for the proper running of the MiniApp. User's consent may be asked to protect the user's privacy related to such permissions. Such information can also be used by an app store or a hosting platform to filter a MiniApp according to user's policy or device capabilities.

reqPermissions是一个权限对象的数组,其中每个对象声明了MiniApp正常运行所需的一个权限(比如对位置信息、联系人和摄像头等硬件特性的访问)。为保护权限相关的用户隐私,可能需要征得用户同意。此类权限信息还可以被应用市场或宿主平台用来根据用户策略或者设备能力来过滤MiniApp。详细的权限对象结构定义如下表。

3. MiniAppWindowResource members

3.5 backgroundColor member

The MiniAppWindowResource.backgroundColor member specifies the background color of the window. This member is equivalent to background_color. 窗口的背景颜色

Note

Value by default: #ffffff. Value by default: #ffffff.

3.6 backgroundTextStyle member

The MiniAppWindowResource.backgroundTextStyle member specifies the background text style. 背景文字样式,。

Note

Value by default: dark. Value by default: dark.

3.7 enablePullDownRefresh member

The MiniAppWindowResource.enablePullDownRefresh member specifies if the pull-to-refresh event is enabled. 是否开启下拉刷新

Note

Value by default: false. Value by default: false.

3.8 onReachBottomDistance member

The MiniAppWindowResource.onReachBottomDistance member specifies the distance from the bottom when page pull-up bottom event is triggered. The value is a non-negative integer and the unit is in pixel unit. 页面上拉触底事件触发时距页面底部距离。取值应为非负整数,单位为 px

Note

Value by default: 50. Value by default: 50.

3.9 orientation member

The MiniAppWindowResource.orientation member specifies the screen orientation settings to which a screen can be locked. The two supported values are portrait and landscape, defined in OrientationLockType [screen-orientation]. This member is equivalent to orientation. 屏幕方向设置

Note

Value by default: portrait. Value by default: portrait.

3.10 fullscreen member

The MiniAppWindowResource.fullscreen member indicates the full screen display. true is equivalent to the display fullscreen, and false to minimal-ui.

Note

Value by default: false. Value by default: false.

Issue

Should it be standalone instead of minimal-ui?

3.11 designWidth member

The MiniAppWindowResource.designWidth member indicates the baseline width of the page design in pixel unit, based on which the size of the components on the page would be adjusted accordingly. The value is a non-negative integer. px为单位的页面设计基准宽度,元素大小将根据实际设备宽度来缩放。取值应为非负整数。

Note

Value by default: 750. Value by default: 750.

3.12 autoDesignWidth member

The MiniAppWindowResource.autoDesignWidth member indicates whether the designWidth of the page is auto-calculated. When it's true, the value of the designWidth is ignored, and the baseline width is determined by the system automatically according to the pixel density of the screen. 页面设计基准宽度是否自动计算,当设为true时,designWidth将会被忽略,设计基准宽度由设备宽度与屏幕密度计算得出。

Note

Value by default: false. Value by default: false.

4. MiniAppWidgetResource members

4.1 name member

The MiniAppWidgetResource.name member describes the Widget name Widget名字

4.2 path member

The MiniAppWidgetResource.path member indicates the corresponding page path of a Widget. It follows the same path route format as defined in pages. Widget对应页面路径,采用与pages中相同页面路由的格式。

4.3 minPlatformVersion member

The MiniAppWidgetResource.minPlatformVersion member indicates the minimum platform version supported 支持最小平台版本

There are certain differences between the Widget-related APIs and the MiniApp APIs, hence, the declaration of the minimum platform version may be different. If the minPlatformVersion field of a widget is not set explicitly, it is then identical to the minPlatformVersion of the MiniApp by default.

Widget 涉及的API与MiniApp API有一定差别,因此最小平台版本声明可能不同。如不单独设置Widget的minPlatformVersion字段,则默认与MiniApp平台版本相同。

5. MiniAppPermissionResource members

5.1 name member

The MiniAppPermissionResource.name member indicates the permission name 权限名称

5.2 reason member

The MiniAppPermissionResource.reason member indicates the reason to use this permission 该权限的使用目的

Editor's note

It's for further study whether the predefined permissions, permission extension, permission groups, and protection levels need to be specified.

预定义权限、权限扩展、权限分组和保护等级是否需要定义有待进一步研究。

6. Internationalization 国际化方案

6.1 Localizable members 可本地化属性

The following members are localizable and share the same default configuration of dir and lang if not otherwise specified.

如下属性为可本地化属性。无特别规定的情况下,共享默认的dirlang配置。

6.2 I18n Solution I18n方案

To support the multiple languages, attributes such as name, short_name, and description can be set as a reference to a string resource. Typically, string resources are stored in the corresponding multi-language JSON file in the MiniApp package's i18n directory. The multi-language file’s name complies with IETF BCP 47.

为了支持多语言能力name, short_name, description等参数可以被设置为字符串资源的索引。通常情况下字符串资源被保存在MiniApp包i18n目录下相应的多语言文件中。多语言文件命名规范符合IETF BCP 47。

The following example describes two simple multi-language files:

以下例子描述2个简单的多语言文:

i18n/en-US.json

{
 "strings": { 
    "name":"miniapp demo",
    "short_name":"MD",
    "description_application":"MiniApp Demo",
    },
    "files": {
    "images":"image/en_picture.PNG",
    },  
   }

i18n/zh-Hans.json

{
  "strings": { 
    "name":"小程序试用版",
    "short_name":"小程序",
    "description_application":"迷你程序试用版本",
  },
  "files": {
    "images":"image/zh_picture.PNG",
  },  
}

Developers can refer to a resource using the syntax $string:‹resource-name›, for example, "decscription": "$string:description_application".

用户可以使用$string:‹resource-name›的方式引用字符串资源,例如:"decscription": "$string:description_application".

The following example describes a simple manifest fragment that supports multiple languages capability:

以下例子描述一个简单的支持多语言的manifest片段:

{
  "dir": "ltr",
  "lang": "en-US",
  "appID": "org.w3c.miniapp",
  "name": "$string:name",
  "short_name": "string:short_name",
  "versionName": "1.0.0",
  "versionCode": 1,
  "description": "$string:description_application",
  "icons": [
    {
      "src": "common/icons/icon.png",
      "sizes": "48x48"
    }
  ]
}

In this way, when reading the MiniApp Manifest, the MiniApp processor, such as marketplace, can extract the string resource information from the corresponding language file in the MiniApp package's i18n directory according to the configuration information of itself and generates the localized description. For example, if the configuration information of the marketplace is simplified Chinese, the marketplace parses the "name": "$string: name" statement in the manifest and extracts string: name information from the zh-Hans.json file in the MiniApp package's i18n directory. And then it generates the localized name of the MiniApp: 小程序试用版。

通过上述方式,应用市场在读取应用manifest时,会根据自身的配置信息,从i18n目录下相应的语言文件,提取字符串信息,生成本地描述。例如 应用市场配置信息为汉语简体,则应用市场会解析manifest中"name": "$string:name"语句,从i18n目录的zh-Hans.json文件,提取string:name信息:小程序试用版,并在应用市场生成该应用的本地化名称:小程序试用版。

7. Dependencies 依赖

As a key part of a MiniApp package, the manifest.json file describes several important aspects of the MiniApp by referring to the resources inside the MiniApp package in different forms of files, such as the page files in the pages directory and the icon images in the common directory. Details are specified in the MiniApp Packaging specification.

作为MiniApp包中的关键部分,manifest.json文件通过引用MiniApp包中的多个不同形式的资源文件描述了MiniApp应用的多个重要方面,比如引用pages目录中的页面相关文件和common目录中的图标文件。详细情况在MiniApp Packaging规范中定义。

The normal operation of a MiniApp relies on the proper configuration of the manifest file according to this specification and the availability of the dependent resources in the MiniApp package. Such dependency needs to be checked during both the development phase and deployment phase.

MiniApp的正常运行依赖于根据本规范进行恰当的manifest文件配置以及MiniApp包中所依赖资源的可用性。此依赖关系需要在开发和部署阶段进行检查。

8. Conformance 标准符合性

As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.

本规范中的所有内容均为本草案的规范性内容,但明确标记为“非规范性”的部分、示例和注释除外。

The key word RECOMMENDED in this document is to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.

如此处所示,当且仅当以着重号标记时,建议RECOMMENDED)才以BCP 14 [RFC2119] [RFC8174]中的说明解释。

This specification uses the Augmented Backus-Naur Form (ABNF) notation of [RFC5234].

9. Security and Privacy Considerations 安全隐私考虑

9.1 Content constraint 内容限制

As the manifest is a JSON file and will commonly be encoded using [UNICODE], the security considerations described in [ECMA-404] and [UTR36] apply. In order to prevent developers from including custom/unrestrained data in a manifest, implementors may use a more strict schema than that defined in JSON Schema to impose their own implementation-specific limits on the member names, types and value ranges, e.g. to guard against memory overflow, or to meet platform-specific limitations.

Manifest作为一个JSON文件,通常以[UNICODE]方式编码,因此[ECMA-404]和[UTR36]中所定义的安全措施同样适用。为了防止开发者在manifest中添加任意不受限的数据,开发者可在其具体实现中采用比JSON Schema中所定义的更加严格的schema来约束文件中的成员元素名称、类型和取值范围等,从而防止内存耗尽或满足平台特有的限制。

9.2 Local resource access 本地资源访问

Members like icons, pages, widgets contain paths referring to local resources on the hosting platform. Implementors and the hosting platform should check the validity of those paths to ensure no illegal access outside the scope of the MiniApp package. On the other hand, the MiniApp itself (e.g. in JS code) may provide means to jump to external resources either on the hosting platform, or on a remote web site (e.g. through a uri). In this case, the hosting platform is responsible for providing clear indication to an end-user about such context switch.

icons, pages, widgets等属性包含了宿主平台上的本地资源引用路径,开发者和宿主平台应该检查这些路径的合法性以确保没有MiniApp package之外的非法访问。另一方面,MiniApp自身(如JS代码中)可能提供跳转到其他外部资源的方式,包括宿主平台或远程网站上的外部资源(比如通过uri)。此时,宿主平台应该负责向用户提供明确的上下文切换的指示信息。

In addition, the reqPermissions member provides a specific means to control the access to the local software, hardware and data resources on the user's device. User's consent should be asked when it comes to privacy-related or high-level privileged resources.

此外,reqPermissions属性提供了具体的控制访问用户设备上的本地软硬件及数据资源的方法。当涉及隐私或者高级权限相关的资源访问时,应该征询用户的同意。

9.3 Integrity 完整性

The integrity of the manifest document is protected by a cryptographic hash mechanism as part of the whole MiniApp package. Details are specified in the MiniApp Packaging specification.

Manifest文档的完整性作为MiniApp package的一部分被密码哈希机制所保护。详细定义见MiniApp Packaging specification

9.4 Transparency 信息透明

It is RECOMMENDED that the hosting platform makes the necessary meta information in the manifest available to the end-user, such as appID, name, short_name, icons, versionName, description. This is to give an end-user an opportunity to make a conscious decision to approve the installation and use of the MiniApp. This could also help to identify a spoofing MiniApp.

建议宿主平台将manifest中的必要元数据信息提供给用户,比如appID, name, short_name, icons, versionName, description。这样可以给用户一个机会来对MiniApp的安装和使用提供清晰的判断依据,也可以帮助用户来识别伪装的恶意MiniApp。

10. JSON Schema JSON语法

Developers interested in validating the MiniApp manifest document can use the JSON Schema defined here.

开发者可使用此处所定义的JSON Schema来验证manifest文件。

11. Example 样例

This section is non-normative.

{
  "dir": "ltr",
  "lang": "en-US",
  "appID": "org.w3c.miniapp",
  "name": "MiniApp Demo",
  "short_name": "MiniApp",
  "versionName": "1.0.0",
  "versionCode": 1,
  "description": "A Simple MiniApp Demo",
  "icons": [
    {
      "src": "common/icons/icon.png",
      "sizes": "48x48"
    }
  ],
  "minPlatformVersion": "1.0.0",
  "pages": [
    "pages/index/index",
    "pages/detail/detail"
  ],
  "window": {
    "navigationBarTextStyle": "black",
    "navigationBarTitleText": "Demo",
    "navigationBarBackgroundColor": "#f8f8f8",
    "backgroundColor": "#ffffff",
    "fullscreen": false
  },
  "widgets": [
    {
      "name": "widget",
      "path": "widgets/index/index",
      "minPlatformVersion": "1.0.0"
    }
  ],
  "reqPermissions": [
    {
      "name": "system.permission.LOCATION",
      "reason": "To show user's position on the map"
    },
    {
      "name": "system.permission.CAMERA",
      "reason": "To scan the QR code"
    }
  ]
}

A. Acknowledgments 致谢

This document refers to W3C Web App Manifest, Baidu MiniApp, WeChat MiniApp, Alipay MiniApp, ByteDance MiniApp, Quick App Specification, MiniApp Widget Specification, MiniApp Lifecycle Specification, MiniApp URI Scheme, and Semantic Versioning. We appreciate the open source efforts of these documents.

本文档参考了W3C Web App Manifest百度小程序微信小程序支付宝小程序字节跳动小程序快应用联盟规范MiniApp Widget文件规范MiniApp Lifecycle规范MiniApp URI规范, Semantic Versioning规范。感谢这些文档的开源努力。

B. Extensibility Extensibility

This section is non-normative.

This specification is based on the Web App Manifest extensibility principle.

This specification is based on the Web App Manifest extensibility principle.

Although proprietary extensions are undesirable, they may be included as a manifest extension. In this case, it is RECOMMENDED to use vendor prefixes for the new members.

Although proprietary extensions are undesirable, they may be included as a manifest extension. In this case, it is RECOMMENDED to use vendor prefixes for the new members.

We encourage implementors to add proprietary extensions to the Extensions Registry. This allows the community to track what extensions vendors and/or the web community have defined and documented.

We encourage implementors to add proprietary extensions to the Extensions Registry. This allows the community to track what extensions vendors and/or the web community have defined and documented.

The following is an example of three hypothetical vendor extensions.

The following is an example of three hypothetical vendor extensions.

Example 5: Proprietary extensions
{
  ...
  "wechat_new_feature": "foo",
  "ali_new_url_system": "http://example.org",
  "coolminiapp_menu_color": "#FA0000"
  ...
}

C. References

C.1 Normative references

[appManifest]
Web Application Manifest. Marcos Caceres; Kenneth Christiansen; Mounir Lamouri; Anssi Kostiainen; Matt Giuca; Aaron Gustafson. W3C. 9 March 2021. W3C Working Draft. URL: https://www.w3.org/TR/appmanifest/
[css-color-3]
CSS Color Module Level 3. Tantek Çelik; Chris Lilley; David Baron. W3C. 19 June 2018. W3C Recommendation. URL: https://www.w3.org/TR/css-color-3/
[css-values]
CSS Values and Units Module Level 3. Tab Atkins Jr.; Elika Etemad. W3C. 6 June 2019. W3C Candidate Recommendation. URL: https://www.w3.org/TR/css-values-3/
[ECMA-404]
The JSON Data Interchange Format. Ecma International. 1 October 2013. Standard. URL: https://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf
[image-resource]
Image Resource. Aaron Gustafson; Rayan Kanso; Marcos Caceres. W3C. 13 March 2021. W3C Working Draft. URL: https://www.w3.org/TR/image-resource/
[manifest-app-info]
Web App Manifest - Application Information. Aaron Gustafson. W3C. 15 March 2021. W3C Note. URL: https://www.w3.org/TR/manifest-app-info/
[RFC2119]
Key words for use in RFCs to Indicate Requirement Levels. S. Bradner. IETF. March 1997. Best Current Practice. URL: https://datatracker.ietf.org/doc/html/rfc2119
[RFC5234]
Augmented BNF for Syntax Specifications: ABNF. D. Crocker, Ed.; P. Overell. IETF. January 2008. Internet Standard. URL: https://datatracker.ietf.org/doc/html/rfc5234
[RFC8174]
Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words. B. Leiba. IETF. May 2017. Best Current Practice. URL: https://datatracker.ietf.org/doc/html/rfc8174
[rfc8259]
The JavaScript Object Notation (JSON) Data Interchange Format. T. Bray, Ed.. IETF. December 2017. Internet Standard. URL: https://datatracker.ietf.org/doc/html/rfc8259
[screen-orientation]
The Screen Orientation API. Mounir Lamouri; Marcos Caceres; Johanna Herman. W3C. 19 October 2020. W3C Working Draft. URL: https://www.w3.org/TR/screen-orientation/
[SEMANTIC-VERSIONING]
Semantic Versioning. URL: https://semver.org/
[UNICODE]
The Unicode Standard. Unicode Consortium. URL: https://www.unicode.org/versions/latest/
[url]
URL Standard. Anne van Kesteren. WHATWG. Living Standard. URL: https://url.spec.whatwg.org/
[UTR36]
Unicode Security Considerations. Mark Davis; Michel Suignard. Unicode Consortium. 19 September 2014. Unicode Technical Report #36. URL: https://www.unicode.org/reports/tr36/tr36-15.html