Skip to content

fix: Import ajv from ajv/dist/2020#1

Open
bavulapati wants to merge 1 commit intojviotti:developfrom
bavulapati:use-ajv-2020
Open

fix: Import ajv from ajv/dist/2020#1
bavulapati wants to merge 1 commit intojviotti:developfrom
bavulapati:use-ajv-2020

Conversation

@bavulapati
Copy link
Copy Markdown

@bavulapati bavulapati commented Mar 29, 2025

We are using JSONSchema draft 2020-12, which needs ajv/dist/2020. Ref: stoplightio#2788 (comment)

We are using JSONSchema draft 2020-12, which needs ajv/dist/2020.
Ref: stoplightio#2788 (comment)
@bavulapati
Copy link
Copy Markdown
Author

@jviotti This should resolve the failures the PR stoplightio#2788

@jviotti
Copy link
Copy Markdown
Owner

jviotti commented Mar 31, 2025

Thanks @bavulapati ! Can you send the PR upstream instead, i.e. directly to Spectral? Once we have that fixed, we can continue with the rest.

@bavulapati
Copy link
Copy Markdown
Author

@jviotti How do I do that?
Shall I push this commit onto https://github.com/jviotti/spectral/tree/develop?

@jviotti
Copy link
Copy Markdown
Owner

jviotti commented Mar 31, 2025

You can sent a PR to https://github.com/stoplightio/spectral as you would do for any other open source contribution. i.e. you sent to the source, not to a fork!

knieczyszczak pushed a commit that referenced this pull request Mar 24, 2026
…stoplightio#2905)

If there is an "invalid-ref" error, spectral crashes when using the
markdown formatter, with error:

```

Error #1: Cannot read properties of undefined (reading 'documentationUrl')
          at getRuleDocumentatio…  …umentationUrl.ts:11  if (rule.documentat…
          at markdown              …/src/markdown.ts:19  const ruleDocumenta…
          at formatOutput          …rvices/output.ts:42  return formatters[f…
          at                       …ommands/lint.ts:215  linterResult.result…
          at map
```

This happens because Spectral tries to load the documentationUrl from
the rule related to the error, but "invalid-ref" is not an actual rule,
so rule is null, causing "cannot read properties of undefined". Fix bug
by using optional chaining.

Co-authored-by: tomek-tursa-sb <100731230+tomek-tursa-sb@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants