highsidelabs / saloon-sdk-generator

Generate Saloon SDKs from Postman Collections and OpenAPI Specifications.
MIT License
2 stars 5 forks source link

Fix caching of schemas when normalizing #6

Closed dpash closed 5 months ago

dpash commented 5 months ago

We had issues where the wrong type of arrays was being used, due to them using the property name as the cache key. If there were two arrays called item the second property would use the type of the first.

To fix this, we now cache arrays using array-<Type> as the cache key.

Additionally, we were caching items even if they had different properties or description.

The caching has been extracted into it's own class to keep the logic separate.

dpash commented 5 months ago

I've compared all the changes in the generated classes to the SPAPI schema JSON and it looks correct to me. We could cache more schemas if we don't mind the descriptions being different to the schema.

This should fix #4 and https://github.com/jlevers/selling-partner-api/issues/726