Skip to content

Commit 4afb41a

Browse files
authored
Update Lexicon create schema reference (#2140)
* add cohorts sections to Lexicon * update upload schemas * update reference * update yaml * update json example * fix
1 parent 8fd16ef commit 4afb41a

File tree

3 files changed

+120
-231
lines changed

3 files changed

+120
-231
lines changed

openapi/src/lexicon-schemas.openapi.yaml

Lines changed: 11 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -183,117 +183,7 @@ paths:
183183
summary: Create/Replace One
184184
tags:
185185
- Create Schemas
186-
description: >-
187-
Upload a schema for a single entity. If a schema already exists for a
188-
specified entity, it will be replaced by the one you upload.
189-
190-
[block:callout] {
191-
"type": "warning",
192-
"title": "Metadata merging behavior",
193-
"body": "If the new schema is missing `metadata` properties that are currently set in the existing schema for that entity, those properties will be merged into the new schema. For example, if your current schema has `{\"metadata\": {\"com.mixpanel\": {\"hidden\": true}}}` and you upload a new schema without \"hidden\", we will merge `\"hidden\": true` to your uploaded schema's metadata. If you want to remove that property, set the value to `null`."
194-
} [/block]
195-
196-
[block:callout] {
197-
"type": "info",
198-
"title": "Adding a schema for User Profiles",
199-
"body": "To add a schema for your [User Profiles](https://help.mixpanel.com/hc/en-us/articles/115004501966-User-Profiles), specify the `entityType` as `profile` and the `name` as `$user`."
200-
} [/block]
201-
202-
### Example POST Body
203-
204-
```json
205-
206-
{
207-
"$schema": "http://json-schema.org/draft-07/schema",
208-
"description": "Tracked when a user adds an item to their cart.",
209-
"required": [
210-
"item_name",
211-
"item_id",
212-
"item_price"
213-
],
214-
"additionalProperties": true,
215-
"metadata": {
216-
"com.mixpanel": {
217-
"tags": [
218-
"Shopping",
219-
"KPIs"
220-
],
221-
"displayName": "Item Purchased",
222-
"hidden": false,
223-
"dropped": false,
224-
"owners": [
225-
{
226-
"name": "First Last",
227-
"email": "[email protected]"
228-
}
229-
]
230-
}
231-
},
232-
"properties": {
233-
"item_name": {
234-
"type": "string",
235-
"description": "The name of the item",
236-
"examples": [
237-
"Blue Widget"
238-
],
239-
"metadata": {
240-
"com.mixpanel": {
241-
"displayName": "Item Name"
242-
}
243-
}
244-
},
245-
"item_id": {
246-
"type": "integer",
247-
"description": "The internal id of the item",
248-
"examples": [
249-
12345
250-
],
251-
"metadata": {
252-
"com.mixpanel": {
253-
"displayName": "Item ID"
254-
}
255-
}
256-
},
257-
"item_price": {
258-
"type": "number",
259-
"description": "The current price of the item",
260-
"examples": [
261-
25.35
262-
],
263-
"metadata": {
264-
"com.mixpanel": {
265-
"displayName": "Price"
266-
}
267-
}
268-
},
269-
"promo_id": {
270-
"type": "integer",
271-
"description": "The id of any promo in progress for this item",
272-
"examples": [
273-
82523,
274-
18382
275-
],
276-
"metadata": {
277-
"com.mixpanel": {
278-
"displayName": "Promo ID"
279-
}
280-
}
281-
},
282-
"date_added_to_catalog": {
283-
"type": "string",
284-
"format": "date-time",
285-
"description": "The date this item was added to the store catalog",
286-
"examples": [
287-
"2015-03-05T15:25:23"
288-
],
289-
"metadata": {
290-
"com.mixpanel": {
291-
"displayName": "Date Added"
292-
}
293-
}
294-
}
295-
}
296-
} ```
186+
description: ""
297187
requestBody:
298188
content:
299189
application/json:
@@ -410,20 +300,21 @@ components:
410300
[Events only] If true, the event will be dropped at
411301
ingestion time.
412302
default: false
413-
owners:
303+
contacts:
414304
type: array
415305
description: >-
416-
A list of people or teams that are responsible for this
306+
A list of emails belonging to users responsible for this
417307
entity.
418308
items:
419-
type: object
420-
properties:
421-
name:
422-
type: string
423-
email:
424-
type: string
425-
format: email
309+
type: string
426310
additionalProperties: false
311+
teamContacts:
312+
type: array
313+
description: >-
314+
A list of team names responsible for this
315+
entity.
316+
items:
317+
type: string
427318
additionalProperties: false
428319
SchemaEntry:
429320
type: object

reference/Lexicon Schemas API/create-schemas/upload-schema-by-entity-and-name.md

Lines changed: 104 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -3,118 +3,116 @@ title: Create/Replace One
33
category:
44
uri: Lexicon Schemas API
55
content:
6-
excerpt: >-
7-
Upload a schema for a single entity. If a schema already exists for a
8-
specified entity, it will be replaced by the one you upload.
6+
excerpt: ''
7+
privacy:
8+
view: public
9+
---
10+
Upload a schema for a single entity. If a schema already exists for a specified entity, it will be replaced by the one you upload.
11+
12+
<Callout icon="🚧" theme="warn">
13+
Metadata merging behavior
914

10-
[block:callout] {
11-
"type": "warning",
12-
"title": "Metadata merging behavior",
13-
"body": "If the new schema is missing `metadata` properties that are currently set in the existing schema for that entity, those properties will be merged into the new schema. For example, if your current schema has `{\"metadata\": {\"com.mixpanel\": {\"hidden\": true}}}` and you upload a new schema without \"hidden\", we will merge `\"hidden\": true` to your uploaded schema's metadata. If you want to remove that property, set the value to `null`."
14-
} [/block]
15+
If the new schema is missing `metadata` properties that are currently set in the existing schema for that entity, those properties will be merged into the new schema. For example, if your current schema has `{"metadata": {"com.mixpanel": {"hidden": true}}}` and you upload a new schema without "hidden", we will merge `"hidden": true` to your uploaded schema's metadata. If you want to remove that property, set the value to `null`.
16+
</Callout>
1517

16-
[block:callout] {
17-
"type": "info",
18-
"title": "Adding a schema for User Profiles",
19-
"body": "To add a schema for your [User Profiles](https://help.mixpanel.com/hc/en-us/articles/115004501966-User-Profiles), specify the `entityType` as `profile` and the `name` as `$user`."
20-
} [/block]
18+
<Callout icon="📘" theme="info">
19+
Adding a schema for User Profiles
2120

22-
### Example POST Body
21+
To add a schema for your [User Profiles](https://help.mixpanel.com/hc/en-us/articles/115004501966-User-Profiles), specify the `entityType` as `profile` and the `name` as `$user`.
22+
</Callout>
2323

24-
```json
24+
### Example POST Body
2525

26-
{
27-
"$schema": "http://json-schema.org/draft-07/schema",
28-
"description": "Tracked when a user adds an item to their cart.",
29-
"required": [
30-
"item_name",
31-
"item_id",
32-
"item_price"
33-
],
34-
"additionalProperties": true,
35-
"metadata": {
36-
"com.mixpanel": {
37-
"tags": [
38-
"Shopping",
39-
"KPIs"
40-
],
41-
"displayName": "Item Purchased",
42-
"hidden": false,
43-
"dropped": false,
44-
"owners": [
45-
{
46-
"name": "First Last",
47-
"email": "[email protected]"
48-
}
49-
]
26+
```json
27+
{
28+
"$schema": "http://json-schema.org/draft-07/schema",
29+
"description": "Tracked when a user adds an item to their cart.",
30+
"required": [
31+
"item_name",
32+
"item_id",
33+
"item_price"
34+
],
35+
"additionalProperties": true,
36+
"metadata": {
37+
"com.mixpanel": {
38+
"tags": [
39+
"Shopping",
40+
"KPIs"
41+
],
42+
"displayName": "Item Purchased",
43+
"hidden": false,
44+
"dropped": false,
45+
"contacts": [
46+
47+
],
48+
"teamContacts": [
49+
"Analytics Team"
50+
]
51+
}
52+
},
53+
"properties": {
54+
"item_name": {
55+
"type": "string",
56+
"description": "The name of the item",
57+
"examples": [
58+
"Blue Widget"
59+
],
60+
"metadata": {
61+
"com.mixpanel": {
62+
"displayName": "Item Name"
63+
}
64+
}
65+
},
66+
"item_id": {
67+
"type": "integer",
68+
"description": "The internal id of the item",
69+
"examples": [
70+
12345
71+
],
72+
"metadata": {
73+
"com.mixpanel": {
74+
"displayName": "Item ID"
75+
}
5076
}
5177
},
52-
"properties": {
53-
"item_name": {
54-
"type": "string",
55-
"description": "The name of the item",
56-
"examples": [
57-
"Blue Widget"
58-
],
59-
"metadata": {
60-
"com.mixpanel": {
61-
"displayName": "Item Name"
62-
}
63-
}
64-
},
65-
"item_id": {
66-
"type": "integer",
67-
"description": "The internal id of the item",
68-
"examples": [
69-
12345
70-
],
71-
"metadata": {
72-
"com.mixpanel": {
73-
"displayName": "Item ID"
74-
}
75-
}
76-
},
77-
"item_price": {
78-
"type": "number",
79-
"description": "The current price of the item",
80-
"examples": [
81-
25.35
82-
],
83-
"metadata": {
84-
"com.mixpanel": {
85-
"displayName": "Price"
86-
}
87-
}
88-
},
89-
"promo_id": {
90-
"type": "integer",
91-
"description": "The id of any promo in progress for this item",
92-
"examples": [
93-
82523,
94-
18382
95-
],
96-
"metadata": {
97-
"com.mixpanel": {
98-
"displayName": "Promo ID"
99-
}
100-
}
101-
},
102-
"date_added_to_catalog": {
103-
"type": "string",
104-
"format": "date-time",
105-
"description": "The date this item was added to the store catalog",
106-
"examples": [
107-
"2015-03-05T15:25:23"
108-
],
109-
"metadata": {
110-
"com.mixpanel": {
111-
"displayName": "Date Added"
112-
}
113-
}
78+
"item_price": {
79+
"type": "number",
80+
"description": "The current price of the item",
81+
"examples": [
82+
25.35
83+
],
84+
"metadata": {
85+
"com.mixpanel": {
86+
"displayName": "Price"
87+
}
88+
}
89+
},
90+
"promo_id": {
91+
"type": "integer",
92+
"description": "The id of any promo in progress for this item",
93+
"examples": [
94+
82523,
95+
18382
96+
],
97+
"metadata": {
98+
"com.mixpanel": {
99+
"displayName": "Promo ID"
100+
}
101+
}
102+
},
103+
"date_added_to_catalog": {
104+
"type": "string",
105+
"format": "date-time",
106+
"description": "The date this item was added to the store catalog",
107+
"examples": [
108+
"2015-03-05T15:25:23"
109+
],
110+
"metadata": {
111+
"com.mixpanel": {
112+
"displayName": "Date Added"
113+
}
114114
}
115115
}
116-
} ```
117-
privacy:
118-
view: public
119-
---
120-
116+
}
117+
}
118+
```

reference/Lexicon Schemas API/create-schemas/upload-schemas-for-project.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ Upload schemas in bulk to the specified project. If a schema already exists for
4747
"displayName": "Item Purchased",
4848
"hidden": false,
4949
"dropped": false,
50-
"owners": [
51-
{
52-
"name": "First Last",
53-
"email": "[email protected]"
54-
}
50+
"contacts": [
51+
52+
],
53+
"teamContacts": [
54+
"Analytics Team"
5555
]
5656
}
5757
},

0 commit comments

Comments
 (0)