Skip to main content

Introducing Core Libraries in APIMatic Generated SDKs

· 3 min read

APIMatic SDKs now come with core libraries that improve code quality, reduce SDK size, and provide better test coverage for all SDKs.


As part of our goal to create high-quality SDKs that serve as a replacement for hand-crafted SDKs, APIMatic works continuously on improving the code quality, testability, and usability of the SDKs generated by the APIMatic Code Generator. In this release, we have majorly revamped SDKs to improve the code quality, thanks to the introduction of the new APIMatic Core Libraries. These changes improve code quality, reduce code size, and provide better test coverage than ever. Not only this but we have managed to do this without any breaking changes to the SDK’s interface.

What are the APIMatic Core Libraries?

The APIMatic Core libraries provide a stable runtime that powers all the functionality of our SDKs. This includes functionality like the ability to create HTTP requests, handle responses, facilitate authentication, convert API responses back to class instances, and validate user and server data. The new core libraries provide a stable interface for all SDKs to use these functionalities without having to include this code in the SDK itself.

What are Core Libraries Responsible for?

The newly introduced core libraries are responsible for the following:

  • Preprocessing of the request
    • Set and clean all types of parameters
    • Validate parameters (optional and required)
    • Set URL for the API call
    • Set auth managers
    • XML preprocessing
  • Creating the Request
    • Setting up the request with the right parameters
  • Execution of the request
  • Response Handling
    • Deserializing response into required forms
    • Validating the response
    • Status code assertions
    • Converting the response into API response type
    • Exception handling in case of failed request
  • Unit testing
    • Testing all core library components
    • Achieving maximum possible code coverage and branch coverage
    • Testing utilities with meaningful inputs
    • Covering corner cases

What do Core Libraries do for You?

With the introduction of core libraries, you will now see:

  • Cleaner, leaner SDK code as we move the implementation details to the core libraries
  • Faster releases for bug fixes and security patches for your generated SDKs
  • Improved visibility of the test coverage for code that powers your SDK
  • Easier upgrades for major language versions and dependencies releases

Benefits of Introducing Core Libraries

  1. Increase the stability of the SDKs significantly by virtue of improving the implementation in the SDKs & adding unit tests to core libraries.
  2. Provide support for new functionality in the SDKs without requiring the API provider to republish the SDKs.
  3. Easy to solicit feedback or get bug reports from users by making the source code available on GitHub
  4. Reduce the cost of introducing new features and improving the SDKs iteratively
  5. Create the ability to introduce alternative implementations for core functionality like HTTP clients, data validation, configuration loading,
  6. Give us an opportunity to explore making SDKs more customizable

What’s Next?

SDKs generated in multiple languages have been revamped to include the new APIMatic core libraries. To get a detailed idea of this new change in each language, read these changelogs: