Java Design
Speakeasy-generated Java SDKs are designed to be easy to use and debug. The decisions made to guide the design of the SDK in an optimal direction include:
- Using as few dependencies as possible. We use the Jackson Library (opens in a new tab) to (de)serialize our models and java.net HttpClients to make our HTTP requests.
- Generating types that can discriminate between required fields and optional fields. We use constructors that take the required fields as arguments to eliminate
400 BAD REQUEST
responses that result from users not knowing that the query-param field is required in a request body, etc.
// ...
HashMap<String, String[]> m = new HashMap<String, String[]>() {
{
put("key", new String[]{ "value1", "value2" });
}
};
ApiInput api = new ApiInput("api_id", "description", "version_id") {
{
metaData = m;
}
};
// ...
If you have any feedback or want to suggest improvements or ask for a new feature, please reach out to us in
the #client-sdks
channel on
our public Slack (opens in a new tab).