Skip to content
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

New information architecture #1194

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 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
341 changes: 213 additions & 128 deletions components/Sidebar.tsx

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion data/tooling-data.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
"C#",
"Go",
"C++",
"JavaScript",
"JavaScript",
"Julia"
]
]
Expand Down
24 changes: 17 additions & 7 deletions pages/docs/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,51 @@ export default function Welcome() {
<Headline1>{newTitle}</Headline1>
<p>
JSON Schema is a declarative language for annotating and validating JSON
documents' structure, constraints, and data types. It provides a way to
documents' structure, constraints, and data types. It helps you
standardize and define expectations for JSON data.
<br />
Our documentation will guide you through the basics and beyond of
defining and validating JSON data.
<br />
<span className='font-bold text-[1.3rem]'>Explore the docs</span>
</p>
<div className='w-full lg:w-full grid grid-cols-1 sm:grid-cols-2 gap-6 my-[10px] mx-auto mt-8'>
<Card
icon='/icons/eye.svg'
title='Overview'
body='Our Overview provides a high level view of the project, its benefits, the roadmap and other relevant details.'
title='Introduction'
body='Discover JSON Schema: its purpose and role in data validation.'
headerSize='medium'
bodyTextSize='small'
link='/overview/what-is-jsonschema'
/>
<Card
icon='/icons/compass.svg'
title='Getting Started'
body='Our Getting Started guide walks you through the basics of JSON Schema.'
title='Get started'
body='New to JSON Schema? Learn the basics of schema design.'
headerSize='medium'
bodyTextSize='small'
link='/learn'
/>
<Card
icon='/icons/grad-cap.svg'
title='Guides'
body='Master advanced skills such as validation with our hands-on guides.'
headerSize='medium'
bodyTextSize='small'
link='/learn/guides'
/>
<Card
icon='/icons/book.svg'
title='Reference'
body='Our Reference teaches JSON Schema deeply from a beginner to the advanced level.'
body='Dive deeper into JSON Schema keywords with our clear explanations and usage examples.'
headerSize='medium'
bodyTextSize='small'
link='/understanding-json-schema'
/>
<Card
icon='/icons/clipboard.svg'
title='Specification'
body='Our Specification section documents all versions of JSON Schema specification.'
body='Understand the evolution of JSON Schema through draft specifications.'
headerSize='medium'
bodyTextSize='small'
link='/specification'
Expand Down
28 changes: 28 additions & 0 deletions pages/learn/guides/index.page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react';
import { getLayout } from '~/components/Sidebar';
import Head from 'next/head';
import { Headline1 } from '~/components/Headlines';
import { SectionContext } from '~/context';
import Card from '~/components/Card';

Check failure on line 6 in pages/learn/guides/index.page.tsx

View workflow job for this annotation

GitHub Actions / Code Quality Checks

'Card' is defined but never used
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls. remove this unused import

import { DocsHelp } from '~/components/DocsHelp';

export default function Welcome() {
const markdownFile = '_indexPage';

const newTitle = 'Guides';
return (
<SectionContext.Provider value='learn'>
<Head>
<title>{newTitle}</title>
</Head>
<Headline1>{newTitle}</Headline1>
<p>
Documentation coming soon!
<br />
</p>
<div className='w-full lg:w-full grid grid-cols-1 sm:grid-cols-2 gap-6 my-[10px] mx-auto mt-8'></div>
<DocsHelp markdownFile={markdownFile} />
</SectionContext.Provider>
);
}
Welcome.getLayout = getLayout;
36 changes: 30 additions & 6 deletions pages/learn/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,59 @@ import { DocsHelp } from '~/components/DocsHelp';
export default function Welcome() {
const markdownFile = '_indexPage';

const newTitle = 'Getting Started';
const newTitle = 'Get Started';
return (
<SectionContext.Provider value='learn'>
<Head>
<title>{newTitle}</title>
</Head>
<Headline1>{newTitle}</Headline1>
<p>
New to JSON Schema and don't know where to start?
<br />
New to JSON Schema and don't know where to start? Explore our learning
resources and get started with JSON Schema.
<br />
</p>
<div className='w-full lg:w-full grid grid-cols-1 sm:grid-cols-2 gap-6 my-[10px] mx-auto mt-8'>
<Card
title='Creating your first Schema'
body='Our Getting Started guide walks you through the basics of JSON Schema.'
title='JSON Schema basics'
body='Learn what JSON Schema is, essential keywords, and the basics of data validation'
headerSize='medium'
bodyTextSize='small'
extended={true}
link='/understanding-json-schema/basics'
/>
<Card
title='Create your first schema'
body='Follow our step by step guide and create your first JSON Schema'
headerSize='medium'
bodyTextSize='small'
extended={true}
link='/learn/getting-started-step-by-step'
/>
<Card
title='Tour of JSON Schema'
body='An interactive introduction to JSON Schema. Each lesson concludes with an exercise, so you can practice what you have learned.'
body='Master JSON Schema through engaging lessons and hands-on exercises. Complete the course to earn your JSON Schema certification and prove your expertise.'
headerSize='medium'
bodyTextSize='small'
extended={true}
link='https://tour.json-schema.org/'
/>
<Card
title='JSON Schema common terms'
body='Explore a curated glossary of common terms used in the JSON Schema ecosystem'
headerSize='medium'
bodyTextSize='small'
extended={true}
link='/learn/glossary'
/>
<Card
title='Schema examples'
body='Browse real-world JSON Schema examples across different domains, with detailed annotations.'
headerSize='medium'
bodyTextSize='small'
extended={true}
link='/learn/miscellaneous-examples'
/>
</div>
<DocsHelp markdownFile={markdownFile} />
</SectionContext.Provider>
Expand Down
8 changes: 4 additions & 4 deletions pages/understanding-json-schema/keywords/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ export default function StaticMarkdownPage({ datas }: { datas: DataObject[] }) {
</Head>
<Headline1>JSON Schema Keywords</Headline1>
<p className='text-slate-600 block leading-7 dark:text-slate-300'>
JSON Schema keywords are the building blocks of JSON Schema and they are
used to define the structure of a JSON document.
Keywords are the building blocks of JSON Schema and they are used to
define the structure of a JSON document.
</p>
<p className='text-slate-600 block leading-7 dark:text-slate-300 pt-4'>
Find below the list of JSON Schema Keywords and their links to the JSON
Schema docs:
Below is a list of JSON Schema keywords with links to their respective
documentation.
</p>
<div className='mt-4'>
{datas
Expand Down
23 changes: 9 additions & 14 deletions pages/understanding-json-schema/reference/combining.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,30 @@
---
title: "Schema Composition"
title: "Boolean JSON Schema combination"
section: docs
---

<Keywords label="schema composition" />

## Introduction
JSON Schema includes a few [keywords](../../learn/glossary#keyword) for combining schemas together. Note
that this doesn\'t necessarily mean combining schemas from multiple
files or JSON trees, though these facilities help to enable that and are
described in [Structuring a complex schema](../../understanding-json-schema/structuring). Combining schemas may be as
simple as allowing a value to be validated against multiple criteria at
the same time.
files or JSON trees. To learn how to combine reusable JSON Schemas, see [Modular JSON Schema combination](../../understanding-json-schema/structuring).

These keywords correspond to well known boolean algebra concepts like
AND, OR, XOR, and NOT. You can often use these keywords to express
complex constraints that can\'t otherwise be expressed with standard
JSON Schema keywords.

The keywords used to combine schemas are:
Here you will learn to combine schemas by allowing a value to be validated against multiple criteria at the same time. This task requires using keywords that correspond to well known boolean algebra concepts like
AND, OR, XOR, and NOT. The keywords used to combine schemas are the following:

- `allOf`: (AND) Must be valid against *all* of the [subschemas](../../learn/glossary#subschema)
- `anyOf`: (OR) Must be valid against *any* of the subschemas
- `oneOf`: (XOR) Must be valid against *exactly one* of the
subschemas
- `not`: (NOT) Must *not* be valid against the given schema

All of these keywords must be set to an array, where each item is a
schema. Be careful with recursive schemas as they can exponentially increase processing times.

In addition, there is:

- `not`: (NOT) Must *not* be valid against the given schema
In the following sections you will learn to use these keywords to express
complex constraints that can\'t otherwise be expressed with standard
JSON Schema keywords.

<Keywords label="single: allOf single: schema composition; allOf" />

Expand Down
12 changes: 12 additions & 0 deletions pages/understanding-json-schema/reference/composition.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: "Schema composition"
section: docs
---

JSON Schema offers powerful features for constructing complex and flexible schema structures. The main approaches to combining JSON schemas are the following:

- **Modular combination**. This approach allows you to break down your data model into reusable components, fostering modularity, and maintainability. In [Modular JSON Schema combination](../../understanding-json-schema/reference/structuring) you will learn about creating and utilizing reusable schemas, subschemas, and even self-referential (recursive) schemas.

- **Boolean combination**. This approach allows you to validate a single data value against multiple criteria at the same time. JSON Schema provides a set of keywords that act like boolean operators (AND, OR, NOT) to achieve this. To enhance your understanding of these keywords and learn how to leverage them for complex validations, see [Boolean JSON Schema combination](../../understanding-json-schema/reference/combining).

By mastering these techniques you will make your JSON schemas more scalable, flexible, and easy to maintain.
18 changes: 13 additions & 5 deletions pages/understanding-json-schema/reference/generic.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
---
title: "Generic keywords"
title: "Value restrictions"
section: docs
---

* [Annotations](../../understanding-json-schema/reference/annotations)
* [Comments](../../understanding-json-schema/reference/comments)
* [Enumerated values](../../understanding-json-schema/reference/enum)
* [Constant values](../../understanding-json-schema/reference/const)
The `enum` and `const` keywords contribute to data validation by defining limits on the values a property can hold.

- **Define a set of values**. Use the `enum` keyword to specify a finite set of acceptable values for a property. This ensures that only predefined options are valid.

- **Define a fixed, single value**. Use the `const` keyword to force a property to have a single, fixed value. This keyword is more restrictive than `enum`.

Learn more about how to use these keywords with the following resources:

- [Enumerated values](../../understanding-json-schema/reference/enum)
- [Constant values](../../understanding-json-schema/reference/const)

By effectively utilizing these keywords, you can significantly enhance the reliability and accuracy of your JSON data.
93 changes: 73 additions & 20 deletions pages/understanding-json-schema/reference/index.page.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,84 @@
import React from 'react';
import { getLayout } from '~/components/Sidebar';
import fs from 'fs';
import matter from 'gray-matter';
import StyledMarkdown from '~/components/StyledMarkdown';
import Head from 'next/head';
import { Headline1 } from '~/components/Headlines';
import { SectionContext } from '~/context';
import Card from '~/components/Card';
import { DocsHelp } from '~/components/DocsHelp';

export async function getStaticProps() {
const block1 = fs.readFileSync(
'pages/understanding-json-schema/reference/_index.md',
'utf-8',
);
const { content: block1Content } = matter(block1);
return {
props: {
blocks: [block1Content],
},
};
}

export default function ContentExample({ blocks }: { blocks: any[] }) {
export default function Welcome() {
const markdownFile = '_indexPage';

const newTitle = 'JSON Schema Reference';
return (
<SectionContext.Provider value='docs'>
<StyledMarkdown markdown={blocks[0]} />
<SectionContext.Provider value='learn'>
<Head>
<title>{newTitle}</title>
</Head>
<Headline1>{newTitle}</Headline1>
<p>
Master the full power of JSON Schema with our reference documentation.
<br />
<br />
From basic data types to advanced techniques like conditional validation
and schema composition, you will learn everything about JSON Schema
keywords through clear explanations and examples. By learning best
practices for building clear, scalable, and easy-to-maintain schemas,
you will ensure that your JSON data is both robust and flexible.
<br />
</p>
<div className='w-full lg:w-full grid grid-cols-1 sm:grid-cols-2 gap-6 my-[10px] mx-auto mt-8'>
<Card
title='Learn JSON Schema'
body='Improve your JSON Schema skills with this reference, crafted by our TSC members, offering practical examples, best practices, and common pitfalls.'
headerSize='medium'
bodyTextSize='small'
extended={true}
link='https://www.learnjsonschema.com/2020-12/'
/>
<Card
title='Keywords'
body='Browse our comprehensive index of JSON Schema keywords, each linking to detailed documentation.'
headerSize='medium'
bodyTextSize='small'
extended={true}
link='https://tour.json-schema.org/'
/>
<Card
title='Data types'
body='Become profficient at using the type keyword to validate your data.'
headerSize='medium'
bodyTextSize='small'
extended={true}
link='https://tour.json-schema.org/'
/>
<Card
title='Value restrictions'
body='Ensure data consistency and accuracy, by defining value sets and fixed values for your JSON properties.'
headerSize='medium'
bodyTextSize='small'
extended={true}
link='https://tour.json-schema.org/'
/>
<Card
title='Annotations and comments'
body='Enhance your JSON Schemas with annotations and comments. Learn how to add descriptions, defaults, examples, and more to improve readability and maintainability.'
headerSize='medium'
bodyTextSize='small'
extended={true}
link='https://tour.json-schema.org/'
/>
<Card
title='Schema composition'
body='Learn how to combine JSON Schemas using modular and boolean techniques to create flexible and maintainable data models.'
headerSize='medium'
bodyTextSize='small'
extended={true}
link='https://tour.json-schema.org/'
/>
</div>
<DocsHelp markdownFile={markdownFile} />
</SectionContext.Provider>
);
}
ContentExample.getLayout = getLayout;
Welcome.getLayout = getLayout;
26 changes: 26 additions & 0 deletions pages/understanding-json-schema/reference/metadata.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: "Schema annotations and comments"
section: docs
---

Annotations and comments are not directly related to the core structure and constraints of the JSON Schema itself. As such, keywords for annotations and comments are not required, however, using them can improve the maintainability of your schemas.

Annotations are optional pieces of information that provide additional context or meaning to a JSON Schema. They are not used for data validation but can serve various purposes, such as:

- **Descriptions**. Adding human-readable descriptions to properties or the entire schema.
- **Defaults**. Specifying default values for properties.
- **Examples**. Providing example JSON objects that validate against the schema.
- **ReadOnly/WriteOnly**. Indicating read-only or write-only properties (often used in API contexts).
- **Deprecated**. Marking properties or features that are discouraged from use and might be removed in the future.


While annotations don't enforce data validation, they play a valuable role in enhancing the clarity, usability, and maintainability of JSON Schemas.

Unlike some programming languages, JSON Schema itself doesn't natively support comments. However, it provides the keyword `$comment`, which allows schema authors to add comments within their schema. These comments enhance the clarity and maintainability of your schemas; they're intended for schema maintainers and are invisible to applications using the schema for validation.

By incorporating annotations and comments into your schemas you can improve their clarity, maintainability, and overall quality. This will ensure your schemas are easier to understand and managed over time.

To get started, explore the following resources:

- [Annotations](../../understanding-json-schema/reference/annotations)
- [Comments](../../understanding-json-schema/reference/comments)
Loading
Loading