Skip to content

Commit b3f82ab

Browse files
committed
feat: add JSON schema for json dictionaries
1 parent df3a7e6 commit b3f82ab

146 files changed

Lines changed: 311 additions & 25 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/website/public/schema.json

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "DeclarationContent.schema.json",
4+
"title": "DeclarationContent",
5+
"description": "JSON Schema for DeclarationContent<T = undefined>. Because JSON cannot represent functions or promises, we handle them (and TypedNode) via placeholders or string descriptions.",
6+
"type": "object",
7+
"properties": {
8+
"key": {
9+
"type": "string"
10+
},
11+
"title": {
12+
"type": "string"
13+
},
14+
"description": {
15+
"type": "string"
16+
},
17+
"version": {
18+
"type": "string"
19+
},
20+
"filePath": {
21+
"type": "string"
22+
},
23+
"tags": {
24+
"type": "array",
25+
"items": {
26+
"type": "string"
27+
}
28+
},
29+
"content": {
30+
"type": "object",
31+
"description": "Represents Record<string, ContentValue | ContentValue[]>",
32+
"additionalProperties": {
33+
"anyOf": [
34+
{
35+
"type": "string",
36+
"description": "Represents a simple string or a placeholder for a function/promise if used that way."
37+
},
38+
{
39+
"type": "array",
40+
"description": "Array variant for either string[] or number[] or array of placeholders.",
41+
"items": {
42+
"anyOf": [
43+
{
44+
"type": "string",
45+
"description": "String array item."
46+
},
47+
{
48+
"type": "number",
49+
"description": "Number array item."
50+
},
51+
{
52+
"type": "object",
53+
"description": "Nested object or typed node within an array.",
54+
"additionalProperties": {
55+
"$ref": "#/definitions/contentValue"
56+
}
57+
}
58+
]
59+
}
60+
},
61+
{
62+
"type": "number",
63+
"description": "Represents a simple numeric value."
64+
},
65+
{
66+
"type": "object",
67+
"description": "Represents { [key: string]: ContentValue }, or a nested structure, or a typed node. This is where recursion happens.",
68+
"additionalProperties": {
69+
"$ref": "#/definitions/contentValue"
70+
}
71+
}
72+
]
73+
}
74+
}
75+
},
76+
"required": ["key", "content"],
77+
"additionalProperties": false,
78+
79+
"definitions": {
80+
"contentValue": {
81+
"anyOf": [
82+
{
83+
"type": "string",
84+
"description": "Represents a string or a placeholder for function/promise/TypedNode."
85+
},
86+
{
87+
"type": "number"
88+
},
89+
{
90+
"type": "array",
91+
"items": {
92+
"anyOf": [
93+
{
94+
"type": "string"
95+
},
96+
{
97+
"type": "number"
98+
},
99+
{
100+
"type": "object",
101+
"additionalProperties": {
102+
"$ref": "#/definitions/contentValue"
103+
}
104+
}
105+
]
106+
}
107+
},
108+
{
109+
"type": "object",
110+
"description": "Nested object or typed node structure. Could also be a placeholder for a deeper typed node.",
111+
"additionalProperties": {
112+
"$ref": "#/definitions/contentValue"
113+
}
114+
}
115+
]
116+
}
117+
}
118+
}

