File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " eslint-plugin-json-schema-validator " : minor
3+ ---
4+
5+ feat: normalize schemastore URLs to use ` www.schemastore.org `
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ function loadJsonInternal<T>(
4242 edit ?: ( json : unknown ) => T ,
4343) : null | T {
4444 if ( jsonPath . startsWith ( "http://" ) || jsonPath . startsWith ( "https://" ) ) {
45- return loadJsonFromURL ( jsonPath , context , edit ) ;
45+ return loadJsonFromURL ( normalizeSchemaUrl ( jsonPath ) , context , edit ) ;
4646 }
4747 if ( jsonPath . startsWith ( "vscode://" ) ) {
4848 let url = `https://raw.githubusercontent.com/ota-meshi/extract-vscode-schemas/main/resources/vscode/${ jsonPath . slice (
@@ -78,6 +78,21 @@ function loadJsonInternal<T>(
7878 return edit ? edit ( data ) : data ;
7979}
8080
81+ /**
82+ * Normalize schema URL to use the official schemastore domain.
83+ */
84+ function normalizeSchemaUrl ( url : string ) : string {
85+ for ( const prefix of [
86+ "https://json.schemastore.org/" ,
87+ "http://json.schemastore.org/" ,
88+ ] ) {
89+ if ( url . startsWith ( prefix ) ) {
90+ return `https://www.schemastore.org/${ url . slice ( prefix . length ) } ` ;
91+ }
92+ }
93+ return url ;
94+ }
95+
8196/** remove empty `enum:` schema */
8297function removeEmptyEnum (
8398 // eslint-disable-next-line @typescript-eslint/no-explicit-any -- ignore
You can’t perform that action at this time.
0 commit comments