Skip to main content

Tegral 0.0.3 release

· 2 min read
utybo

Tegral 0.0.3 fixes a few things from the 0.0.2 updates. It also adds a new integration for Ktor resources.

An image of a foggy mountain scenery

This release is much less packed than the 0.0.2 version but features something new: a community contribution! On a personal note, I never really expected to see PRs from other people -- I knew that my previous project Koa (which Tegral OpenAPI replaces) gained some traction, or at least enough for people to say it should be updated.

Without further ado, let's have a look at some highlights from the changelog!

Integration with Ktor Resources

Thanks to @serras' contribution, you can now use Tegral OpenAPI with Ktor's type-safe routing feature (aka resources).

To get started, add the new tegral-openapi-ktor-resources package. You'll then be able to describe endpoints like this:

@Resource("/hello/{name}")
@Serializable
class Hello(val name: String) {
companion object : OpenApiDescription by describeResource({
description = "Returns a greeting"
})
}

This is currently just a shortcut for embedding OpenAPI descriptions in your resources file, which feels more natural.

Have a look at the documentation for more information.

Bug fixes

This release mostly includes small bug fixes:

  • You can now use Tegral artifacts with Java 11+ instead of the previous 17+!

  • Properly deprecate the scope.factory() syntax and the various wrapIn utility functions from Tegral DI. This syntax is useless since the introduction of the new resolution system and I just forgot to deprecate it (oops).

  • Tegral OpenAPI generated null values for examples instead of letting Swagger do its thing and generate one, which led to confusing OpenAPI and Swagger documents. This has been fixed, and OpenAPI no longer generates examples by default.

  • In Tegral Web, the RootConfig was improperly exposed to the DI environment, which led to weird acrobatics being required to retrieve the configuration. This has been fixed and you can now access your configuration objects via its class or via RootConfig.