Skip to content

Latest commit

 

History

History

op_handler

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Operation Handlers package

Go Reference

Introduction

This package provides a set of Operation Handlers that plays well with hureg library.

Operation Handlers are used in Huma to modify an operation before registration.

type OperationHandler func(op *huma.Operation)

Normally, they are passed to huma.Get(), huma.Post(), etc. functions as the last arguments.

Hureg usage

With hureg you still can use them as usual, but you can also add them to the APIGen instance to apply them to all operations registered with this instance.

derivedApi := api.AddOpHandler(oh1, oh2)

hureg.Get(derivedApi, "/cat", catHandler)  // oh1 and oh2 will be applied to the operation

Package contents

Package provides a set of Operation Handlers that can be used both in registration function (hureg.Get(), hureg.Post(), ..., hureg.Register()) and in APIGen.AddOpHandler() method to apply them to all operations registered with the APIGen instance.

Even though the handlers follow the standard Huma func(op *huma.Operation) signature, some of them require operation metadata keys specific to hureg library.

Index

What can you do with provided Operation Handlers is: