Skip to content

Fix: draft behaviour and hydration error #498

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion components/StyledMarkdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ const StyledMarkdownBlock = ({ markdown }: { markdown: string }) => {
},
table: {
component: ({ children }) => (
<table className='table-auto mb-8'>{children}</table>
<div className='max-w-[100%] mx-auto mb-8 overflow-auto'>
<table className='table-auto'>{children}</table>
</div>
),
},
thead: {
Expand Down
233 changes: 122 additions & 111 deletions pages/draft/2020-12/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,96 +33,102 @@ Here are some examples to illustrate the changes.

### Open tuple
<table>
<tr>
<th>Draft 2019-09</th>
<th>Draft 2020-12</th>
</tr>
<tr>
<td>
```json
{
"items": [
{ "$ref": "#/$defs/foo" },
{ "$ref": "#/$defs/bar" }
]
}
```
</td>
<td>
```json
{
"prefixItems": [
{ "$ref": "#/$defs/foo" },
{ "$ref": "#/$defs/bar" }
]
}
```
</td>
</tr>
<tbody>
<tr>
<th>Draft 2019-09</th>
<th>Draft 2020-12</th>
</tr>
<tr>
<td>
```json
{
"items": [
{ "$ref": "#/$defs/foo" },
{ "$ref": "#/$defs/bar" }
]
}
```
</td>
<td>
```json
{
"prefixItems": [
{ "$ref": "#/$defs/foo" },
{ "$ref": "#/$defs/bar" }
]
}
```
</td>
</tr>
</tbody>
</table>

### Closed tuple
<table>
<tr>
<th>Draft 2019-09</th>
<th>Draft 2020-12</th>
</tr>
<tr>
<td>
```json
{
"items": [
{ "$ref": "#/$defs/foo" },
{ "$ref": "#/$defs/bar" }
],
"additionalItems": false
}
```
</td>
<td>
```json
{
"prefixItems": [
{ "$ref": "#/$defs/foo" },
{ "$ref": "#/$defs/bar" }
],
"items": false
}
```
</td>
</tr>
<tbody>
<tr>
<th>Draft 2019-09</th>
<th>Draft 2020-12</th>
</tr>
<tr>
<td>
```json
{
"items": [
{ "$ref": "#/$defs/foo" },
{ "$ref": "#/$defs/bar" }
],
"additionalItems": false
}
```
</td>
<td>
```json
{
"prefixItems": [
{ "$ref": "#/$defs/foo" },
{ "$ref": "#/$defs/bar" }
],
"items": false
}
```
</td>
</tr>
</tbody>
</table>

### Tuple with constrained additional items
<table>
<tr>
<th>Draft 2019-09</th>
<th>Draft 2020-12</th>
</tr>
<tr>
<td>
```json
{
"items": [
{ "$ref": "#/$defs/foo" },
{ "$ref": "#/$defs/bar" }
],
"additionalItems": { "$ref": "#/$defs/baz" }
}
```
</td>
<td>
```json
{
"prefixItems": [
{ "$ref": "#/$defs/foo" },
{ "$ref": "#/$defs/bar" }
],
"items": { "$ref": "#/$defs/baz" }
}
```
</td>
</tr>
<tbody>
<tr>
<th>Draft 2019-09</th>
<th>Draft 2020-12</th>
</tr>
<tr>
<td>
```json
{
"items": [
{ "$ref": "#/$defs/foo" },
{ "$ref": "#/$defs/bar" }
],
"additionalItems": { "$ref": "#/$defs/baz" }
}
```
</td>
<td>
```json
{
"prefixItems": [
{ "$ref": "#/$defs/foo" },
{ "$ref": "#/$defs/bar" }
],
"items": { "$ref": "#/$defs/baz" }
}
```
</td>
</tr>
</tbody>
</table>

## $dynamicRef and $dynamicAnchor
Expand All @@ -149,6 +155,7 @@ used as the starting point for dynamic resolution.
Here's how you would covert a schema using `$recursiveRef` to use `$dynamicRef`.

<table>
<tbody>
<tr>
<th>Draft 2019-09</th>
<th>Draft 2020-12</th>
Expand Down Expand Up @@ -209,6 +216,7 @@ Here's how you would covert a schema using `$recursiveRef` to use `$dynamicRef`.
```
</td>
</tr>
</tbody>
</table>


Expand All @@ -224,35 +232,37 @@ that has some item matching one schema and everything else matching another
schema.

<table>
<tr>
<th>Draft 2019-09</th>
<th>Draft 2020-12</th>
</tr>
<tr>
<td>
```json
{
"type": "array",
"contains": { "type": "string" },
"items": {
"anyOf": [
{ "type": "string" },
{ "type": "number" }
]
<tbody>
<tr>
<th>Draft 2019-09</th>
<th>Draft 2020-12</th>
</tr>
<tr>
<td>
```json
{
"type": "array",
"contains": { "type": "string" },
"items": {
"anyOf": [
{ "type": "string" },
{ "type": "number" }
]
}
}
}
```
</td>
<td>
```json
{
"type": "array",
"contains": { "type": "string" },
"unevaluatedItems": { "type": "number" }
}
```
</td>
</tr>
```
</td>
<td>
```json
{
"type": "array",
"contains": { "type": "string" },
"unevaluatedItems": { "type": "number" }
}
```
</td>
</tr>
</tbody>
</table>

Unfortunately, this change means you may not be able to use `contains` in some
Expand Down Expand Up @@ -463,7 +473,8 @@ embedded schemas using `$defs`. Here's what the bundled schema would look like.
Here are a few things you might notice from this example.

1. No `$ref`s were modified. Even local references are unchanged.
2. `https://example.com/schema/common#/$defs/unsignedInt` got pulled in with the
2. `https://example.com/schema/common#/`
`$defs/unsignedInt` got pulled in with the
common schema even though it isn't used. It's allowed to trim out the extra
definitions, but not necessary.
3. `https://example.com/schema/address` doesn't declare a `$schema`. Because it
Expand Down