oapi-codegen icon indicating copy to clipboard operation
oapi-codegen copied to clipboard

Replace interface checks by unimplemented embedded struct types.

Open j6sbits opened this issue 9 months ago • 0 comments

Since this pattern var _ StrictServerInterface = (*PetStore)(nil) should be use on very rare cases. Instead of doing so, the code generator could generate an unimplemented struct type that could be embedded into the final user implementation like protoc does with Go generated code based on a .proto file.

That way is by far much more idiomatic than using interfaces, since in practice there is gonna be only one single implementation for such server type.

Technically speaking there is not need for defining an interface for those swagger server types.

j6sbits avatar May 13 '25 13:05 j6sbits