Skip to content
This repository was archived by the owner on Nov 8, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function parseMediaTypeObject(context, MessageBodyClass, element) {
}

if (examples.length > 1) {
parseResult.push(createWarning(namespace, `'${name}' 'examples' only one example is supported, other examples have been ignored`, examples));
parseResult.push(createWarning(namespace, `'${name}' 'examples' only one example is supported, other examples have been ignored`, examples.content[1]));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"examples" is an array and thus doesn't have source maps, we should point to the 1st example which causes the warning for source maps.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this an ideal case for providing multiple source map ranges? 😉 Not that I need them, this solution is fine for Dredd.

}

return parseResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,13 @@ function validateValuesMatchSchema(context, schema) {
function parseSchema(context) {
const { namespace } = context;

const ensureValidType = R.unless(isValidType, createWarning(namespace,
`'Schema Object' 'type' must be either ${types.join(', ')}`));
const ensureValidType = R.unless(
isValidType,
R.compose(
createWarning(namespace, `'Schema Object' 'type' must be either ${types.join(', ')}`),
getValue
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"type" the element passed ot createWarning is a member element and not a value and thus does not contain source maps.

)
);

const parseType = pipeParseResult(namespace,
parseString(context, name, false),
Expand Down