-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
Problem statement
I'm trying to use swagger models with my db calls is an sql server seems like is case sensitive. I'm using golang btw.
Swagger specification
AccountsModel:
type: object
required:
- id
- account-no
- description
- customer-no
- customer-name
properties:
id:
type: integer
account-no:
type: string
description:
type: string
customer-no:
type: string
customer-name:
type: string`
I use the --struct-tags db
to add the db tag to the struct
this generates the following:
type AccountsModel struct {
// id
// Required: true
ID *int64 `json:"id" db:"id"`
// account no
// Required: true
AccountNo *string `json:"account-no" db:"account-no"`
// description
// Required: true
Description *string `json:"description" db:"description"`
// customer no
// Required: true
CustomerNo *string `json:"customer-no" db:"customer-no"`
// customer name
// Required: true
CustomerName *string `json:"customer-name" db:"customer-name"`
}
I need to be able to have db:"Id" (pascal case) instead of db:"id" but the json needs to stay the same is there a way to customize the format for each struct tag ?
swagger version: 0.27.0
go version: 1.15.6
OS:
Metadata
Metadata
Assignees
Labels
No labels