Skip to content

Conversation

stueynz
Copy link

@stueynz stueynz commented Jul 7, 2019

Sometimes you don't want all the $ref references to be resolved; added a new options to control which references are dereferenced. e.g.

const options = {
  dereference: {
    circular: true,

    isRefResolved: function(value) {

      // don't resolve where $ref contains the word 'gender'
      return value.$ref.match(/\/gender/g) === null;
    }
  }

@coveralls
Copy link

coveralls commented Jul 7, 2019

Pull Request Test Coverage Report for Build 352

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.04%) to 93.891%

Totals Coverage Status
Change from base Build 348: 0.04%
Covered Lines: 675
Relevant Lines: 708

💛 - Coveralls

@JamesMessinger
Copy link
Member

Seems like this would be a good opportunity to use file-path-filter, which would let people filter $refs based on globs, regular expressions, custom filter functions, or any combination of them.

Also, it seems like this should be a resolve option, not a dereference option. So something like this:

const options = {
  resolve: {
    // don't resolve where $ref contains the word 'gender'
    filter: "!**/gender/**"
  }

@philsturgeon
Copy link
Member

That was a cool suggestion James. If anyone would like to pick that up, please make a new PR!

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.

4 participants