typespec-ogen
v0.1.1
Published
TypeSpec helpers for adding [Ogen](https://ogen.dev/) annotations to your API specifications.
Readme
typespec-ogen
TypeSpec helpers for adding Ogen annotations to your API specifications.
Overview
This library provides TypeSpec decorators that generate OpenAPI extensions understood by Ogen.
Installation
npm install typespec-ogenUsage
Import the library in your TypeSpec file:
import "typespec-ogen";@ogenGroup
Set the Ogen group for operations, which affects how they're organized in the generated Go client.
You can apply it to an interface to set a default group for all operations:
@ogenGroup("users")
interface Users {
@get
list(): User[];
@get
get(@path id: string): User;
}Or apply it to individual operations. When applied to both an interface and a specific operation, the operation-level decorator takes precedence:
@ogenGroup("api")
interface Users {
@get
list(): User[];
@ogenGroup("admin")
@get
get(@path id: string): User; // Uses "admin" group
}This will generate x-ogen-operation-group extensions in your OpenAPI spec, organizing operations into logical groups in the generated handler interfaces.
License
MIT
