Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path property of error remains empty even if custom function provides some value #2593

Open
johannesmarx opened this issue Mar 4, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@johannesmarx
Copy link

johannesmarx commented Mar 4, 2024

Describe the bug
The path property of the error is not handled correctly when writing custom functions. In case the function also provides some value for the path besides the message, it remains empty after calling new Spectral(resolver).run(openApi).

To Reproduce

  1. Given a custom most simplified function:
export default (targetValue) => {
  return [
   {
      message: "Some issue with servers",
      path: ['servers'],
   },
  ];
};
  1. The linting result will be:
[
  {
    code: 'my-check',
    message: 'Some issue with servers',
    path: [],
    ...
  }
]

Expected behavior
The expected result would also contain the path provided by the custom function as follows:

[
  {
    code: 'my-check',
    message: 'Some issue with servers',
    path: ['servers'],
    ...
  }

Environment (remove any that are not applicable):

  • Library version:
    • stoplight/spectral-cli: 6.11.0
    • stoplight/spectral-ruleset-bundler: 1.5.2
@mnaumanali94 mnaumanali94 added the enhancement New feature or request label May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants