maykinmedia / zgw-consumers

Django app to store ZGW API configuration
MIT License
1 stars 2 forks source link

generate_oas_component() doesn't support new OAS style for recent 1.2.x versions of ZGW API's #62

Closed Bartvaderkin closed 1 year ago

Bartvaderkin commented 1 year ago

While updating our local copies of the OAS files for the Catalogus API to version 1.2.x we noticed the generate_oas_component() test utility cannot handle the new style of OAS generation.

After debugging this happens because it uses AllOf rules in the schema:

https://github.com/VNG-Realisatie/catalogi-api/blob/42eada7538856e3933b7b44340d1fb0c3d9145d1/src/openapi.yaml#L10911-L10919

Same resource in 1.1.x doesn't:

https://github.com/VNG-Realisatie/catalogi-api/blob/96e3a14aeb4e519588d74f33f49b92b684fe64cf/src/openapi.yaml#L4919

(actual problem happens here because the element obviously doesn't have a type): https://github.com/maykinmedia/zgw-consumers/blob/48ffe933303e55109a6dcb10cdd163d1d93e7338/zgw_consumers/test/component_generation.py#L63)

sergei-maertens commented 1 year ago

Yeah a lot of this tooling should be properly implemented using https://pypi.org/project/openapi3-parser/ which can handle this stuff. I had started a side-project but don't have the time to continue it for these kind of things.

sergei-maertens commented 1 year ago

Closing this as #70 provides a minimal implementation. However, if more than one entry is listed, this probably doesn't behave correctly and in that case I'd seriously start looking into using the openapi3-parser library, for which a separate ticket is in order.