Skip to content

Data collections

Data collections are defined in .pdata.yaml (or .pdata.json) files. Every data collection:

  • Has an id, which is unique across all data collections,
  • Has a name, which is a human-readable name for the data collection,
  • Has an optional description, which is a human-readable description of the data collection,
  • Has a schema field, which contains the id of the schema that the data collection is based on,
  • Has an objects fields, which is an array of data objects.

The data collection contains data objects, which are instances of the schema that the data collection is based on.

An empty data collection in .pdata.yaml format looks like this:

yaml
id: empty-data-collection
name: Empty Data Collection
description: This is an empty data collection.
schema: id-of-existing-schema
objects: []

A more involved example

Here is a more real-world-like example of a data collection, that uses a service schema:

yaml
id: services
name: Services
description: The services of the application.
schema: Service
objects:
    - name: user-admin-service
      description: Used by admin users to manage users.
      operations:
          - name: create_user
            description: Creates a new user in the system
          - name: suspend_user
            description: Suspends a user in the system
    - name: registration-service
      description: Used by non-member (unauthenticated) users to register new accounts.
      operations:
          - name: register_user
            description: Registers a new user in the system