Skip to content

Commit

Permalink
docs: replace side editor with a Link compoenent
Browse files Browse the repository at this point in the history
  • Loading branch information
JeelRajodiya committed Jul 30, 2024
1 parent 93c0c37 commit 4b2754a
Show file tree
Hide file tree
Showing 43 changed files with 43 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ To nest objects within objects, you can define a property as an `object` with it
```


Now, try to modify the `name` property on the side editor to add `firstName`, `lastName`, and `middleName` with type `string`.
Now, try to modify the `name` property on the <SideEditorLink/> to add `firstName`, `lastName`, and `middleName` with type `string`.
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ if those properties are not present, the JSON data is considered invalid.
```


Now, try to modify the `name` property on the side editor and add `firstName` and `lastName` as **required** properties.
Now, try to modify the `name` property on the <SideEditorLink/> and add `firstName` and `lastName` as **required** properties.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ To define the enumerated values in _JSON Schema_, use the `enum` keyword.
```


Now, try to modify the `hobbies` property on the side editor with `enum` constrain to only allow `reading`, `writing`, and `painting` values.
Now, try to modify the `hobbies` property on the <SideEditorLink/> with `enum` constrain to only allow `reading`, `writing`, and `painting` values.

<GoodToKnowBox>
Values defined in `enum` are case-sensitive.
Expand Down
2 changes: 1 addition & 1 deletion content/01-Getting-Started/05-Arrays/instructions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ You can use the `items` keyword to define the *schema* of the array elements. Th
```


Now, try to modify the `hobbies` property on the side editor and convert it to an **array of strings**.
Now, try to modify the `hobbies` property on the <SideEditorLink/> and convert it to an **array of strings**.

Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ Start by defining `skills` as an array. set the `items` keyword to define the ty
}
}
```
Now, try to modify the `skills` property in the schema given to you in the editor, and make it an array of objects with `name` and `level` properties.
Now, try to modify the `skills` property in the schema given to you in the <SideEditorLink/>, and make it an array of objects with `name` and `level` properties.

Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ In *JSON Schema*, you can use the `minLength` and `maxLength` keywords to define
}
```

Now, try to modify the `postalCode` and `phoneNumber` fields in the side editor with the below constraints in mind.
Now, try to modify the `postalCode` and `phoneNumber` fields in the <SideEditorLink/> with the below constraints in mind.

**Constraints:**
- The `postalCode` should be a string with a length of **exactly 6** characters.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Let's break down the regular expression `^[0-9]{6}$`:
- `{6}` specifies that the previous pattern should be repeated exactly 6 times.
- `$` asserts the end of the string.

Now, try to modify the `postalCode`, `phoneNumber` and `countryCode` fields in the side editor with the below constraints in mind.
Now, try to modify the `postalCode`, `phoneNumber` and `countryCode` fields in the <SideEditorLink/> with the below constraints in mind.

**Constraints:**
- The `postalCode` should be a string with a length of **exactly 6** characters and should **contain only digits.**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ To apply constraints on number values, you can use the following keywords:
}
```

now try to modify the `age` and `dateOfBirth` properties in the side editor with the constraints mentioned below:
now try to modify the `age` and `dateOfBirth` properties in the <SideEditorLink/> with the constraints mentioned below:

- `age` should be between 18 and 60
- `dateOfBirth.year` should be between 1964 and 2024
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ To apply exclusive constraints on number values, you can use the following keywo
- x < `exclusiveMaximum`


now try to add the `age` and `salary` properties in the schema given on the side editor with the constraints mentioned below using `exclusiveMinimum` and `exclusiveMaximum` keywords:
now try to add the `age` and `salary` properties in the schema given on the <SideEditorLink/> with the constraints mentioned below using `exclusiveMinimum` and `exclusiveMaximum` keywords:

- `age` should be **greater than 18** and **less than 60**
- `salary` should be **greater than 30000** and **less than 80000**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The `multipleOf` keyword is used to define a number which is a multiple of anoth
}
```

Now, try to modify the JSON object such that `hourlyWage` property follows the given constraints.
Now, try to modify the JSON schema given in the <SideEditorLink/> such that `hourlyWage` property follows the given constraints.

