@finos/fdc3-schema

中文文档
3.0.0发布于 2026/10/26Apache-2.0TypeScriptES Module零依赖构建来源已验证近 30 天下载 3.5万

This package holds both the schema files and TypeScript types generated from them used that define JSON message formats used in the FDC3 Desktop Agent Bridging Protocol and both the Web Connection Protocol (WCP) and Desktop Agent COmmunication Protocol (D

原始使用文档

FDC3 Bridging and FDC3 for Web Message Schemas

This package holds both the schema files and TypeScript types generated from them used that define JSON message formats used in the FDC3 Desktop Agent Bridging Protocol and both the Web Connection Protocol (WCP) and Desktop Agent COmmunication Protocol (DACP) that allow FDC3 to be used in a Web Browser.

The Schema files distributed in this package are also deployed to the Web at the locations given in their $id fields and can be found in the relevant sections of the FDC3 documentation (Bridging, Web Connection protocol, Desktop Agent Communication Protocol).

TypeScript types are generated from each schema and can be imported from the package as a set:

import { BrowserTypes, BridgingTypes } from '@finos/fdc3-schema';

or individually:

import {
  GetUserChannelsRequest,
  JoinUserChannelRequest,
  LeaveCurrentChannelRequest
} from '@finos/fdc3-schema/dist/generated/api/BrowserTypes.js';

Further details:

Message types generation notes

This folder contains Typescript interfaces, in BridgingTypes.ts generated from the context JSONSchema (https://json-schema.org/) files via quicktype (https://quicktype.io/). Source files may also be generated for us in other languages supported by Quicktype.

Please note that these definitions are provided to help developers working in TypeScript to produce valid bridging or FDC3 for Web messages objects - but should not be considered the 'source of truth' for message definitions (instead look to the schemas and documentation).

It is not always possible to perfectly replicate a type/interface defined in JSONSchema via TypeScript. Hence, if there is any disagreement between the definitions, the JSON Schema should be assumed to be correct, rather than the TypeScript. For example, JSON Schema may define optional fields on an object + a restriction on the type of additional properties (via "additionalProperties": { "type": "string"}), which will result in an index signature [property: string]: string; in generated TypeScript. That signature is incompatible with optional properties (including string properties) as they have type string | undefined. A similar problem may occur in JSON Schema if the schema is used to create a subtype via composition as additionalProperties is not aware of the subschema's definitions. Both issues can be worked around by using unevaluatedProperties in the schema, which will defer to the declared type of the optional property in the subschema, but is also currently ignored by Quicktype - resulting in a type that will compile but doesn't restrict the type of optional property values as defined in the schema.

Further, Quicktype doesn't always perfectly replicate polymorphic fields specified with oneOf or allOf in JSON Schema as it will usually merge the different objects into a single type (where fields not in one of the constituent schemas become optional) rather than creating a union type. In such situations, the type produced is usable (has all the necessary fields) but may allow the construction of invalid instances which are missing required properties or include properties from the multiple schemas combined, which are not possible/valid according to JSON Schema.

Hence, the Types provided here can be used to provide valid message objects and to read/write their JSON encodings, but may not detect or prevent a limited set of invalid objects that would be identified by JSON Schema.

Finally, Quicktype will generate types or interfaces representing subunits of the schema, which are then referenced in the primary interface definition. These often do not have unique names (generated from title fields in the schemas). If a name conflict is encountered, Quicktype will generate a random name for such an interface, to use to reference it, and as it is randomly generated it may appear oddly named (e.g. PurpleId, FluffyMarket, TentacledIdentifier etc.). Please ignore such names as these types/interfaces will not normally be used outside of the composition of the primary type, e.g.:

export interface Instrument {
  id: StickyId;
  market?: FluffyMarket;
  type: string;
  name?: string;
  [property: string]: any;
}

export interface StickyId {
  BBG?: string;
  CUSIP?: string;
  FDS_ID?: string;
  FIGI?: string;
  ISIN?: string;
  PERMID?: string;
  RIC?: string;
  SEDOL?: string;
  ticker?: string;
  [property: string]: any;
}

export interface FluffyMarket {
  BBG?: string;
  COUNTRY_ISOALPHA2?: string;
  MIC?: string;
  name?: string;
  [property: string]: any;
}

and should not be considered a planned part of the type structure (which should not be replicated in any derivative work). When applied, the naming of these sub-units is not used, rather they are replaced with their contents. Generating better names for these sub-units is usually a case of adding or adjusting title fields on the relevant elements of the schema documents.

Finally, please note that the latest version of Quicktype (at the time of writing 23.0.49) has a number of bugs that must be worked around:

  • Using a directory or .schema.json files as a source will cause the input type argument -s schema to be ignored, causing the files to be interpreted as JSON rather than JSON Schema.
    • A utility is provided in this repository (../../quicktypeUtil.js) to work around this bug by listing directories and constructing a call to quicktype where each file is provided as an individual source.
  • Setting the --nice-property-names TypeScript output option will crash the generator and can't be used.
  • The --debug setting must be the first argument passed or it will be ignored.

版本与发布记录

@finos/fdc3-schema 共发布 20 个版本,首次发布于 2025/01/15;过去 12 个月发布了 9 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
3.0.0latest2026/10/2619 天前
3.0.0-beta.1prerelease2026/10/081 个月前
3.0.0-alpha.52026/09/231 个月前
3.0.0-alpha.42026/09/221 个月前
3.0.0-alpha.22026/06/224 个月前
2.2.32026/05/146 个月前

关于 @finos/fdc3-schema 的常见问题

@finos/fdc3-schema 是什么?

This package holds both the schema files and TypeScript types generated from them used that define JSON message formats used in the FDC3 Desktop Agent Bridging Protocol and both the Web Connection Protocol (WCP) and Desktop Agent COmmunication Protocol (D

如何安装 @finos/fdc3-schema?

在项目目录运行 npm install @finos/fdc3-schema,或使用 pnpm add / yarn add / bun add。

@finos/fdc3-schema 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@finos/fdc3-schema 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@finos/fdc3-schema 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@finos/fdc3-schema 可以商用吗?

@finos/fdc3-schema 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@finos/fdc3-schema 的下载量有多少?

根据 npm 官方下载统计,@finos/fdc3-schema 在 2026/10/15 – 2026/11/13 这 30 天内被下载 34,609 次,日均约 1,154 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@finos/fdc3-schema 还在维护吗?

最新版本 3.0.0 发布于 2026/10/26(19 天前);至今共发布 20 个版本,其中过去 12 个月发布了 9 个;首次发布于 2025/01/15。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。