Skip to content

Linting API documents with $ref lines #1676

Answered by dwhayduk
dwhayduk asked this question in Q&A
Discussion options

You must be logged in to vote

Not sure if this is the best solution, but I did find a workaround. In the custom function, one of the parameters can be otherValues which contains additional information about the linting process. From that object, you can extract a document input which is basically the entire API document in string form. The beginning of such a function looks like this:

module.exports = function (targetVal, opts, paths, otherValues) {
  const { field } = opts;
  const rootPath = paths.target !== void 0 ? paths.target : paths.given;

  const { documentInventory } = otherValues;
  const docString = documentInventory.document.input;

  // Rest of the function
}

With docString, I was then able to identify w…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@P0lip
Comment options

Answer selected by dwhayduk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants