Unity · Arazzo Workflow

Unity Analytics Validate and Record

Version 1.0.0

Validate an analytics event batch against the schema, then record it only when validation passes.

1 workflow 1 source API 1 provider
View Spec View on GitHub Game DevelopmentReal-Time 3DMultiplayerGame ServicesCloud GamingArazzoWorkflows

Provider

unity

Workflows

analytics-validate-and-record
Validate an event batch and record it only if valid.
Validates a batch of analytics events, then records them when the first event reports valid, otherwise ends without recording.
2 steps inputs: apiKey, eventName, eventTimestamp, eventUuid, eventVersion, installationUuid, parameters, projectId, sessionUuid outputs: validationResults
1
validate
validateEvents
Validate the analytics event batch against the project's schemas without recording it.
2
record
recordEvents
Record the validated analytics event batch for real.

Source API Descriptions

Arazzo Workflow Specification

unity-analytics-validate-and-record-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Unity Analytics Validate and Record
  summary: Validate an analytics event batch against the schema, then record it only when validation passes.
  description: >-
    A safe ingestion pattern for Unity Analytics. The workflow first validates a
    batch of analytics events against the project's event schemas without
    recording them, branches on whether the batch is valid, and records the
    events for real only when validation succeeds. Analytics ingestion is
    authenticated with an x-api-key header, supplied inline on each step. Every
    step spells out its request inline so the flow can be read and executed
    without opening the underlying OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: analyticsApi
  url: ../openapi/unity-analytics-openapi.yml
  type: openapi
workflows:
- workflowId: analytics-validate-and-record
  summary: Validate an event batch and record it only if valid.
  description: >-
    Validates a batch of analytics events, then records them when the first
    event reports valid, otherwise ends without recording.
  inputs:
    type: object
    required:
    - apiKey
    - projectId
    - eventName
    - eventVersion
    - eventTimestamp
    - eventUuid
    - installationUuid
    - sessionUuid
    properties:
      apiKey:
        type: string
        description: The Analytics API key sent in the x-api-key header.
      projectId:
        type: string
        description: The Unity project identifier.
      eventName:
        type: string
        description: Custom event name (for example "level_completed").
      eventVersion:
        type: string
        description: Version of the event schema.
      eventTimestamp:
        type: string
        description: ISO 8601 timestamp of when the event occurred.
      eventUuid:
        type: string
        description: Unique event identifier for deduplication.
      installationUuid:
        type: string
        description: Unique installation identifier.
      sessionUuid:
        type: string
        description: Unique session identifier.
      parameters:
        type: object
        description: Optional custom event parameters as key-value pairs.
  steps:
  - stepId: validate
    description: >-
      Validate the analytics event batch against the project's schemas without
      recording it.
    operationId: validateEvents
    parameters:
    - name: x-api-key
      in: header
      value: $inputs.apiKey
    - name: projectId
      in: path
      value: $inputs.projectId
    requestBody:
      contentType: application/json
      payload:
        events:
        - name: $inputs.eventName
          eventVersion: $inputs.eventVersion
          eventTimestamp: $inputs.eventTimestamp
          eventUuid: $inputs.eventUuid
          installationUuid: $inputs.installationUuid
          sessionUuid: $inputs.sessionUuid
          parameters: $inputs.parameters
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      validationResults: $response.body#/events
    onSuccess:
    - name: eventsValid
      type: goto
      stepId: record
      criteria:
      - context: $response.body
        condition: $.events[0].valid == true
        type: jsonpath
    - name: eventsInvalid
      type: end
      criteria:
      - context: $response.body
        condition: $.events[0].valid == false
        type: jsonpath
  - stepId: record
    description: >-
      Record the validated analytics event batch for real.
    operationId: recordEvents
    parameters:
    - name: x-api-key
      in: header
      value: $inputs.apiKey
    - name: projectId
      in: path
      value: $inputs.projectId
    requestBody:
      contentType: application/json
      payload:
        events:
        - name: $inputs.eventName
          eventVersion: $inputs.eventVersion
          eventTimestamp: $inputs.eventTimestamp
          eventUuid: $inputs.eventUuid
          installationUuid: $inputs.installationUuid
          sessionUuid: $inputs.sessionUuid
          parameters: $inputs.parameters
    successCriteria:
    - condition: $statusCode == 204
  outputs:
    validationResults: $steps.validate.outputs.validationResults