APIMatic SDKs now come with core libraries that improve code quality, reduce SDK size, and provide better test coverage for all SDKs.
This is a prerelease changelog to help us solicit feedback on core libraries and help our customers prepare for a major Code Generator update.
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
- Increase the stability of the SDKs significantly by virtue of improving the implementation in the SDKs & adding unit tests to core libraries.
- Provide support for new functionality in the SDKs without requiring the API provider to republish the SDKs.
- Easy to solicit feedback or get bug reports from users by making the source code available on GitHub
- Reduce the cost of introducing new features and improving the SDKs iteratively
- Create the ability to introduce alternative implementations for core functionality like HTTP clients, data validation, configuration loading,
- Give us an opportunity to explore making SDKs more customizable
SDKs generated in PHP and Java 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: