garethr / puppet-swagger-generator

Generate Puppet types and providers from Swagger specifications
MIT License
11 stars 7 forks source link

Fix fuzzy_compare to properly work with arrays. #5

Open modax opened 8 years ago

modax commented 8 years ago

Actually this is a rewrite of fuzzy_compare which primarily make it work with arrays.

Current implementation was not correct with more than one element in the array. What is more, I believe that when comparing kubernetes descriptors we should compare arrays by their content ignoring element order. That's because kubernetes will reorder elements in arrays (I can't think of a case where element order is significant) after initial descriptor upload.


This is 1:1 based on commit you already cherry-picked in gareth-kubernetes from my fork: https://github.com/garethr/garethr-kubernetes/commit/accf0b5b279d88fd0edd91ac0a70984894fe5ffc

masterzen commented 6 years ago

@modax,

I see at least one instance where array order is important: container command arguments. But we can possibly live with this drawback.

But, more important, your version seems incorrect to me. In our tests, it seems it always compares all elements of is to only the first element of should, leaving out the other elements of should.