flow
Search…
Schemas
How to create and implement schemas
A Flow schema is a draft 2019-09 JSON Schema that validates a Flow collection. Schemas also provide annotations at document locations, such as reduction strategies for combining one document into another.
It is recommended to store schemas in a file separate from the catalog spec. This allows them to be re-used. Within a collection definition in the catalog spec, you give the schema as a relative or absolute URI. URIs can optionally include a JSON fragment pointer that locates a specific sub-schema therein.
For example, "schemas/marketing.yaml#/$defs/campaign" would reference the schema at location {"$defs": {"campaign": ...}} within ./schemas/marketing.yaml.
Here are several valid example schemas that illustrate their available fields for usage:
1
# Full URIs that point to a valid schema can be used.
2
schema: 'http://example/schema#/$defs/subPath'
3
4
# Also, relative paths
5
schema: 'path/to/schema.json'
6
7
schema:
8
# Or define them in-line, if necessary.
9
properties:
10
bar:
11
const: 42
12
foo:
13
type: integer
14
type: object
15
16
schema:
17
properties:
18
foo_count:
19
reduce:
20
# Or use reduction strategies
21
strategy: sum
22
type: integer
23
reduce:
24
strategy: merge
25
type: object
Copied!

Reductions

Flow implements a number of reduction strategies for use within schemas, which tell Flow how two instances of a document can be meaningfully combined together. Learn more about reduction strategies.
Last modified 3mo ago
Copy link
Contents
Reductions