**Constraints**
- `hourlyWage` should be a **multiple of 0.25**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Consider a new property, `performanceRating`.
}
```

Now, Try to modify the `performanceRating` property on the side editor to accept decimal numbers with **minimum** value as **0** and **maximum** value as **5**.
Now, Try to modify the `performanceRating` property on the <SideEditorLink/> to accept decimal numbers with **minimum** value as **0** and **maximum** value as **5**.

Also modify the `age` property to accept only `integer` values. <br/>
(There is no need to set the minimum and maximum values for the `age` property.)
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ Let's say you want to restrict the `performanceRating` to only a few specific va
}
```

Now, modify the `performanceRating` property on the side editor to accept only the values 1, 2, 3, 4, 5, and null.
Now, modify the `performanceRating` property on the <SideEditorLink/> to accept only the values 1, 2, 3, 4, 5, and null.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The `const` keyword is used to define a single constant value for a property. Th
}
```

Now, try to add a new property `companyName` in the JSON object such that it should have a constant value `MyCompany`.
Now, try to add a new property `companyName` in the JSON schema in <SideEditorLink/> such that it should have a constant value `MyCompany`.

Just for practice, we will also **set the age to a constant value of 25**.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ In _JSON Schema_, you can define multiple types by passing **an array of types**



Now, try to modify the `hasAgreedToTerms` property on the side editor to accept both `boolean` and `null` values.
Now, try to modify the `hasAgreedToTerms` property on the <SideEditorLink/> to accept both `boolean` and `null` values.
2 changes: 1 addition & 1 deletion content/03-Objects/01-Pattern-Properties/instructions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ We will define a property that starts with `DEPT-` followed by department number
}
```

Now, modify the schema provided in the editor on the right to permit `DEPT-*` properties. Additionally, ensure that the values for `DEPT-*` properties are constrained to be in **all capital letters.**
Now, modify the schema provided in the <SideEditorLink/> on the right to permit `DEPT-*` properties. Additionally, ensure that the values for `DEPT-*` properties are constrained to be in **all capital letters.**

> **Hint:** Use the `patternProperties` keyword to define the pattern for the property name and `pattern` keyword to define the pattern for the property value. you can set `pattern` to `^[A-Z]+$` to match all capital letters.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ You can also set `additionalProperties` to a schema to define the schema for the

The above schema will allow only `name` and `age` properties in the object. If any other property is present in the object, it should be of type `string`.

Now, try to modify the schema provided in the editor on the right to allow any additional properties of type `integer`.
Now, try to modify the schema provided in the <SideEditorLink/> on the right to allow any additional properties of type `integer`.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Let's add a new property `contactMethods` in the employee object and set constra
}
```

Now, add the `minProperties` and `maxProperties` keywords to the schema on the side editor to set the minimum and maximum number of properties in the `contactMethods` object.
Now, add the `minProperties` and `maxProperties` keywords to the schema on the <SideEditorLink/> to set the minimum and maximum number of properties in the `contactMethods` object.

In the `contactMethods` object, set the minimum number of properties to `2` and the maximum number of properties to `5`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ We want to ensure that each property names are written in capital letters. We ca
}
```

You are given an empty object schema in the right-hand editor. Modify it ensure that it follows the below constraints:
You are given an empty object schema in the <SideEditorLink/>. Modify it ensure that it follows the below constraints:

1. The object should have at **least 2 properties**.
2. The **property names** should be written **in capital letters**, and should have **minimum length of 3 characters**.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ In *JSON Schema*, you can specify the minimum and maximum number of items in an
}
}
```
Now, modify the `phones` property of the given schema on the side editor, and specify minimum items as `1` and maximum items as `3`. Additionally constrain the phone numbers to be in the format `xxx-xxx-xxxx`.
Now, modify the `phones` property of the given schema on the <SideEditorLink/>, and specify minimum items as `1` and maximum items as `3`. Additionally constrain the phone numbers to be in the format `xxx-xxx-xxxx`.

> **Hint:** Use regular expression `^\\d{3}-\\d{3}-\\d{4}$` with `pattern` keyword to validate the phone number format.
2 changes: 1 addition & 1 deletion content/04-Arrays/02-Unique-Items/instructions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ To ensure that the items in an array are unique, you can use the `uniqueItems` k
}
```

