Skip to content

Commit 4c6477d

Browse files
authored
docs: add filtering documentation and enhance Object Customization guide (#236)
- Explain DevRev object and leaf_type. - Add a section on filtering. - Remove the beta warning at the top. The process to make the APIs public is in progress, and we'll anyways not break the beta APIs. - Fix headers. The Accept header is redundant, and Content-Type is mandatory. - Remove redundant uses of "Let's say..." while maintaining the educational tone.
1 parent dcbf4d9 commit 4c6477d

File tree

1 file changed

+77
-41
lines changed

1 file changed

+77
-41
lines changed

fern/docs/pages/customization.mdx

Lines changed: 77 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
1-
<Callout intent="warning">
2-
This functionality is in Beta. It is not recommended for use in production applications.
3-
</Callout>
4-
51
DevRev allows you to customize its core objects such as _issue_ and _ticket_ to fit
62
your organization's unique workflows and reporting needs. By using the customization
73
framework, you can extend these objects with custom fields that reflect your processes.
84

9-
This guide provides an overview of the customization framework and walks you through the process of tracking bugs in your organization. By the end of this guide, you'll be able to:
10-
1. Customize DevRev objects such as _issue_ and _ticket_.
5+
This section provides an overview of the customization framework and walks you through the
6+
process of tracking bugs in your organization. By the end of this section, you'll be able
7+
to:
8+
1. Customize DevRev objects such as _issue_ and _ticket_ by adding custom fields.
9+
1. Override default field settings of DevRev objects.
1110
1. Create custom stages and stage transition diagrams for your objects.
1211
1. Create dependent fields for your objects.
1312

1413
## Concepts
1514

15+
### DevRev object
16+
17+
DevRev objects are the core entities that represent real-world items such as issues,
18+
tickets, and incidents. Each object type has a set of fields that describe the object.
19+
20+
<Callout intent="tip">
21+
When you encounter `leaf_type` in the documentation or API, it refers to the type of DevRev
22+
object you're working with, such as an _issue_ or _ticket_.
23+
</Callout>
24+
1625
### Schema fragment
1726

1827
DevRev objects are customized using _schema fragments_. A fragment is a building block
@@ -40,7 +49,10 @@ Subtypes are defined using a schema fragment of type `custom_type_fragment`.
4049

4150
## Customizing a DevRev object
4251
<Callout intent="note">
43-
Let's say you want to track bugs across various environments in your organization.
52+
Your team needs to track software bugs. You want to know:
53+
- Which environments are affected (development, testing, production)
54+
- Whether it's a regression (a bug in previously working code)
55+
- The root cause analysis (RCA) of the bug
4456
</Callout>
4557

4658
First, create a schema fragment defining the fields for the _bug_ subtype.
@@ -49,7 +61,6 @@ Make sure to replace `<TOKEN>` with your API token.
4961
```curl
5062
curl --location 'https://api.devrev.ai/schemas.custom.set' \
5163
--header 'Content-Type: application/json' \
52-
--header 'Accept: application/json' \
5364
--header 'Authorization: <TOKEN>' \
5465
--data '{
5566
"type": "custom_type_fragment",
@@ -58,13 +69,6 @@ curl --location 'https://api.devrev.ai/schemas.custom.set' \
5869
"subtype": "bug",
5970
"subtype_display_name": "Bug",
6071
"fields": [
61-
{
62-
"name": "regression",
63-
"field_type": "bool",
64-
"ui": {
65-
"display_name": "Regression",
66-
}
67-
},
6872
{
6973
"name": "impacted_environments",
7074
"field_type": "array",
@@ -75,6 +79,13 @@ curl --location 'https://api.devrev.ai/schemas.custom.set' \
7579
"display_name": "Impacted Environments",
7680
}
7781
},
82+
{
83+
"name": "regression",
84+
"field_type": "bool",
85+
"ui": {
86+
"display_name": "Regression",
87+
}
88+
},
7889
{
7990
"name": "rca",
8091
"field_type": "rich_text",
@@ -87,15 +98,13 @@ curl --location 'https://api.devrev.ai/schemas.custom.set' \
8798
```
8899

89100
<Callout intent="note">
90-
Let's say a bug has been identified in the Prod environment. The person who reported the
91-
anomaly creates a _bug_-flavored _issue_ object to track it and assigns a relevant
92-
owner.
101+
A bug has been identified in the production environment. The reporter creates a
102+
_bug_-flavored _issue_ object to track it and assigns a relevant owner.
93103
</Callout>
94104

95105
```curl {11-17}
96106
curl --location 'https://api.devrev.ai/works.create' \
97107
--header 'Content-Type: application/json' \
98-
--header 'Accept: application/json' \
99108
--header 'Authorization: <TOKEN>' \
100109
--data '{
101110
"type": "issue",
@@ -108,8 +117,8 @@ curl --location 'https://api.devrev.ai/works.create' \
108117
"subtype": "bug"
109118
},
110119
"custom_fields": {
120+
"ctype__impacted_environments": [ "QA", "Prod" ]
111121
"ctype__regression": true,
112-
"ctype__impacted_environments": [ "Prod" ]
113122
}
114123
}'
115124
```
@@ -129,7 +138,6 @@ a subtype-specific field.
129138
```curl
130139
curl --location 'https://api.devrev.ai/schemas.custom.set' \
131140
--header 'Content-Type: application/json' \
132-
--header 'Accept: application/json' \
133141
--header 'Authorization: <TOKEN>' \
134142
--data '{
135143
"type": "tenant_fragment",
@@ -152,7 +160,6 @@ Populate the release notes in the issue object created above:
152160
```curl {8-13}
153161
curl --location 'https://api.devrev.ai/works.update' \
154162
--header 'Content-Type: application/json' \
155-
--header 'Accept: application/json' \
156163
--header 'Authorization: <TOKEN>' \
157164
--data '{
158165
"id": "don:core:dvrv-us-1:devo/test:issue/1",
@@ -195,7 +202,9 @@ The following observations can be made from the above example:
195202
- Subtype fields are of the form `ctype__<field_name>`.
196203
- Tenant fields are of the form `tnt__<field_name>`.
197204
* References to each fragment are stored with the object.
198-
* When updating an object, the `custom_schema_spec` can specify only the fragments being modified. Here, only the tenant fragment is specified as only the release notes field is being updated.
205+
* When updating an object, the `custom_schema_spec` can specify only the fragments being
206+
modified. Here, only the tenant fragment is specified as only the release notes field
207+
is being updated.
199208

200209
## Supported custom field types
201210

@@ -214,8 +223,37 @@ The following custom field types are supported -
214223
| date | `"2020-10-20"` (YYYY-MM-DD) |
215224
| id | `"don:core:dvrv-us-1:devo/test:issue/1"` |
216225

217-
The list variants of all the supported custom field types are also supported. For
218-
example, `[]int`, `[]tokens`, etc.
226+
The list variants of all the supported custom field types are also supported.
227+
In the example above, the `impacted_environments` field is a list of enum values.
228+
229+
## Filtering DevRev objects
230+
231+
<Callout intent="note">
232+
To demonstrate filtering capabilities, consider finding all bugs in the production
233+
environment that had a customer impact.
234+
</Callout>
235+
236+
This translates to filtering _issue_ objects with subtype _bug_, _customer_impact_ set
237+
to `true` and _impacted_environments_ containing `"Prod"`.
238+
239+
```curl
240+
curl --location 'https://api.devrev.ai/works.list' \
241+
--header 'Content-Type: application/json' \
242+
--header 'Authorization: <TOKEN>' \
243+
--data '{
244+
"type": [ "issue" ],
245+
"issue": {
246+
"subtype": [ "bug" ]
247+
},
248+
"custom_fields": {
249+
"ctype__customer_impact": [ true ],
250+
"ctype__impacted_environments": [ "Prod" ]
251+
}
252+
}'
253+
```
254+
255+
Note that both _customer_impact_ and _impacted_environments_ are filterable fields,
256+
marked with `is_filterable: true` above.
219257

220258
## Schema fragment versioning
221259

@@ -228,7 +266,7 @@ The same API endpoint `schemas.custom.set` is used to create and update fragment
228266
API internally figures out how to version and chain the fragments.
229267

230268
<Callout intent="note">
231-
Let's say you want to add a new boolean field _customer_impact_ to the _bug_ subtype
269+
You want to add a new boolean field _customer_impact_ to the _bug_ subtype
232270
and delete the _regression_ field.
233271
</Callout>
234272

@@ -237,7 +275,6 @@ and delete the _regression_ field.
237275
```curl {28-36}
238276
curl --location 'https://api.devrev.ai/schemas.custom.set' \
239277
--header 'Content-Type: application/json' \
240-
--header 'Accept: application/json' \
241278
--header 'Authorization: <TOKEN>' \
242279
--data '{
243280
"type": "custom_type_fragment",
@@ -265,6 +302,7 @@ curl --location 'https://api.devrev.ai/schemas.custom.set' \
265302
{
266303
"name": "customer_impact",
267304
"field_type": "bool",
305+
"is_filterable": true,
268306
"ui": {
269307
"display_name": "Customer Impact",
270308
}
@@ -276,7 +314,9 @@ curl --location 'https://api.devrev.ai/schemas.custom.set' \
276314

277315
Note that:
278316
* The API payload reflects the entire state of the new fragment version.
279-
* The `deleted_fields` array specifies the field names that are being deleted. If not provided, the API call fails due to the lack of an explicit field deletion confirmation. This prevents accidental field deletions.
317+
* The `deleted_fields` array specifies the field names that are being deleted. If not
318+
provided, the API call fails due to the lack of an explicit field deletion
319+
confirmation. This prevents accidental field deletions.
280320

281321
The above API call internally performs the following steps:
282322
1. Creates a new fragment with the specified payload.
@@ -318,7 +358,7 @@ _regression_ field is dropped in the response.
318358

319359
```curl {16-18, 21}
320360
curl --location 'https://api.devrev.ai/works.get' \
321-
--header 'Accept: application/json' \
361+
--header 'Content-Type: application/json' \
322362
--header 'Authorization: <TOKEN>' \
323363
--data '{
324364
"id": "don:core:dvrv-us-1:devo/test:issue/2"
@@ -373,7 +413,7 @@ organization:
373413

374414
```curl
375415
curl --location 'https://api.devrev.ai/schemas.custom.list' \
376-
--header 'Accept: application/json' \
416+
--header 'Content-Type: application/json' \
377417
--header 'Authorization: <TOKEN>'
378418
```
379419

@@ -391,7 +431,8 @@ hints:
391431
* `is_sortable`: Whether the field is sortable. Requires `is_filterable` to be true.
392432
* `is_groupable`: Whether the field is groupable. Requires `is_filterable` to be true.
393433
* `order`: The order in which the field appears in the side panel.
394-
* `group_name`: The group title under which field(s) appear in the side panel. In the example below, the fields are grouped under groups titled **Group 1** and **Group 2**.
434+
* `group_name`: The group title under which field(s) appear in the side panel. In the
435+
example below, the fields are grouped under groups titled **Group 1** and **Group 2**.
395436

396437
![customization-group_name-ui-hint](../img/customization-group_name-ui-hint.png)
397438

@@ -405,7 +446,7 @@ The fields available in native DevRev objects are called stock fields. For examp
405446
`priority` is a stock field of _issue_.
406447

407448
<Callout intent="note">
408-
Let's say you want to do the following modifications to the priority field in your organization:
449+
You want to do the following modifications to the priority field in your organization:
409450

410451
1. Update the UI display name from _Priority_ to _Urgency Level_.
411452
1. Update the allowed values from _P0_, _P1_, _P2_, and _P3_ to _Low_, _Medium_, _High_, and _Blocker_.
@@ -417,7 +458,6 @@ fragment with the following payload:
417458
```curl
418459
curl --location 'https://api.devrev.ai/internal/schemas.custom.set' \
419460
--header 'Content-Type: application/json' \
420-
--header 'Accept: application/json' \
421461
--header 'Authorization: <TOKEN>' \
422462
--data '{
423463
"type": "tenant_fragment",
@@ -492,15 +532,14 @@ _backlog_, and _prioritized_ stages. By default, DevRev creates _open_, _in_prog
492532
and _closed_ states in your organization.
493533

494534
<Callout intent="note">
495-
Let's say you want to add a new stage _Needs RCA_ to the _bug_ subtype.
535+
You want to add a new stage _Needs RCA_ to the _bug_ subtype.
496536
</Callout>
497537

498538
### Adding a custom stage
499539

500540
```curl
501541
curl --location 'https://api.devrev.ai/stages.custom.create' \
502542
--header 'Content-Type: application/json' \
503-
--header 'Accept: application/json' \
504543
--header 'Authorization: <TOKEN>' \
505544
--data '{
506545
"name": "Needs RCA",
@@ -542,7 +581,6 @@ backl --> dev --> rca --> compl
542581
```curl {11}
543582
curl --location 'https://api.devrev.ai/stage-diagrams.create' \
544583
--header 'Content-Type: application/json' \
545-
--header 'Accept: application/json' \
546584
--header 'Authorization: <TOKEN>' \
547585
--data '{
548586
"leaf_type": "issue",
@@ -591,7 +629,6 @@ The stage diagram created above can be referenced in the _bug_ subtype as follow
591629
```curl {9}
592630
curl --location 'https://api.devrev.ai/schemas.custom.set' \
593631
--header 'Content-Type: application/json' \
594-
--header 'Accept: application/json' \
595632
--header 'Authorization: <TOKEN>' \
596633
--data '{
597634
"type": "custom_type_fragment",
@@ -609,15 +646,14 @@ All objects of the _bug_ subtype now adhere to the stage diagram created above.
609646
## Dependent fields
610647

611648
<Callout intent="note">
612-
Let's say that the developers in your organization tend to forget to add an RCA when
613-
resolving the bugs. You can make the _RCA_ field required when a _bug_ object is moved
614-
to the _completed_ stage by adding a dependent field constraint.
649+
The developers in your organization tend to forget to add an RCA when resolving the
650+
bugs. You can make the _RCA_ field required when a _bug_ object is moved to the
651+
_completed_ stage by adding a dependent field constraint.
615652
</Callout>
616653

617654
```curl {12-22}
618655
curl --location 'https://api.devrev.ai/schemas.custom.set' \
619656
--header 'Content-Type: application/json' \
620-
--header 'Accept: application/json' \
621657
--header 'Authorization: <TOKEN>' \
622658
--data '{
623659
"type": "custom_type_fragment",

0 commit comments

Comments
 (0)