Skip to content

JSON Schemas

Summary outcome

JSON is more widely adopted than plist and offers advantages such as simplicity, lightweight syntax and language agnosticism as it is supported by both iOS & aOS. Specifically for PH it is

  • easier for CI release pipelines to inspect the Policy files to verify they are registered Plugins.
  • easier to read when accessing the file via GitHub. Policy files need to be as readable as possible in GitHub to facilitate the plugins integration.
  • offers consistency across aOS and iOS.

Furthermore it has been agreed to

  • use (JSON-Schemas.org)[https://json-schema.org] to generate JSON Schemas per plugin. This files will be persisted in GitHub serving for validation and documentation purposes.
  • define a specific location/path in the repo so scripts can fetch them always from the same location - Enforced in accreditation process.

see also tickets below regarding decision process of using JSON Schemas:

  1. Spike - iOS | Schema Validation - Proto Buffers
  2. Spike - Schema Validation - Schemas format based on JSON-Schema.org
  3. Spike - existing Script schema Validation | Look into if schemas can be validated against each other using existing scripts.

Policy Files

PlatformHub JSON schema files should be named as follows:

For Send and Subscribe message types

swift
{MessageContext}.{MessageType}.{PluginName}.{MessageName}.{PayloadType}.schema.json

For Receive and Publish message types

{MessageContext}.{MessageType}.{MessageName}.{PayloadType}.schema.json

Must exactly match one of the following options:

  • Send
  • Receive
  • Publish
  • SubscribeOnDemand
  • SubscribeOnStartUp

Must exactly match one of the following options:

  • Command
  • Query
  • ViewQuery (iOS only)
  • NavigationQuery (Android only)
  • EventStream

The plugin that receives or publishes the message, regardless of the context Must exactly match the "pluginName" defined in the plugins Policy file in PascalCase

Must match the "messageName" defined in the Policy file in PascalCase Note: on iOS, despite message-names being camel-case in the Policy file they must be PascalCase here

Must exactly match one of the following options:

  • InputPayload
  • OutputPayload
  • ErrorPayload

The context to which the given schema file is relevant. Note the distinction between this and the {PluginName} Must exactly the "pluginName" defined in the plugins Policy file in PascalCase