blog/ar/intlayer_with_next-i18next.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ module.exports = {
236236

237237
```json fileName="**/*.content.json" contentDeclarationFormat="json"
238238
{
239+
"$schema": "https://intlayer.org/schema.json",
239240
"key": "my-content",
240241
"content": {
241242
"myTranslatedContent": {
@@ -345,4 +346,4 @@ const IndexPage = () => {
345346
</div>
346347
);
347348
};
348-
```
349+
```

blog/ar/intlayer_with_next-intl.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ module.exports = {
196196

197197
```json fileName="**/*.content.json" contentDeclarationFormat="json"
198198
{
199+
"$schema": "https://intlayer.org/schema.json",
199200
"key": "my-component",
200201
"content": {
201202
"helloWorld": {
@@ -372,4 +373,4 @@ export default function MyComponent() {
372373
}
373374
```
374375

375-
**هذا كل شيء!** كلما قمت بتحديث أو إضافة ملفات إعلان محتوى جديدة من Intlayer، أعد تشغيل أمر `intlayer build` لإعادة توليد رسائل JSON الخاصة بك لـ next-intl. ستقوم next-intl بالتقاط المحتوى المحدث تلقائياً.
376+
**هذا كل شيء!** كلما قمت بتحديث أو إضافة ملفات إعلان محتوى جديدة من Intlayer، أعد تشغيل أمر `intlayer build` لإعادة توليد رسائل JSON الخاصة بك لـ next-intl. ستقوم next-intl بالتقاط المحتوى المحدث تلقائياً.

blog/de/intlayer_with_next-i18next.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ module.exports = {
236236

237237
```json fileName="**/*.content.json" contentDeclarationFormat="json"
238238
{
239+
"$schema": "https://intlayer.org/schema.json",
239240
"key": "my-content",
240241
"content": {
241242
"myTranslatedContent": {
@@ -345,4 +346,4 @@ const IndexPage = () => {
345346
</div>
346347
);
347348
};
348-
```
349+
```

blog/de/intlayer_with_next-intl.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ module.exports = {
196196

197197
```json fileName="**/*.content.json" contentDeclarationFormat="json"
198198
{
199+
"$schema": "https://intlayer.org/schema.json",
199200
"key": "my-component",
200201
"content": {
201202
"helloWorld": {
@@ -372,4 +373,4 @@ export default function MyComponent() {
372373
}
373374
```
374375

375-
**Das war's!** Jedes Mal, wenn Sie Intlayer-Inhaltsdeklarationsdateien aktualisieren oder hinzufügen, führen Sie den Befehl `intlayer build` erneut aus, um Ihre next-intl JSON-Nachrichten neu zu generieren. next-intl wird den aktualisierten Inhalt automatisch erkennen.
376+
**Das war's!** Jedes Mal, wenn Sie Intlayer-Inhaltsdeklarationsdateien aktualisieren oder hinzufügen, führen Sie den Befehl `intlayer build` erneut aus, um Ihre next-intl JSON-Nachrichten neu zu generieren. next-intl wird den aktualisierten Inhalt automatisch erkennen.

blog/en-GB/intlayer_with_next-i18next.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ module.exports = {
232232

233233
```json fileName="**/*.content.json" contentDeclarationFormat="json"
234234
{
235+
"$schema": "https://intlayer.org/schema.json",
235236
"key": "my-content",
236237
"content": {
237238
"myTranslatedContent": {
@@ -341,4 +342,4 @@ const IndexPage = () => {
341342
</div>
342343
);
343344
};
344-
```
345+
```

blog/en-GB/intlayer_with_next-intl.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ module.exports = {
196196

197197
```json fileName="**/*.content.json" contentDeclarationFormat="json"
198198
{
199+
"$schema": "https://intlayer.org/schema.json",
199200
"key": "my-component",
200201
"content": {
201202
"helloWorld": {
@@ -372,4 +373,4 @@ export default function MyComponent() {
372373
}
373374
```
374375

375-
**That’s it!** Whenever you update or add new Intlayer content declaration files, re-run the `intlayer build` command to regenerate your next-intl JSON messages. next-intl will pick up the updated content automatically.
376+
**That’s it!** Whenever you update or add new Intlayer content declaration files, re-run the `intlayer build` command to regenerate your next-intl JSON messages. next-intl will pick up the updated content automatically.

blog/en/intlayer_with_next-i18next.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ module.exports = {
236236

237237
```json fileName="**/*.content.json" contentDeclarationFormat="json"
238238
{
239+
"$schema": "https://intlayer.org/schema.json",
239240
"key": "my-content",
240241
"content": {
241242
"myTranslatedContent": {

blog/en/intlayer_with_next-intl.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ module.exports = {
196196

197197
```json fileName="**/*.content.json" contentDeclarationFormat="json"
198198
{
199+
"$schema": "https://intlayer.org/schema.json",
199200
"key": "my-component",
200201
"content": {
201202
"helloWorld": {

blog/es/intlayer_with_next-i18next.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ module.exports = {
236236

237237
```json fileName="**/*.content.json" contentDeclarationFormat="json"
238238
{
239+
"$schema": "https://intlayer.org/schema.json",
239240
"key": "my-content",
240241
"content": {
241242
"myTranslatedContent": {
@@ -345,4 +346,4 @@ const IndexPage = () => {
345346
</div>
346347
);
347348
};
348-
```
349+
```

0 commit comments

Comments
 (0)