Now, try to modify the `phones` property in the schema given on the side editor to ensure that the phone numbers are unique.
Now, try to modify the `phones` property in the schema given on the <SideEditorLink/> to ensure that the phone numbers are unique.
2 changes: 1 addition & 1 deletion content/04-Arrays/03-Tuple-Validation/instructions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ In such cases, you can use the `prefixItems` keyword to define the schema for ea

The above schema defines an array in which, the first element should be an `integer` and the second element should be a `string`.

Now, try to modify the `address` property on the side editor, such that it follows the constraints mentioned above.
Now, try to modify the `address` property on the <SideEditorLink/>, such that it follows the constraints mentioned above.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ You can set the `items` keyword to `false` to disallow additional items in the t
```


Now, try to modify the `address` property on the side editor, to allow **only string values as additional items** in the tuple array.
Now, try to modify the `address` property on the <SideEditorLink/>, to allow **only string values as additional items** in the tuple array.

> **Hint:** add a *subschema* to the `items` keyword to define the schema for the additional items.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ now, we want to restrict the `relevantDepartments` property to only a few specif
}
```

Now, Let's try to add the `enum` keyword to the schema given in the side editor and restrict the `relevantDepartments` property to only the values `HR`, `Finance`, `IT`, and `Admin`.
Now, Let's try to add the `enum` keyword to the schema given in the <SideEditorLink/> and restrict the `relevantDepartments` property to only the values `HR`, `Finance`, `IT`, and `Admin`.

Also, **each item in the array should be unique**.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ Our employee document has a field called `skills`.
}
```

Now, we want to ensure that the `skills` array contains at least one element that is equal to `"JavaScript"`. modify the schema given to you in the side editor to apply this constrain.
Now, we want to ensure that the `skills` array contains at least one element that is equal to `"JavaScript"`. modify the schema given to you in the <SideEditorLink/> to apply this constrain.

> **Hint:** Use the `const` keyword to specify JavaScript as the required element.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ The following example demonstrates how to use the `minContains` and `maxContains
}
```

Our employee has field called worked hours. We want to ensure that the `workedHours` array contains **at least 2 elements** that are **greater than or equal to 8 and less than or equal 12**. Modify the schema given to you in the side editor to apply this constraint.
Our employee has field called worked hours. We want to ensure that the `workedHours` array contains **at least 2 elements** that are **greater than or equal to 8 and less than or equal 12**. Modify the schema given to you in the <SideEditorLink/> to apply this constraint.


2 changes: 1 addition & 1 deletion content/04-Arrays/08-Unevaluated-Items/instructions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ In this case, first two items are evaluated by `prefixItems` and the remaining i
}
```

Modify the `skills` property of the given schema on the side editor such that,
Modify the `skills` property of the given schema on the <SideEditorLink/> such that,
- First three elements can have only "HTML", "CSS" and "JavaScript" as values (in any order), not anything else.
- The remaining elements are of type string.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ In the above schema, the `age` property is required if the `name` property is pr
}
```

You are given a *Schema* for the above JSON document in the side editor. Update the schema to make sure that if the `creditCardNumber` property is present, then the `address` property must also be present.
You are given a *Schema* for the above JSON document in the <SideEditorLink/>. Update the schema to make sure that if the `creditCardNumber` property is present, then the `address` property must also be present.
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ Similar to the previous lesson, we can use the `dependentRequired` keyword to en
}
```

You are given a *Schema* for the above JSON document in the side editor. Update the schema to make sure that `creditCardNumber` and `address` are mutually dependent.
You are given a *Schema* for the above JSON document in the <SideEditorLink/>. Update the schema to make sure that `creditCardNumber` and `address` are mutually dependent.
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ You can use the `dependentSchemas` keyword to enforce this condition.
}
```

You are given a *Schema* for the above JSON document in the side editor. Update the schema to make sure that if the `creditCardNumber` property is present, then the `address` property must also be present using the `dependentSchemas` keyword.
You are given a *Schema* for the above JSON document in the <SideEditorLink/>. Update the schema to make sure that if the `creditCardNumber` property is present, then the `address` property must also be present using the `dependentSchemas` keyword.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ You can use the `if-then-else` keyword to enforce this condition.
}
```

