Skip to content

Commit cd659e9

Browse files
committed
Add missing things to metadata extraction
1 parent 7472f76 commit cd659e9

File tree

1 file changed

+27
-9
lines changed

1 file changed

+27
-9
lines changed

fern/docs/pages/airdrop/metadata-extraction.mdx

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ The extraction function of the snap-in must provide a valid metadata file.
77
DevRev provides a JSON schema and a CLI tool [chef-cli](https://github.com/devrev/adaas-chef-cli)
88
to validate the proposed schema.
99

10+
## Validating metadata
11+
12+
To check the metadata for internal consistency, you should use the following command after every step:
13+
14+
```bash
15+
chef-cli validate-metadata < metadata.json
16+
```
17+
18+
This will output any problems there may be with the metadata file.
19+
1020
## Triggering event
1121

1222
Airdrop initiates the metadata extraction by starting the snap-in with a message with an event
@@ -48,7 +58,7 @@ For best results:
4858
- Use referentially consistent example data if possible
4959
- Make sure IDs are strings, not numbers
5060

51-
This generated metadata serves as a starting point that will need further refinement.
61+
This generated metadata serves as a starting point that will need further refinement. It can be used to prototype initial domain mappings (by running a sync with it) and to generate example normalized data, but it is still just a guess: It has to be reviewed and refined.
5262

5363
## Craft the metadata declaration
5464

@@ -169,6 +179,7 @@ be changed by the end user at any time, such as mandatory fields or custom field
169179
### Declare fields for each record type
170180

171181
Fields' keys must match what is actually found in the extracted data in the artifacts.
182+
Note that field keys are case-sensitive.
172183

173184
The supported types are:
174185
- `bool`
@@ -183,19 +194,22 @@ be changed by the end user at any time, such as mandatory fields or custom field
183194
- `timestamp`
184195
- `struct`
185196

197+
For a detailed explanation of these supported types, refer to the [supported types page](./supported_types.md).
198+
186199
If the external system supports custom fields, the set of custom fields in each record type
187200
you wish to extract must be declared too.
188201

189202
Enum fields' set of possible values can often be customizable.
190203
A good practice is to retrieve the set of possible values for all enum fields from the external
191-
system's APIs in each sync run.
204+
system's APIs in each sync run. You can mark specific enum values as deprecated using the `is_deprecated` property.
192205

193206
`ID` (primary key) of the record, `created_date`, and `modified_date` must not be declared.
194207

195208
Example:
196209

197210
```json
198211
{
212+
"schema_version": "v0.2.0",
199213
"record_types": {
200214
"issues_stock_epic": {
201215
"name": "Epic",
@@ -237,7 +251,8 @@ be changed by the end user at any time, such as mandatory fields or custom field
237251
"key": "P-1"
238252
},
239253
{
240-
"key": "P-2"
254+
"key": "P-2",
255+
"is_deprecated": true
241256
}
242257
]
243258
}
@@ -323,22 +338,24 @@ be changed by the end user at any time, such as mandatory fields or custom field
323338
External system fields that shouldn't be mapped in reverse should be marked as `is_read_only`.
324339
Depending on their purpose you can also mark fields as `is_indexed`, `is_identifier`, `is_filterable`,
325340
`is_write_only` etc. By default these will be set to false. You can find the full list of supported
326-
field attributes and their descriptions in the [metadata schema](./external_domain_metadata_schema.json).
341+
field attributes and their descriptions in the `external_domain_metadata_schema.json`.
327342

328343
### Configure state transitions
329344

330345
If an external record type has some concept of states, between which only certain transitions are
331346
possible (e.g., to move to the 'resolved' status, an issue first has to be 'in_testing'), you
332347
can declare these in the metadata too.
333348

334-
This will allow creation of a matching 'stage diagram' in DevRev, which enables a much simpler
335-
import and a closer preservation of the external data than mapping to DevRev's builtin stages.
349+
This will allow creation of a matching 'stage diagram' (a collection of stages and their permitted
350+
transitions) in DevRev, which enables a much simpler import and a closer preservation of the external
351+
data than mapping to DevRev's builtin stages.
336352

337353
This is especially important for two-way sync, as setting the transitions correctly ensures that
338354
the transitions a record undergoes in DevRev can be replicated in the external system.
339355

340356
To declare this in the metadata, make sure the status is represented as an enum field, and then
341-
declare the allowed transitions:
357+
declare the allowed transitions (which you might have to retrieve from an API at runtime, if they
358+
are also customized):
342359

343360
```json
344361
{
@@ -409,8 +426,9 @@ be changed by the end user at any time, such as mandatory fields or custom field
409426

410427
In the above example:
411428
- The status field is the controlling field of the stage diagram
412-
- If a status field has no explicit transitions but you still want a stage diagram, set `all_transitions_allowed` to `true`
429+
- If a status field has no explicit transitions but you still want a stage diagram, set `all_transitions_allowed` to `true`, which will create a diagram where all the defined stages can transition to each other
413430
- External systems may categorize statuses (like Jira's status categories), which can be included in the diagram metadata (`states` in the example)
414-
- The `starting_stage` defines the initial stage for new object instances
431+
- The `starting_stage` defines the initial stage for new object instances. This data should always be provided if available, otherwise the starting stage will be selected alphabetically
415432
- In current metadata format (v0.2.0), the order and human-readable name are taken from the enum values defined on the controlling field
433+
- If the `states` field is not provided, default DevRev states will be used: `open`, `in_progress` and `closed`
416434
</Steps>

0 commit comments

Comments
 (0)