Skip to content

Commit c418f6a

Browse files
authored
Merge branch 'main' into New-Tool
2 parents 3e394bc + 7d05fe4 commit c418f6a

File tree

19 files changed

+252
-26
lines changed

19 files changed

+252
-26
lines changed

.github/pull_request_template.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,9 @@ Thanks for submitting a pull request! Please provide enough information so that
3232
**Does this PR introduce a breaking change?**
3333

3434
<!-- If this PR introduces a breaking change, please describe the impact and a migration path for existing applications. -->
35+
36+
# Checklist
37+
38+
Please ensure the following tasks are completed before submitting this pull request.
39+
40+
- [ ] Read, understood, and followed the [contributing guidelines](https://github.com/json-schema-org/website/blob/main/CONTRIBUTING.md).

.github/workflows/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This document outlines the guidelines for contributing to and maintaining GitHub
1313

1414
Our YAML files are organized based on specific roles and event triggers. When creating or modifying workflows, ensure that:
1515
- The file roles described below are strictly maintained.
16-
- Job sequences within workflows are preserved using [GitHub Action job dependencies](https://docs.github.com/en/actions/using-workflows/using-jobs-in-a-workflow#defining-prerequisite-jobs).
16+
- Job sequences within workflows are preserved using [GitHub Action job dependencies](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/using-jobs-in-a-workflow#defining-prerequisite-jobs).
1717

1818
### File Categorization
1919

@@ -42,7 +42,7 @@ Separate files may be created for workflows that:
4242

4343
- Only work correctly if they have a dedicated file.
4444
Examples:
45-
- [Preview Deployment](./preview-deployment.yml): Deploys preview environments for pull requests.
45+
- [Preview Deployment](./deploy-preview.yml): Deploys preview environments for pull requests.
4646
- [Production Deployment](./production-deployment.yml): Handles production deployments.
4747
- [CodeQL Code Scanning](./codeql.yml): Performs code security analysis.
4848
- [Check PR Dependencies](./pr-dependencies.yml): Enforces dependencies between PRs based on opening comments.
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: PR Body Validation
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, edited, synchronize, reopened]
6+
7+
jobs:
8+
check-pr-content:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
pull-requests: write
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Check PR content
18+
uses: actions/github-script@v7
19+
with:
20+
github-token: ${{ secrets.GITHUB_TOKEN }}
21+
script: |
22+
const pr = context.payload.pull_request;
23+
const prBody = pr.body || '';
24+
25+
let missingItems = [];
26+
27+
// Helper function to extract content between section headers
28+
function extractSectionContent(content, sectionHeader) {
29+
const regex = new RegExp(`\\*\\*${sectionHeader}\\*\\*(.*?)(?=\\*\\*|$)`, 's');
30+
const match = content.match(regex);
31+
if (!match) return '';
32+
33+
// Remove HTML comments and trim whitespace
34+
return match[1].replace(/<!--[\s\S]*?-->/g, '').trim();
35+
}
36+
37+
// Helper function to check if content is meaningful
38+
function hasMeaningfulContent(content) {
39+
// Remove HTML comments, markdown symbols, and extra whitespace
40+
const cleanContent = content
41+
.replace(/<!--[\s\S]*?-->/g, '')
42+
.replace(/[#*\[\]()_]/g, '')
43+
.trim();
44+
return cleanContent.length >= 3; // Requiring at least 3 characters
45+
}
46+
47+
// Check for issue links
48+
const issueRegex = /(closes|related to)\s+#\d+/i;
49+
if (!issueRegex.test(prBody)) {
50+
missingItems.push('issue reference');
51+
}
52+
53+
// Check for kind of change
54+
const changeContent = extractSectionContent(prBody, 'What kind of change does this PR introduce\\?');
55+
if (!hasMeaningfulContent(changeContent)) {
56+
missingItems.push('kind of change description');
57+
}
58+
59+
// Check for unchecked items in checklist
60+
const checklistMatch = prBody.match(/# Checklist([\s\S]*?)(?=(?:#|$))/);
61+
if (checklistMatch && checklistMatch[1].includes('- [ ]')) {
62+
missingItems.push('completed checklist items');
63+
}
64+
65+
// Get current labels
66+
const { data: currentLabels } = await github.rest.issues.listLabelsOnIssue({
67+
owner: context.repo.owner,
68+
repo: context.repo.repo,
69+
issue_number: context.issue.number
70+
});
71+
72+
const hasNeedsInfoLabel = currentLabels.some(label => label.name === 'needs-info');
73+
74+
if (missingItems.length > 0) {
75+
// If there are missing items, add comment and label
76+
const missingItemsList = missingItems.join(', ');
77+
const comment = `Hi @${pr.user.login}! Thanks a lot for your contribution!
78+
79+
I noticed that the following required information is missing or incomplete: ${missingItemsList}
80+
81+
Please update the PR description to include this information. You can find placeholders in the PR template for these items.
82+
83+
Thanks a lot!`;
84+
85+
await github.rest.issues.createComment({
86+
owner: context.repo.owner,
87+
repo: context.repo.repo,
88+
issue_number: context.issue.number,
89+
body: comment
90+
});
91+
92+
// Add needs-info label if not already present
93+
if (!hasNeedsInfoLabel) {
94+
await github.rest.issues.addLabels({
95+
owner: context.repo.owner,
96+
repo: context.repo.repo,
97+
issue_number: context.issue.number,
98+
labels: ['needs-info']
99+
});
100+
}
101+
core.setFailed(`The following required information is missing or incomplete: ${missingItemsList}`);
102+
} else if (hasNeedsInfoLabel) {
103+
// If all requirements are met and the needs-info label exists, remove it
104+
await github.rest.issues.removeLabel({
105+
owner: context.repo.owner,
106+
repo: context.repo.repo,
107+
issue_number: context.issue.number,
108+
name: 'needs-info'
109+
});
110+
}

INSTALLATION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ This guide provides step-by-step instructions for installing the JSON Schema Web
2626
- [Formatting](#formatting)
2727
- [Linting](#linting)
2828
- [Husky for Git Hooks](#husky-for-git-hooks)
29-
6. [Run locally using Docker](#docker-deployment)
29+
6. [Run locally using Docker](#run-locally-using-docker)
3030
- [Prerequisites](#prerequisites)
3131
- [Steps](#steps)
3232

components/Sidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const DocLinkBlank = ({
6565
return (
6666
<Link
6767
href={uri}
68-
className={classnames('flex text-sm block py-1 pl-2', {
68+
className={classnames('flex text-sm py-1 pl-2', {
6969
'font-medium': !isActive,
7070
'text-primary text-bold border-l-2 border-l-primary font-semibold':
7171
isActive,

data/tooling-data.yaml

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,7 +1737,7 @@
17371737

17381738
- name: Stoplight JSON Schema Tree
17391739
toolingTypes: ['schema-to-web-UI']
1740-
languages: ['Typescript']
1740+
languages: ['TypeScript']
17411741
maintainers:
17421742
- name: 'Stoplight'
17431743
username: 'stoplightio'
@@ -1751,7 +1751,7 @@
17511751
- name: Stoplight JSON Schema Viewer
17521752
description: 'A JSON Schema viewer React component'
17531753
toolingTypes: ['schema-to-web-UI']
1754-
languages: ['Typescript']
1754+
languages: ['TypeScript']
17551755
maintainers:
17561756
- name: 'Stoplight'
17571757
username: 'stoplightio'
@@ -2461,7 +2461,7 @@
24612461
- name: Jsonary
24622462
description: 'Quickly assemble clients for JSON-based APIs (powered by JSON Schema)'
24632463
toolingTypes: ['hyper-schema']
2464-
languages: ['Javascript']
2464+
languages: ['JavaScript']
24652465
license: 'MIT'
24662466
source: 'https://github.com/jsonary-js/jsonary'
24672467
supportedDialects:
@@ -3131,7 +3131,7 @@
31313131

31323132
- name: JSV
31333133
description: 'A generic JSON Schema validator for Elixir'
3134-
environments: ['Linux', 'MacOS', 'Windows','Embedded platform']
3134+
environments: ['Linux', 'macOS', 'Windows','Embedded platform']
31353135
toolingTypes: ['validator']
31363136
languages: ['Elixir', 'Erlang']
31373137
maintainers:
@@ -3192,4 +3192,35 @@
31923192
license: 'Apache License 2.0'
31933193
source: 'https://github.com/kenspirit/json-2-joi'
31943194

3195+
- name: 'joi-to-json'
3196+
description: 'Support converting different version''s joi schema to JSON Schema using describe api'
3197+
toolingTypes: ['code-to-schema','util-general-processing','util-format-conversion']
3198+
languages: ['JavaScript']
3199+
maintainers:
3200+
- name: 'kenspirit'
3201+
username: 'kenspirit'
3202+
platform: 'github'
3203+
license: 'MIT'
3204+
source: 'https://github.com/kenspirit/joi-to-json'
3205+
supportedDialects:
3206+
draft: ['4','6','7','2019-09','2020-12']
3207+
additional:
3208+
- name: 'OpenAPI 3.0'
3209+
source: 'https://spec.openapis.org/oas/v3.0.0'
3210+
- name: 'OpenAPI 3.1'
3211+
source: 'https://spec.openapis.org/oas/v3.1.0'
3212+
3213+
- name: 'json-schema'
3214+
description: 'A Ruby JSON Schema Validator ensures that JSON data adheres to a predefined structure, preventing errors and maintaining data integrity in applications.'
3215+
toolingTypes:
3216+
['validator']
3217+
languages: ['Ruby']
3218+
maintainers:
3219+
- name: 'Vox Pupuli'
3220+
platform: 'github'
3221+
license: 'MIT'
3222+
source: 'https://github.com/voxpupuli/json-schema/'
3223+
homepage: 'https://github.com/voxpupuli/json-schema/'
3224+
supportedDialects:
3225+
draft: ['1', '2', '3', '4', '6']
31953226

data/use-cases.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
},
2626
{
2727
"title": "Data Serialization",
28-
"summary": "Compress JSON data for storage/transmission. For example: <a href='https://jsonbinpack.sourcemeta.com' style='text-decoration: underline; font-weight: bold;'>https://jsonbinpack.sourcemeta.com</a>"
28+
"summary": "Compress JSON data for storage/transmission. For example: <a href='https://jsonbinpack.sourcemeta.com' style='text-decoration: underline; font-weight: bold;'>JSON Bin Pack</a>"
2929
},
3030
{
3131
"title": "Fuzzing, enumeration, and generation",
@@ -37,7 +37,7 @@
3737
},
3838
{
3939
"title": "Automated Testing",
40-
"summary": "Good definitions of input/output that schemas provide enable contract and property based testing scenarios. For example: <a href='https://schemathesis.readthedocs.io/en/stable/' style='text-decoration: underline; font-weight: bold;'>https://schemathesis.readthedocs.io/en/stable/</a>"
40+
"summary": "Good definitions of input/output that schemas provide enable contract and property-based testing scenarios. For example: <a href='https://schemathesis.readthedocs.io/en/stable/' style='text-decoration: underline; font-weight: bold;'>Schemathesis</a>"
4141
},
4242
{
4343
"title": "Machine-readable profiles of Web resources",

pages/404.page.tsx

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import React, { useEffect, useState } from 'react';
2+
import Link from 'next/link';
3+
import { useTheme } from 'next-themes';
4+
5+
const Logo = () => {
6+
const { resolvedTheme } = useTheme();
7+
const [imageSrc, setImageSrc] = useState('/img/logos/logo-blue.svg');
8+
9+
useEffect(() => {
10+
const src =
11+
resolvedTheme === 'dark'
12+
? '/img/logos/logo-white.svg'
13+
: '/img/logos/logo-blue.svg';
14+
setImageSrc(src);
15+
}, [resolvedTheme]);
16+
17+
return (
18+
<Link href='/' className=''>
19+
<img
20+
src={imageSrc}
21+
className='h-8 lg:h-12 top-12 absolute left-1/2 -translate-x-1/2'
22+
/>
23+
</Link>
24+
);
25+
};
26+
27+
export default function PageNotFound() {
28+
return (
29+
<div className='h-screen w-full flex flex-col gap-8 items-center justify-center font-semibold text-center'>
30+
<Logo />
31+
<h1 className='leading-header text-h1 hidden lg:block'>
32+
404 - Page Not Found!
33+
</h1>
34+
35+
<h1 className='lg:hidden text-h1 drop-shadow-[0px_0px_30px_rgba(148,163,184,0.9)]'>
36+
404
37+
</h1>
38+
<h1 className='lg:hidden text-h5mobile'>Page Not Found!</h1>
39+
40+
<div className='font-light text-sm lg:text-xl'>
41+
The page you were looking for doesn't exist.
42+
</div>
43+
<Link
44+
href='/'
45+
className='flex items-center justify-center rounded border-2 border-white dark:border-none hover:bg-blue-700 transition-all duration-300 ease-in-out text-white w-[194px] h-10 font-semibold bg-primary dark:shadow-2xl'
46+
>
47+
BACK TO HOME
48+
</Link>
49+
</div>
50+
);
51+
}

pages/blog/index.page.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,15 +246,19 @@ export default function StaticMarkdownPage({
246246

247247
return (
248248
<section key={blogPost.slug}>
249-
<div className='sm:h-[498px] flex border rounded-lg shadow-sm hover:shadow-lg transition-all overflow-hidden dark:border-slate-500'>
249+
<div className='h-[510px] flex border rounded-lg shadow-sm hover:shadow-lg transition-all overflow-hidden dark:border-slate-500'>
250250
<Link
251251
href={`/blog/posts/${blogPost.slug}`}
252252
className='inline-flex flex-col flex-1 w-full'
253253
>
254-
<div
255-
className='bg-slate-50 h-[160px] w-full self-stretch mr-3 bg-cover bg-center'
256-
style={{ backgroundImage: `url(${frontmatter.cover})` }}
257-
/>
254+
<div className=' h-max-[200px] w-full object-cover'>
255+
<div
256+
className='bg-slate-50 h-[160px] w-full self-stretch mr-3 bg-cover bg-center'
257+
style={{
258+
backgroundImage: `url(${frontmatter.cover})`,
259+
}}
260+
/>
261+
</div>
258262
<div className=' p-4 flex flex-col flex-1 justify-between'>
259263
<div>
260264
<div>
@@ -277,7 +281,7 @@ export default function StaticMarkdownPage({
277281
{frontmatter.type || 'Unknown Type'}
278282
</div>
279283
</div>
280-
<div className='text-lg font-semibold'>
284+
<div className='text-lg h-[80px] font-semibold'>
281285
{frontmatter.title}
282286
</div>
283287

pages/learn/getting-started-step-by-step/getting-started-step-by-step.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -581,10 +581,10 @@ With the external schema reference, the overall schema looks like this:
581581

582582
## Validate JSON data against the schema
583583

584-
Now that you have your JSON Schema is time to validate [JSON data](https://json-schema.org/learn/glossary#instance) against it using a [JSON Schema Validator](https://json-schema.org/tools?query=&sortBy=name&sortOrder=ascending&groupBy=toolingTypes&licenses=&languages=&drafts=&toolingTypes=validator).
584+
Now that you have your JSON Schema, it is time to validate [JSON data](https://json-schema.org/learn/glossary#instance) against it using a [JSON Schema Validator](https://json-schema.org/tools?query=&sortBy=name&sortOrder=ascending&groupBy=toolingTypes&licenses=&languages=&drafts=&toolingTypes=validator).
585585

586-
A Validator is a tool that implements the JSON Schema specification. All validators works in a similar way: they take a JSON Schema and a JSON Instance as input and they returns the validation result as output.
586+
A Validator is a tool that implements the JSON Schema specification. All validators works in a similar way: they take a JSON Schema and a JSON Instance as input and they return the validation result as output.
587587

588588
![How JSON Schema works](https://json-schema.org/img/json_schema.svg)
589589

590-
To try it yourself, please visit [Tools](https://json-schema.org/tools#validators) and select the validator that better suit your needs, or use the editors available below to explore the different Schemas and Instances and see the different validation results.
590+
To try it yourself, please visit [Tools](https://json-schema.org/tools#validators) and select the validator that best suits your needs, or use the editors available below to explore the different Schemas and Instances and see the different validation results.

0 commit comments

Comments
 (0)