x-oapi-codegen-extra-tags
Hello! Here is a simple exmaple of spec:
openapi: 3.0.3
components:
schemas:
queue:
type: object
properties:
ticket:
x-oapi-codegen-extra-tags:
db: ticket,merge
allOf:
- $ref: "#/components/schemas/ticket"
queue2:
type: object
properties:
ticket:
x-oapi-codegen-extra-tags:
db: ticket,merge
$ref: "#/components/schemas/ticket"
ticket:
type: object
properties:
clientName:
type: string
required:
- clientName
Here is generated code:
type Queue struct {
Ticket *Ticket `db:"ticket,merge" json:"ticket,omitempty"`
}
// Queue2 defines model for queue2.
type Queue2 struct {
Ticket *Ticket `json:"ticket,omitempty"`
}
// Ticket defines model for ticket.
type Ticket struct {
ClientName string `json:"clientName"`
}
I found a lifehack to add tags to Ticket field with help of allOf, but i expected it works without allOff. Code was generated with v.2.1.0 generator. Thanks!
Hey @tandem97 to confirm, is this that you're reporting current behaviour or expected behaviour?
Hey @tandem97 to confirm, is this that you're reporting current behaviour or expected behaviour?
Hi! It is current behaviour. I expected struct Queue2 to have tag db too.
Do we have an update here? I am also facing the similar problem. It is common to reuse defined schemas with different tags and names
+1
Any updates?