Skip to content

Commit e6b6ec8

Browse files
committed
add more example
1 parent dab3aa3 commit e6b6ec8

File tree

6 files changed

+248
-8
lines changed

6 files changed

+248
-8
lines changed

.aider.chat.history.md

Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
2+
# aider chat started at 2025-03-04 23:12:24
3+
4+
> You can skip this check with --no-gitignore
5+
> Add .aider* to .gitignore (recommended)? (Y)es/(N)o [Yes]: n
6+
> C:\Users\manis\.local\bin\aider --model openai/o3-mini
7+
> Aider v0.75.1
8+
> Main model: openai/o3-mini with diff edit format
9+
> Weak model: gpt-4o-mini
10+
> Git repo: .git with 675 files
11+
> Repo-map: using 4096 tokens, auto refresh
12+
13+
#### /add enum.m
14+
> No files matched 'enum.m'. Do you want to create C:\Users\manis\Desktop\json-schema\website\enum.m? (Y)es/(N)o [Yes]: n
15+
16+
#### /add pages\understanding-json-schema\reference\enum.md
17+
> Added pages\understanding-json-schema\reference\enum.md to the chat
18+
19+
#### Instead of replacing one example with another, I suggest adding your example to the document. Please provide an introductory statement to your example. and better this doc
20+
> Initial repo scan can be slow in larger repos, but only happens once.
21+
> Repo-map can't include C:\Users\manis\Desktop\json-schema\website\_includes\community
22+
> Has it been deleted from the file system but not from git?
23+
> Repo-map can't include C:\Users\manis\Desktop\json-schema\website\_includes\dot-github
24+
> Has it been deleted from the file system but not from git?
25+
> Repo-map can't include C:\Users\manis\Desktop\json-schema\website\_includes\draft-00
26+
> Has it been deleted from the file system but not from git?
27+
> Repo-map can't include C:\Users\manis\Desktop\json-schema\website\_includes\draft-01
28+
> Has it been deleted from the file system but not from git?
29+
> Repo-map can't include C:\Users\manis\Desktop\json-schema\website\_includes\draft-02
30+
> Has it been deleted from the file system but not from git?
31+
> Repo-map can't include C:\Users\manis\Desktop\json-schema\website\_includes\draft-03
32+
> Has it been deleted from the file system but not from git?
33+
> Repo-map can't include C:\Users\manis\Desktop\json-schema\website\_includes\draft-04
34+
> Has it been deleted from the file system but not from git?
35+
> Repo-map can't include C:\Users\manis\Desktop\json-schema\website\_includes\draft-05
36+
> Has it been deleted from the file system but not from git?
37+
> Repo-map can't include C:\Users\manis\Desktop\json-schema\website\_includes\draft-06
38+
> Has it been deleted from the file system but not from git?
39+
> Repo-map can't include C:\Users\manis\Desktop\json-schema\website\_includes\draft-07
40+
> Has it been deleted from the file system but not from git?
41+
> Repo-map can't include C:\Users\manis\Desktop\json-schema\website\_includes\draft\2019-09
42+
> Has it been deleted from the file system but not from git?
43+
> Repo-map can't include C:\Users\manis\Desktop\json-schema\website\_includes\draft\2020-12
44+
> Has it been deleted from the file system but not from git?
45+
46+
Below is my plan for improving the document:
47+
48+
1. We'll add an "Additional Example" section at the end of the file. This section will begin right after the final code block.
49+
2. The added section will include an introductory statement to the new example, explaining its purpose, followed by a complete new example that shows an enum with mixed types (e.g., a string, a number, and a null).
50+
51+
Below is the *SEARCH/REPLACE* block for the file.
52+
53+
pages/understanding-json-schema/reference/enum.md
54+
````markdown
55+
<<<<<<< SEARCH
56+
```json
57+
// props { "indent": true, "valid": false }
58+
0
59+
```
60+
=======
61+
```json
62+
// props { "indent": true, "valid": false }
63+
0
64+
```
65+
66+
## Additional Example
67+
68+
Below is an example demonstrating an enumerated list that accepts mixed types, which can be useful when different types of identifiers are allowed.
69+
70+
```json
71+
// props { "isSchema": true }
72+
{
73+
"properties": {
74+
"shape": {
75+
"enum": ["circle", "square", 1, null]
76+
}
77+
}
78+
}
79+
```
80+
81+
```json
82+
// props { "indent": true, "valid": true }
83+
{ "shape": "circle" }
84+
```
85+
86+
```json
87+
// props { "indent": true, "valid": true }
88+
{ "shape": 1 }
89+
```
90+
91+
```json
92+
// props { "indent": true, "valid": true }
93+
{ "shape": null }
94+
```
95+
96+
```json
97+
// props { "indent": true, "valid": false }
98+
{ "shape": "triangle" }
99+
```
100+
>>>>>>> REPLACE
101+
````
102+
103+
You can now review and apply this change.
104+
105+
> Tokens: 6.7k sent, 349 received. Cost: $0.0089 message, $0.0089 session.
106+
> Applied edit to pages\understanding-json-schema\reference\enum.md
107+
> Commit 5757bca feat: Add additional example section for mixed type enums in doc
108+
> You can use /undo to undo and discard each aider commit.
109+
110+
#### /undo
111+
> Removed: 5757bca feat: Add additional example section for mixed type enums in doc
112+
> Now at: 172c5da Merge branch 'main' into enum
113+
> You can use /undo to undo and discard each aider commit.
114+
115+
#### make better doc this doc
116+
117+
Below are four *SEARCH/REPLACE* blocks for `pages/understanding-json-schema/reference/enum.md` that update the documentation to improve clarity and structure by adding descriptive headings and additional introductory statements.
118+
119+
Make sure to review the changes before applying.
120+
121+
pages/understanding-json-schema/reference/enum.md
122+
````markdown
123+
<<<<<<< SEARCH
124+
The `enum` [keyword](../../learn/glossary#keyword) is used to restrict a value to a fixed set of values.
125+
It must be an array with at least one element, where each element is
126+
unique.
127+
=======
128+
The `enum` keyword in JSON Schema allows you to restrict a value to a set of predefined options.
129+
It requires an array with at least one unique element, and any value validated against this schema must exactly match one of the specified values.
130+
131+
Below are several examples demonstrating its usage.
132+
>>>>>>> REPLACE
133+
````
134+
135+
pages/understanding-json-schema/reference/enum.md
136+
````markdown
137+
<<<<<<< SEARCH
138+
The following is an example for validating street light colors:
139+
=======
140+
### Basic Example: Street Light Colors
141+
142+
This example demonstrates how to validate that the `color` property of a street light is either "red", "amber", or "green".
143+
>>>>>>> REPLACE
144+
````
145+
146+
pages/understanding-json-schema/reference/enum.md
147+
````markdown
148+
<<<<<<< SEARCH
149+
You can use `enum` even without a type, to accept values of different
150+
types. Let\'s extend the example to use `null` to indicate \"off\", and
151+
also add 42, just for fun.
152+
=======
153+
### Extended Example: Accepting Multiple Data Types
154+
155+
Enums can be used without explicitly setting a data type, allowing different types of values.
156+
In the following example, the schema is extended to include `null` (to represent an "off" state) and the number 42.
157+
>>>>>>> REPLACE
158+
````
159+
160+
pages/understanding-json-schema/reference/enum.md
161+
````markdown
162+
<<<<<<< SEARCH
163+
```json
164+
// props { "isSchema": true }
165+
{
166+
"properties": {
167+
"shape": {
168+
"enum": ["circle", "square", 1, null]
169+
}
170+
}
171+
}
172+
=======
173+
### Additional Example: Mixed Types for Shape
174+
175+
```json
176+
// props { "isSchema": true }
177+
{
178+
"properties": {
179+
"shape": {
180+
"enum": ["circle", "square", 1, null]
181+
}
182+
}
183+
}
184+
>>>>>>> REPLACE
185+
````
186+
187+
Once applied, you can view the updated doc in your browser with an appropriate command, for example:
188+
```bash
189+
start pages/understanding-json-schema/reference/enum.md
190+
```
191+
192+
> Tokens: 7.2k sent, 532 received. Cost: $0.01 message, $0.02 session.
193+
> Committing pages\understanding-json-schema\reference\enum.md before applying edits.
194+
> Commit dab3aa3 docs: Add examples for enum validation in JSON schema reference
195+
> Applied edit to pages\understanding-json-schema\reference\enum.md
196+
> Commit 2d42d1b docs: Improve clarity and structure of enum documentation examples
197+
> start pages/understanding-json-schema/reference/enum.md
198+
> Run shell command? (Y)es/(N)o/(D)on't ask again [Yes]: n
199+
> You can use /undo to undo and discard each aider commit.
200+
201+
#### /undo
202+
> The file pages/understanding-json-schema/reference/enum.md has uncommitted changes. Please stash them before undoing.
203+
204+
#### /undo
205+
> Removed: 2d42d1b docs: Improve clarity and structure of enum documentation examples
206+
> Now at: dab3aa3 docs: Add examples for enum validation in JSON schema reference
207+
> You can use /undo to undo and discard each aider commit.

.aider.input.history

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
# 2025-03-04 23:12:43.666173
3+
+n
4+
5+
# 2025-03-04 23:13:12.133089
6+
+/add enum.m
7+
8+
# 2025-03-04 23:13:18.796472
9+
+n
10+
11+
# 2025-03-04 23:13:27.718007
12+
+/add pages\understanding-json-schema\reference\enum.md
13+
14+
# 2025-03-04 23:14:05.378574
15+
+Instead of replacing one example with another, I suggest adding your example to the document. Please provide an introductory statement to your example. and better this doc
16+
17+
# 2025-03-04 23:16:30.231856
18+
+/undo
19+
20+
# 2025-03-04 23:17:23.362071
21+
+make better doc this doc
22+
23+
# 2025-03-04 23:19:12.480114
24+
+n
25+
26+
# 2025-03-04 23:19:37.237787
27+
+/undo

.aider.tags.cache.v3/cache.db

300 KB
Binary file not shown.

.aider.tags.cache.v3/cache.db-shm

32 KB
Binary file not shown.

.aider.tags.cache.v3/cache.db-wal

3.94 MB
Binary file not shown.

pages/understanding-json-schema/reference/enum.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@ next:
99
url: /understanding-json-schema/reference/const
1010
---
1111

12-
The `enum` [keyword](../../learn/glossary#keyword) is used to restrict a value to a fixed set of values.
13-
It must be an array with at least one element, where each element is
14-
unique.
12+
The `enum` keyword in JSON Schema allows you to restrict a value to a set of predefined options.
13+
It requires an array with at least one unique element, and any value validated against this schema must exactly match one of the specified values.
1514

16-
The following is an example for validating street light colors:
15+
Below are several examples demonstrating its usage.
16+
17+
### Basic Example: Street Light Colors
18+
19+
This example demonstrates how to validate that the `color` property of a street light is either "red", "amber", or "green".
1720

1821
```json
1922
// props { "isSchema": true }
@@ -35,9 +38,10 @@ The following is an example for validating street light colors:
3538
{ "color": "blue" }
3639
```
3740

38-
You can use `enum` even without a type, to accept values of different
39-
types. Let\'s extend the example to use `null` to indicate \"off\", and
40-
also add 42, just for fun.
41+
### Extended Example: Accepting Multiple Data Types
42+
43+
Enums can be used without explicitly setting a data type, allowing different types of values.
44+
In the following example, the schema is extended to include `null` (to represent an "off" state) and the number 42.
4145

4246
```json
4347
// props { "isSchema": true }
@@ -62,10 +66,12 @@ also add 42, just for fun.
6266

6367
```json
6468
// props { "indent": true, "valid": false }
65-
0
69+
{ "color": 0 }
6670
```
6771

6872

73+
### Additional Example: Mixed Types for Shape
74+
6975
```json
7076
// props { "isSchema": true }
7177
{

0 commit comments

Comments
 (0)