-
Notifications
You must be signed in to change notification settings - Fork 0
【WIP】oapi‐codegen使い方
takumi edited this page Sep 17, 2023
·
3 revisions
インストール
go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen@latest
コード生成
oapi-codegen -package petstore petstore-expanded.yaml > petstore.gen.go
オブションのパラメータはポインタで渡される。値が渡されなかった場合はnilとなる。
FindPetsParams
のLimit
とTags
はオプション
// Parameters object for FindPets
type FindPetsParams struct {
Tags *[]string `json:"tags,omitempty"`
Limit *int32 `json:"limit,omitempty"`
}
Limitを必須にした場合は値で渡される
type FindPetsParams struct {
Tags *[]string `json:"tags,omitempty"`
Limit int32 `json:"limit"`
}