OpenAPITools / OpenAPITools/openapi-diff

The current openapi-diff implementation does not capture differences in extensions that occur at the properties level (attributes under the type object) and the path level

Open
#604 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.1k
Forks
190
PR merge metrics
No merged PRs in 30d

Description

Discussed in https://github.com/OpenAPITools/openapi-diff/discussions/603

Originally posted by rupeshkumarmall December 28, 2023
I have two *.yaml files named pet_source.yaml and pet_target.yaml. The requirement is to identify the differences between the source and target files specifically related to the extension "x-lifecycle."

The extension "x-lifecycle" is utilized in lines 15, 18, 20, and 92 within the pet_source.yaml file. Currently, the implementation can detect the differences concerning the extension only for the differences found in lines 15 and 20 (between source and target schema), but not for the other two instances (when used under the path and the properties scope). However, it should be functioning, at the very least, for the path, as PathDiff.java incorporates ExtensionDiff.

To enhance the implementation, ### can we extend it by introducing the PropertiesDiff.java and ChangedProperties.java classes, along with other necessary modifications in the core implementation, to recognize differences at the property level as well (solely concerning the "x-lifecycle" extension)?

By the way, I have already added another diff implementation that identifies the difference w.r.t the extension "x-lifecycle" as mentioned below,
public class XLifecycleExtensionDiff implements ExtensionDiff

Also added a file under resources directory, openapi-diff-2.0.1\core\src\main\resources\META-INF\services\org.openapitools.openapidiff.core.compare.ExtensionDiff with the content "org.openapitools.openapidiff.core.compare.XLifecycleExtensionDiff"

Attaching the source & the target file,
sample_yaml_for_diff.zip

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing PathDiff.java, the ExtensionDiff interface, and the proposed XLifecycleExtensionDiff implementation, then inspect the attached pet_source.yaml and pet_target.yaml examples. Trace how extension differences are currently reported at schema, path, and property scopes. Done means x-lifecycle differences are detected for the path and properties cases described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.