Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matching of REST operations during comparison #7

Open
iugaidiana opened this issue Feb 3, 2025 · 0 comments
Open

Matching of REST operations during comparison #7

iugaidiana opened this issue Feb 3, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@iugaidiana
Copy link

iugaidiana commented Feb 3, 2025

Package version v1 has operation, for example - GET /api/v2/packages/{packageId}. In v2, user changes name of path parameter from "packageId" to "id", i.e. operation looks like GET /api/v2/packages/{id}. Since path parameters (packageId/id) are variables, then change of path parameter name does not break backward compatibility.

During comparison of v1 vs v2, the system shall match GET /api/v2/packages/{packageId} and GET /api/v2/packages/{id}; compare them and show changes.

The problem is that currently, when we compare v1 vs v2, the system does not match GET /api/v2/packages/{packageId} with GET /api/v2/packages/{id}, but shows that GET /api/v2/packages/{packageId} was deleted and GET /api/v2/packages/{id} was added. The reason is that the system matches operations by operation id. Operation id is generated by the following logic: path elements of operation's path + method; i.e.:

  • GET /api/v2/packages/{packageId} has operation id = api-v2-packages-packageId-get
  • GET /api/v2/packages/{id} operation id = api-v2-packages-Id-get

There are two options to fix this problem:

Option 1: change logic of generation of rest operation id. So the new logic, instead of taking the path parameter name as is, will replace it with some fixed value. For example, instead of path parameter name, use asterisk character. In this case, the operations from the example above will have the same ids:

  • GET /api/v2/packages/{packageId} will have operation id = api-v2-packages-*-get
  • GET /api/v2/packages/{id} will have operation id = api-v2-packages-*-get

Cons of this option is that all links to old operations will be broken.

Option 2: Change the logic of matching operations during comparison. Potential disadvantages of this approach are that applying matching logic at runtime may increase the time of comparison.

In scope of this issue, it is needed to analyze and make assessment of options.

@alagishev alagishev added Epic Umbrella issue for big piece of functionality enhancement New feature or request and removed Epic Umbrella issue for big piece of functionality labels Feb 3, 2025
@alagishev alagishev moved this to Ready in qubership-apihub Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Ready for Dev
Development

No branches or pull requests

2 participants