Different FHIR Implementation Guides

I am new to FHIR domain and there are lot of things I need to clarify.
I have been developing a tool to simply convert the FHIR resources to OpenAPI/Swagger definitions. There I found difficulty in generalizing the tool in order to support for every FHIR implementation guide. For example, current version supports FHIR general resources and Davinci Payer Data Exchange resources.link

I would highly appreciate if you can help me understand how to relate those extensions to the general FHIR resources.

Thanks in advance.!

Have you looked at the existing openAPI documents that are part of the Implementation Guide?