You are given the schema for the same JSON document in the side editor. Modify the schema to enforce the below condition:
You are given the schema for the same JSON document in the <SideEditorLink/>. Modify the schema to enforce the below condition:

- **If** `isStudent` is true, **then** the `age` field must be present, **else** the `grade` field must be present.

Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ You can use the `if-then` keyword to enforce this condition.
}
```

You are given the schema for the same JSON document in the side editor. Modify the schema to enforce the below condition:
You are given the schema for the same JSON document in the <SideEditorLink/>. Modify the schema to enforce the below condition:

- **If** `isStudent` is true, **then** the `age` field must be present.
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ Using `$defs` and `$ref` can help make your JSON Schema more modular and maintai
}
}
```
Define a *subschema* named `stringType` which is just `"type": "string"` and then reference it using `$ref` for the `properties` **firstName**, **middleName** and **lastName**
Define a *subschema* named `stringType` in the schema given in <SideEditorLink/>, which is just `"type": "string"` and then reference it using `$ref` for the `properties` **firstName**, **middleName** and **lastName**

Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ We have defined a simple schema as below.
"type": "string"
}
```
Reference this schema in the `name` property using the `$ref` keyword in the schema given to you in the side editor.
Reference this schema in the `name` property using the `$ref` keyword in the schema given to you in the <SideEditorLink/>.


Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ The above schema ensures that the `name` property is valid against both the `min
}
```

For the given JSON document, you are provided with a schema in the side editor. the schema has defined a subschemas `ageLimit`.
For the given JSON document, you are provided with a schema in the <SideEditorLink/>. the schema has defined a subschemas `ageLimit`.
Your task is to:
- Define a inline subschema that checks if the `age` is of type `integer`
- Combine the `ageLimit` and the inline subschema using `allOf` in the `age` property.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ We will combine using `oneOf` and `required`, to ensure that only one of the pro
}
```

You are given a *Schema* for the above JSON document in the side editor. Using `oneOf` keyword, update schema to ensure that the `age` follows one of the below conditions:
You are given a *Schema* for the above JSON document in the <SideEditorLink/>. Using `oneOf` keyword, update schema to ensure that the `age` follows one of the below conditions:

- Either between 18 and 60 (inclusive) or,
- Greater then 65 (inclusive).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Create a JSON schema that validates the following document.
```


Modify the schema given to you in the side editor to ensure that the document is valid if
Modify the schema given to you in the <SideEditorLink/> to ensure that the document is valid if
- It has either `salary` or `hourlyRate` property.
- It has both `employeeType` and `salary` properties.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ We want the `age` to be greater then or equal to 18. but it should not be 21. We
}
```

Modify the schema given to you in the side editor to ensure that the document is valid if:
Modify the schema given to you in the <SideEditorLink/> to ensure that the document is valid if:
- `status` is **not** `null`.

Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ In the above example, the `TreeNode` schema refers to itself in the `children` p
}
}
```
You are given an incomplete JSON Schema in the right side editor.
You are given an incomplete JSON Schema in the right <SideEditorLink/>.
Define the `next` schema using recursive schemas. here `next` is a linked list of values.

> **Hint:**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ The challenge we saw with `additionalProperties` can be solved using the `uneval

## Task

You are give the same schema in the text editor. Add `unevaluatedProperties` to the schema to allow the only `number` as an additional property.
You are give the same schema in the <SideEditorLink/>. Add `unevaluatedProperties` to the schema to allow the only `number` as an additional property.

Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ Here's an example of a schema with a title and description:
```

# Task
Add `title` and `description` to the schema given to you in the side editor. You can use any title and description you like.
Add `title` and `description` to the schema given to you in the <SideEditorLink/>. You can use any title and description you like.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Here, the `name` property is marked as `readOnly`, and the `age` property is mar
}

```
You are given schema of the above JSON object.
You are given schema of the above JSON object in <SideEditorLink/>.
- Add `deprecated` keyword to the schema.
- Add `readOnly` in the schema to the `name` property
- Add `writeOnly` to the `age` property.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ You can set a default value for a property using the `default` keyword. The `def
}
```

You are given schema of the above JSON object.
You are given schema of the above JSON object in <SideEditorLink/>.
- Add any comment to the `name` property.
- Set any default value to the `age` property.
Loading

0 comments on commit 4b2754a

Please sign in to comment.