Skip to content

Commit

Permalink
fix(json-schema): fix media type versions (#1856)
Browse files Browse the repository at this point in the history
Refs #1814
  • Loading branch information
char0n authored Aug 18, 2022
1 parent 3c7ce6b commit 82b8988
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions packages/apidom-ns-json-schema-draft-4/src/media-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class JSONSchemaDraft4MediaTypes extends MediaTypes<string> {
return this.filter((mediaType) => mediaType.includes(effectiveFormat));
}

findBy(version = 'draft-4', format: Format = 'generic') {
findBy(version = 'draft-04', format: Format = 'generic') {
const search =
format === 'generic' ? `schema;version=${version}` : `schema+${format};version=${version}`;
const found = this.find((mediaType) => mediaType.includes(search));
Expand All @@ -23,9 +23,9 @@ export class JSONSchemaDraft4MediaTypes extends MediaTypes<string> {
}

const mediaTypes = new JSONSchemaDraft4MediaTypes(
'application/schema;version=draft-4',
'application/schema+json;version=draft-4',
'application/schema+yaml;version=draft-4',
'application/schema;version=draft-04',
'application/schema+json;version=draft-04',
'application/schema+yaml;version=draft-04',
);

export default mediaTypes;
8 changes: 4 additions & 4 deletions packages/apidom-ns-json-schema-draft-6/src/media-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class JSONSchemaDraft6MediaTypes extends MediaTypes<string> {
return this.filter((mediaType) => mediaType.includes(effectiveFormat));
}

findBy(version = 'draft-6', format: Format = 'generic') {
findBy(version = 'draft-06', format: Format = 'generic') {
const search =
format === 'generic' ? `schema;version=${version}` : `schema+${format};version=${version}`;
const found = this.find((mediaType) => mediaType.includes(search));
Expand All @@ -23,9 +23,9 @@ export class JSONSchemaDraft6MediaTypes extends MediaTypes<string> {
}

const mediaTypes = new JSONSchemaDraft6MediaTypes(
'application/schema;version=draft-6',
'application/schema+json;version=draft-6',
'application/schema+yaml;version=draft-6',
'application/schema;version=draft-06',
'application/schema+json;version=draft-06',
'application/schema+yaml;version=draft-06',
);

export default mediaTypes;
8 changes: 4 additions & 4 deletions packages/apidom-ns-json-schema-draft-7/src/media-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class JSONSchemaDraft7MediaTypes extends MediaTypes<string> {
return this.filter((mediaType) => mediaType.includes(effectiveFormat));
}

findBy(version = 'draft-7', format: Format = 'generic') {
findBy(version = 'draft-07', format: Format = 'generic') {
const search =
format === 'generic' ? `schema;version=${version}` : `schema+${format};version=${version}`;
const found = this.find((mediaType) => mediaType.includes(search));
Expand All @@ -23,9 +23,9 @@ export class JSONSchemaDraft7MediaTypes extends MediaTypes<string> {
}

const mediaTypes = new JSONSchemaDraft7MediaTypes(
'application/schema;version=draft-7',
'application/schema+json;version=draft-7',
'application/schema+yaml;version=draft-7',
'application/schema;version=draft-07',
'application/schema+json;version=draft-07',
'application/schema+yaml;version=draft-07',
);

export default mediaTypes;

0 comments on commit 82b8988

Please sign in to comment.