Skip to content

Commit 09cfb90

Browse files
committed
Fixed extra:analytics schema for custom providers
1 parent 5a42f9f commit 09cfb90

File tree

1 file changed

+117
-83
lines changed

1 file changed

+117
-83
lines changed

docs/schema/extra.json

Lines changed: 117 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -13,99 +13,80 @@
1313
"title": "Analytics provider",
1414
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-analytics/#google-analytics",
1515
"type": "object",
16-
"properties": {
17-
"provider": {
18-
"title": "Analytics provider",
19-
"anyOf": [
20-
{
21-
"title": "Google Analytics",
22-
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-analytics/#google-analytics",
23-
"enum": [
24-
"google"
25-
]
26-
},
27-
{
28-
"type": "string"
29-
}
30-
]
31-
},
32-
"property": {
33-
"anyOf": [
34-
{
35-
"title": "Google Analytics 4",
36-
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-analytics/#google-analytics",
37-
"pattern": "^G-\\w{10}$"
38-
},
39-
{
40-
"title": "Universal Analytics",
41-
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-analytics/#google-analytics",
42-
"pattern": "^UA-\\w{9}-\\w$"
43-
},
44-
{
45-
"title": "Unknown property",
46-
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-analytics/#google-analytics",
47-
"type": "string"
16+
"allOf": [
17+
{
18+
"if": {
19+
"properties": {
20+
"provider": {
21+
"enum": [
22+
"google"
23+
]
24+
}
4825
}
49-
]
50-
},
51-
"feedback": {
52-
"title": "Was this page helpful?",
53-
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-analytics/#was-this-page-helpful",
54-
"type": "object",
55-
"properties": {
56-
"title": {
57-
"title": "Feedback widget title",
58-
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-analytics/#was-this-page-helpful",
59-
"type": "string",
60-
"default": "Was this page helpful?"
61-
},
62-
"ratings": {
63-
"title": "Feedback ratings",
64-
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-analytics/#was-this-page-helpful",
65-
"type": "array",
66-
"items": {
67-
"title": "Feedback rating",
68-
"type": "object",
69-
"properties": {
70-
"icon": {
71-
"$ref": "#/$defs/icon"
72-
},
73-
"name": {
74-
"title": "Feedback rating name",
75-
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-analytics/#+analytics.feedback.ratings.name",
76-
"type": "string"
26+
},
27+
"then": {
28+
"properties": {
29+
"provider": {
30+
"title": "Google Analytics",
31+
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-analytics/#google-analytics",
32+
"enum": [
33+
"google"
34+
]
35+
},
36+
"property": {
37+
"anyOf": [
38+
{
39+
"title": "Google Analytics 4",
40+
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-analytics/#google-analytics",
41+
"pattern": "^G-\\w{10}$"
7742
},
78-
"data": {
79-
"title": "Feedback rating data",
80-
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-analytics/#+analytics.feedback.ratings.data",
81-
"type": "number"
43+
{
44+
"title": "Universal Analytics",
45+
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-analytics/#google-analytics",
46+
"pattern": "^UA-\\w{9}-\\w$"
8247
},
83-
"note": {
84-
"title": "Feedback rating data",
85-
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-analytics/#+analytics.feedback.ratings.note",
48+
{
49+
"title": "Unknown property",
50+
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-analytics/#google-analytics",
8651
"type": "string"
8752
}
88-
},
89-
"additionalProperties": false,
90-
"required": [
91-
"icon",
92-
"name",
93-
"data",
94-
"note"
9553
]
54+
},
55+
"feedback": {
56+
"$ref": "#/$defs/feedback"
57+
}
58+
},
59+
"required": [
60+
"provider",
61+
"property"
62+
],
63+
"additionalProperties": false
64+
}
65+
},
66+
{
67+
"if": {
68+
"properties": {
69+
"provider": {
70+
"type": "string"
9671
}
9772
}
9873
},
99-
"additionalProperties": false,
100-
"required": [
101-
"title"
102-
]
74+
"then": {
75+
"properties": {
76+
"provider": {
77+
"title": "Custom analytics provider",
78+
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-analytics/#custom-site-analytics",
79+
"type": "string"
80+
},
81+
"feedback": {
82+
"$ref": "#/$defs/feedback"
83+
}
84+
},
85+
"required": [
86+
"provider"
87+
]
88+
}
10389
}
104-
},
105-
"additionalProperties": false,
106-
"required": [
107-
"provider",
108-
"property"
10990
],
11091
"defaultSnippets": [
11192
{
@@ -406,6 +387,59 @@
406387
"type": "string"
407388
}
408389
]
390+
},
391+
"feedback": {
392+
"title": "Was this page helpful?",
393+
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-analytics/#was-this-page-helpful",
394+
"type": "object",
395+
"properties": {
396+
"title": {
397+
"title": "Feedback widget title",
398+
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-analytics/#was-this-page-helpful",
399+
"type": "string",
400+
"default": "Was this page helpful?"
401+
},
402+
"ratings": {
403+
"title": "Feedback ratings",
404+
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-analytics/#was-this-page-helpful",
405+
"type": "array",
406+
"items": {
407+
"title": "Feedback rating",
408+
"type": "object",
409+
"properties": {
410+
"icon": {
411+
"$ref": "#/$defs/icon"
412+
},
413+
"name": {
414+
"title": "Feedback rating name",
415+
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-analytics/#+analytics.feedback.ratings.name",
416+
"type": "string"
417+
},
418+
"data": {
419+
"title": "Feedback rating data",
420+
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-analytics/#+analytics.feedback.ratings.data",
421+
"type": "number"
422+
},
423+
"note": {
424+
"title": "Feedback rating data",
425+
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-analytics/#+analytics.feedback.ratings.note",
426+
"type": "string"
427+
}
428+
},
429+
"additionalProperties": false,
430+
"required": [
431+
"icon",
432+
"name",
433+
"data",
434+
"note"
435+
]
436+
}
437+
}
438+
},
439+
"additionalProperties": false,
440+
"required": [
441+
"title"
442+
]
409443
}
410444
},
411445
"defaultSnippets": [

0 commit comments

Comments
 (0)