openapi-diff icon indicating copy to clipboard operation
openapi-diff copied to clipboard

Spec transformation to stay backward-compatible

Open jmini opened this issue 6 years ago • 5 comments

This is more a question or a feature request than a real issue.

We would like to try following approach:


Given two specifications (old.yaml and new.yaml) representing two versions (v1 and v2) of an API. They are similar (say 90% for example) but there are braking changes between the two specs.

There could be a way to compute a second version of old.yaml (say old2.yaml) containing only the backward-compatible changes that are requested in order to transform old.yaml into new.yaml.


Is this something that someone has already investigated? I think that the diff computed by openapi-diff tool is a good basis to realise a tool like this. Is someone else interested?

Thank you in advance for your feedback.

Do not hesitate to tell, if I am not clear enough about what I mean.

jmini avatar Mar 26 '18 09:03 jmini

Yes it's a good idea. A tool which automate the generation of a backward compatible contract could be useful.

quen2404 avatar Mar 26 '18 18:03 quen2404

Thank you for your feedback.

Maybe a first step is to have the possibility to apply a diff result on a specification. Take spec1 and spec2: with the ChangedOpenApi object obtained with OpenApiCompare.fromSpecifications(spec1, spec2), when its content is applied to spec1, I should obtain spec2.

jmini avatar Mar 28 '18 05:03 jmini

Hi, first thanks for this amazing tool <3 I am planning to have a CI step/job in one of my projects to check for backwards incompatible changes between an old spec and new one. Reading the documentation I am a bit confused about how to do that without parsing the output result message.

I am not interested in the output in that particular step, I only want openapi-diff to exit with 0 if there are no breaking changes or with an error if there was breaking changes.

What would be the proper command for that? @quen2404

itsjavi avatar Apr 16 '18 16:04 itsjavi

I would appreciate if you were using an other issue to ask a question, because this has nothing to do with this issue. I will be happy to discuss it with you and to help you.

jmini avatar Apr 16 '18 17:04 jmini

@jmini yeah sorry. I opened an issue for that.

itsjavi avatar Apr 16 '18 17:04 itsjavi