Store the old/new $ref on ChangedSchema
Part of #956 (item 1 of 4: storing the old/new $ref on ChangedSchema; the change-list/builder items remain open).
What
ChangedSchema now keeps the $ref values the old and new schemas were referenced by before the diff resolved them:
getOldRef()/getNewRef()(with fluent setters) onChangedSchema, plus the usual equals/hashCode/toString treatment. The values are inert metadata for downstream consumers; they do not affect change detection.- They are captured in
SchemaDiff#computeDiffForReal, the single place every schema pair passes through, right beforeRefPointer#resolveRefdrops the refs. This covers the direct path, the deferred schema cache (the raw schemas are re-diffed there later with their refs intact), property refs, array items, oneOf mappings, and the type-changed result. SchemaDiffResult#compareAdditionalPropertiesbuilds oneChangedSchemaoutside that path (the added/removed additional-properties fallback), so it stores the refs from the raw schemas there too.
No renderer or rule changes; nothing consumes the new fields yet. This builds on the ref-following model from #938 and gives the later R0 change-list slices the location information they need.
Tests
New fixture pair schemaDiff/schema-ref-handling-*.yaml covering the three capture shapes, asserted in SchemaDiffTest#schemaRefsAreKeptOnChangedSchema:
- request body
$refto a component schema: old and new refs kept on the top-levelChangedSchema - a property that is itself a
$refwhose target changed type: refs kept on the propertyChangedSchema(the deferred-cache path) - an inline property change: refs stay null
./mvnw verify passes: 271 core tests, 13 maven-plugin tests, 0 failures (2 pre-existing skips in Swagger2CompatibilityTest). The coveo format check runs as part of the build.
Question on the issue text
The last scope line of #956 says rule and result are "owned by #724", but that issue no longer exists (404). Those fields are untouched here either way; asking in case the ownership moved somewhere this branch of work should reference.
Summary by cubic
ChangedSchema now records the $ref values the old and new schemas were referenced by before the diff resolves them, so downstream consumers can tell which component schemas were compared.
- Ref capture happens in
SchemaDiff#computeDiffForReal, the single path every schema pair passes through, covering request-body, property, array, andoneOf-mapped refs plus the deferred-cache re-diff; the additional-properties fallback inSchemaDiffResult#compareAdditionalPropertiescaptures refs separately. - The stored refs are inert metadata; they don't affect change detection, and no renderer or rule consumes them yet.
- New tests verify refs are kept for a request-body ref and a property ref whose target changed type, and that inline properties keep
nullrefs.
Part of #956 (item 1 of 4). Note the issue's last scope line assigns rule/result ownership to #724, which no longer exists; those fields are untouched here.