Skip to content

Conversation

@shockey
Copy link
Contributor

@shockey shockey commented Jan 31, 2018

Description

$$ref meta patches were being attached to the path referenced by a $ref as well as the destination, which was caused by the JSON Patch processor linking the $ref source and destination by referencing the same in-memory Object in both positions. This is bad for two reasons:

  1. there's no need for information about the $ref source path, as it can be deduced by the data's back itself
  2. it becomes impossible to consume $$refs as a marker of a $ref previously being in that position

This PR eliminates this issue by breaking the Object reference between the source and destination.

It also:

  • moves to fast-json-patch@1.2
  • refactors use of op: '_get' to fast-json-patch's new getValueByPointer interface

Motivation and Context

How Has This Been Tested?

I updated a handful of unit tests to match the new $$ref implementation.

Types of changes

  • No code changes (changes to documentation, CI, metadata, etc)
  • Dependency changes (any modification to dependencies in package.json)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Breaking internal API change (requires minor version bump).

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@shockey shockey merged commit a0c9928 into swagger-api:master Jan 31, 2018
rook2pawn pushed a commit to rook2pawn/swagger-js that referenced this pull request Feb 20, 2018
…ns (swagger-api#1237)

* Expect that $$ref will be on patch destinations and not on sources

* Use latest fast-json-patch; don't attach $$ref's to origin

* ESLint fixes
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.

1 participant