From 3101a65edba8940c08b614a0b671f242956cfa23 Mon Sep 17 00:00:00 2001 From: incubator4 Date: Thu, 28 Nov 2024 19:04:19 +0800 Subject: [PATCH] docs: add Oapi-codegen extensions section to README --- docs/README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/README.md b/docs/README.md index 88882c21..3939860e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -35,6 +35,18 @@ generate code would create a `ServerInterface` in `generated.go` file. This inte Use `internal/node/component/aggregator/compoent.go` to implement the API server. +## Oapi-codegen extensions + +Refer to [OpenAPI extensions](https://github.com/oapi-codegen/oapi-codegen?tab=readme-ov-file#openapi-extensions) + +Here are some usage. + +- `x-go-type` to define custom type. +- `x-go-type-import` to import custom type, usually used with `x-go-type` to define custom type. +- `x-go-type-skip-optional-pointer` remove pointer of fileds in structs. +- `x-go-name` override the generated name of a field or a type. +- `x-go-type-name` override the generated name of a type + ## Handle http endpoint Without store `openapi.json` file, `generate.go` will generate `GetSwagger` function to get the swagger object.