Skip to content

Commit

Permalink
test(reference): load YAML using JSON Schema
Browse files Browse the repository at this point in the history
This is specific to Swagger Client YAML parser
plugin.

Refs #2289
  • Loading branch information
char0n committed Dec 12, 2022
1 parent 2b5313e commit 0249a16
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import stampit from 'stampit';
// @ts-ignore
import YAML from 'js-yaml'; // js-yaml comes with swagger-client
import YAML, { JSON_SCHEMA } from 'js-yaml'; // js-yaml comes with swagger-client
import { ParseResultElement, from } from '@swagger-api/apidom-core';
import { mediaTypes } from '@swagger-api/apidom-parser-adapter-yaml-1-2';

Expand All @@ -24,7 +24,7 @@ const YamlParser: stampit.Stamp<IParser> = stampit(Parser, {
if (hasSupportedMediaType) return true;
if (!hasSupportedMediaType) {
try {
YAML.load(file.toString());
YAML.load(file.toString(), { schema: JSON_SCHEMA });
return true;
} catch {
return false;
Expand Down

0 comments on commit 0249a16

Please sign in to comment.