Skip to content
Merged
Changes from all 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
15 changes: 10 additions & 5 deletions packages/format/src/describe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ export interface SchemaInfo {
rootSchema: JSONSchema;
}

const parseOptions = {
// merge keys were removed from YAML 1.2 spec but used by these schemas
merge: true
};

export function describeSchema({
schema,
pointer
Expand Down Expand Up @@ -55,8 +60,8 @@ function describeSchemaById({

const yaml = pointToYaml(rootYaml, pointer);

const schema = YAML.parse(yaml);
const rootSchema = YAML.parse(rootYaml);
const schema = YAML.parse(yaml, parseOptions);
const rootSchema = YAML.parse(rootYaml, parseOptions);

return {
id,
Expand All @@ -73,8 +78,8 @@ function describeSchemaByYaml({
}: DescribeSchemaOptions<SchemaByYaml>): SchemaInfo {
const yaml = pointToYaml(referencedYaml, pointer);

const schema = YAML.parse(yaml);
const rootSchema = YAML.parse(referencedYaml);
const schema = YAML.parse(yaml, parseOptions);
const rootSchema = YAML.parse(referencedYaml, parseOptions);

const id = schema.$id;

Expand Down Expand Up @@ -104,7 +109,7 @@ function describeSchemaByObject({

const yaml = pointToYaml(rootYaml, pointer);

const schema = YAML.parse(yaml);
const schema = YAML.parse(yaml, parseOptions);

const id = schema.$id;

Expand Down