openapi-go
openapi-go copied to clipboard
How to use custom x- tags in a schema
If a schema like
components: schemas: CreateSomethingRequest: type: object required: - something properties: something: type: number example: 1 x-oapi-codegen-extra-tags: validate: gte=0
was required, how can this x-oapi-codegen-extra-tags field be specified?
Types that allow custom extensions (x-), usually have a WithMapOfAnythingItem method available (like this).
perfect - thank you for the prompt response
For openapi31 operations you would do:
oc, err := reflector.NewOperationContext(http.MethodGet, "/api/v4/endpoint/{id}")
oc.(openapi31.OperationExposer).Operation().WithMapOfAnythingItem("x-api-name", "getEndpointByID")