Header Background Header Background Header Background Header Background Sebastian

Shaping the Scope

Infographic: Shaping the Scope

Once the overall goal is defined, the actual first steps become crucial. Ultimately, the aim is to produce an initial version as quickly as possible—one that already delivers genuine value.

The Highest Priority: Server Stubs and Payload Structs

The highest priority lies with the server stubs, including the payload structs. This is where the first validators will be incorporated—initially without any additional third-party libraries. The foundation, of course, is the JSON IR.

The JSON IR emitter will already support models, operations, namespaces, scalars, enums, and basic validations. Complex generic types, authentication details, or route-specific extensions are deliberately excluded at this stage.

Router-Agnostic Handlers and Integration Tests

The handlers will be created in a router-agnostic manner and verified in integration tests using net/http and Chi. These tests also serve as immediate documentation for using the handlers. It is essential that no additional runtime code from an external library is required—everything comes directly from the generation process.

In this context, a spec-cli.yaml will be defined and integrated into the target project. It specifies settings such as the output path and the package name for the generated code.

Building the Client Library

Building upon this foundation, the client library will be developed. The straightforward, type-safe usage of an API server constructed in this way will further reinforce the correctness of the approach. Topics such as version comparison based on the spec play an important role here.

Next Step: The Mock Server

The next step involves the mock server. The focus is on an elegant interface that makes it fully controllable for integration tests. Only in this way does it become a fully qualified stand-in for the real server.

The CLI Client as the Finishing Touch

Finally, the CLI client will be developed, serving as the concluding piece. It should be considered more of a finishing touch, as the other components already enable full-fledged work with the generated API. However, personally, covering this functionality is very important to me.

This keeps the scope manageable and achievable—and provides a clear roadmap for quickly seeing tangible first results.