feat(docs): Annotated required params
This commit is contained in:
parent
f5debf58fc
commit
e2cd445aeb
47
docs/docs.go
47
docs/docs.go
@ -100,12 +100,18 @@ const docTemplate = `{
|
|||||||
"definitions": {
|
"definitions": {
|
||||||
"models.Card": {
|
"models.Card": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"code",
|
||||||
|
"id",
|
||||||
|
"runner"
|
||||||
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"code": {
|
"code": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"enabled": {
|
"enabled": {
|
||||||
"type": "boolean"
|
"type": "boolean",
|
||||||
|
"default": true
|
||||||
},
|
},
|
||||||
"id": {
|
"id": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
@ -117,6 +123,10 @@ const docTemplate = `{
|
|||||||
},
|
},
|
||||||
"models.CardRequest": {
|
"models.CardRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"cards",
|
||||||
|
"locale"
|
||||||
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"cards": {
|
"cards": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
@ -135,6 +145,10 @@ const docTemplate = `{
|
|||||||
},
|
},
|
||||||
"models.CertificateRequest": {
|
"models.CertificateRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"locale",
|
||||||
|
"runners"
|
||||||
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"locale": {
|
"locale": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@ -153,6 +167,10 @@ const docTemplate = `{
|
|||||||
},
|
},
|
||||||
"models.ContractRequest": {
|
"models.ContractRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"locale",
|
||||||
|
"runners"
|
||||||
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"locale": {
|
"locale": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@ -171,6 +189,11 @@ const docTemplate = `{
|
|||||||
},
|
},
|
||||||
"models.DistanceDonation": {
|
"models.DistanceDonation": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"amount_per_distance",
|
||||||
|
"donor",
|
||||||
|
"id"
|
||||||
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"amount": {
|
"amount": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
@ -191,6 +214,11 @@ const docTemplate = `{
|
|||||||
},
|
},
|
||||||
"models.Donor": {
|
"models.Donor": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"first_name",
|
||||||
|
"id",
|
||||||
|
"last_name"
|
||||||
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"first_name": {
|
"first_name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
@ -208,6 +236,10 @@ const docTemplate = `{
|
|||||||
},
|
},
|
||||||
"models.Group": {
|
"models.Group": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"id",
|
||||||
|
"name"
|
||||||
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"id": {
|
"id": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
@ -222,6 +254,12 @@ const docTemplate = `{
|
|||||||
},
|
},
|
||||||
"models.Runner": {
|
"models.Runner": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"first_name",
|
||||||
|
"group",
|
||||||
|
"id",
|
||||||
|
"last_name"
|
||||||
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"first_name": {
|
"first_name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
@ -242,6 +280,13 @@ const docTemplate = `{
|
|||||||
},
|
},
|
||||||
"models.RunnerWithDonations": {
|
"models.RunnerWithDonations": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"distance",
|
||||||
|
"first_name",
|
||||||
|
"group",
|
||||||
|
"id",
|
||||||
|
"last_name"
|
||||||
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"distance": {
|
"distance": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
|
@ -91,12 +91,18 @@
|
|||||||
"definitions": {
|
"definitions": {
|
||||||
"models.Card": {
|
"models.Card": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"code",
|
||||||
|
"id",
|
||||||
|
"runner"
|
||||||
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"code": {
|
"code": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"enabled": {
|
"enabled": {
|
||||||
"type": "boolean"
|
"type": "boolean",
|
||||||
|
"default": true
|
||||||
},
|
},
|
||||||
"id": {
|
"id": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
@ -108,6 +114,10 @@
|
|||||||
},
|
},
|
||||||
"models.CardRequest": {
|
"models.CardRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"cards",
|
||||||
|
"locale"
|
||||||
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"cards": {
|
"cards": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
@ -126,6 +136,10 @@
|
|||||||
},
|
},
|
||||||
"models.CertificateRequest": {
|
"models.CertificateRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"locale",
|
||||||
|
"runners"
|
||||||
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"locale": {
|
"locale": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@ -144,6 +158,10 @@
|
|||||||
},
|
},
|
||||||
"models.ContractRequest": {
|
"models.ContractRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"locale",
|
||||||
|
"runners"
|
||||||
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"locale": {
|
"locale": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@ -162,6 +180,11 @@
|
|||||||
},
|
},
|
||||||
"models.DistanceDonation": {
|
"models.DistanceDonation": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"amount_per_distance",
|
||||||
|
"donor",
|
||||||
|
"id"
|
||||||
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"amount": {
|
"amount": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
@ -182,6 +205,11 @@
|
|||||||
},
|
},
|
||||||
"models.Donor": {
|
"models.Donor": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"first_name",
|
||||||
|
"id",
|
||||||
|
"last_name"
|
||||||
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"first_name": {
|
"first_name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
@ -199,6 +227,10 @@
|
|||||||
},
|
},
|
||||||
"models.Group": {
|
"models.Group": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"id",
|
||||||
|
"name"
|
||||||
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"id": {
|
"id": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
@ -213,6 +245,12 @@
|
|||||||
},
|
},
|
||||||
"models.Runner": {
|
"models.Runner": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"first_name",
|
||||||
|
"group",
|
||||||
|
"id",
|
||||||
|
"last_name"
|
||||||
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"first_name": {
|
"first_name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
@ -233,6 +271,13 @@
|
|||||||
},
|
},
|
||||||
"models.RunnerWithDonations": {
|
"models.RunnerWithDonations": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"distance",
|
||||||
|
"first_name",
|
||||||
|
"group",
|
||||||
|
"id",
|
||||||
|
"last_name"
|
||||||
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"distance": {
|
"distance": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
|
@ -4,11 +4,16 @@ definitions:
|
|||||||
code:
|
code:
|
||||||
type: string
|
type: string
|
||||||
enabled:
|
enabled:
|
||||||
|
default: true
|
||||||
type: boolean
|
type: boolean
|
||||||
id:
|
id:
|
||||||
type: integer
|
type: integer
|
||||||
runner:
|
runner:
|
||||||
$ref: '#/definitions/models.Runner'
|
$ref: '#/definitions/models.Runner'
|
||||||
|
required:
|
||||||
|
- code
|
||||||
|
- id
|
||||||
|
- runner
|
||||||
type: object
|
type: object
|
||||||
models.CardRequest:
|
models.CardRequest:
|
||||||
properties:
|
properties:
|
||||||
@ -21,6 +26,9 @@ definitions:
|
|||||||
- en
|
- en
|
||||||
- de
|
- de
|
||||||
type: string
|
type: string
|
||||||
|
required:
|
||||||
|
- cards
|
||||||
|
- locale
|
||||||
type: object
|
type: object
|
||||||
models.CertificateRequest:
|
models.CertificateRequest:
|
||||||
properties:
|
properties:
|
||||||
@ -33,6 +41,9 @@ definitions:
|
|||||||
items:
|
items:
|
||||||
$ref: '#/definitions/models.RunnerWithDonations'
|
$ref: '#/definitions/models.RunnerWithDonations'
|
||||||
type: array
|
type: array
|
||||||
|
required:
|
||||||
|
- locale
|
||||||
|
- runners
|
||||||
type: object
|
type: object
|
||||||
models.ContractRequest:
|
models.ContractRequest:
|
||||||
properties:
|
properties:
|
||||||
@ -45,6 +56,9 @@ definitions:
|
|||||||
items:
|
items:
|
||||||
$ref: '#/definitions/models.Runner'
|
$ref: '#/definitions/models.Runner'
|
||||||
type: array
|
type: array
|
||||||
|
required:
|
||||||
|
- locale
|
||||||
|
- runners
|
||||||
type: object
|
type: object
|
||||||
models.DistanceDonation:
|
models.DistanceDonation:
|
||||||
properties:
|
properties:
|
||||||
@ -58,6 +72,10 @@ definitions:
|
|||||||
type: integer
|
type: integer
|
||||||
paid_amount:
|
paid_amount:
|
||||||
type: integer
|
type: integer
|
||||||
|
required:
|
||||||
|
- amount_per_distance
|
||||||
|
- donor
|
||||||
|
- id
|
||||||
type: object
|
type: object
|
||||||
models.Donor:
|
models.Donor:
|
||||||
properties:
|
properties:
|
||||||
@ -69,6 +87,10 @@ definitions:
|
|||||||
type: string
|
type: string
|
||||||
middle_name:
|
middle_name:
|
||||||
type: string
|
type: string
|
||||||
|
required:
|
||||||
|
- first_name
|
||||||
|
- id
|
||||||
|
- last_name
|
||||||
type: object
|
type: object
|
||||||
models.Group:
|
models.Group:
|
||||||
properties:
|
properties:
|
||||||
@ -78,6 +100,9 @@ definitions:
|
|||||||
type: string
|
type: string
|
||||||
parent_group:
|
parent_group:
|
||||||
$ref: '#/definitions/models.Group'
|
$ref: '#/definitions/models.Group'
|
||||||
|
required:
|
||||||
|
- id
|
||||||
|
- name
|
||||||
type: object
|
type: object
|
||||||
models.Runner:
|
models.Runner:
|
||||||
properties:
|
properties:
|
||||||
@ -91,6 +116,11 @@ definitions:
|
|||||||
type: string
|
type: string
|
||||||
middle_name:
|
middle_name:
|
||||||
type: string
|
type: string
|
||||||
|
required:
|
||||||
|
- first_name
|
||||||
|
- group
|
||||||
|
- id
|
||||||
|
- last_name
|
||||||
type: object
|
type: object
|
||||||
models.RunnerWithDonations:
|
models.RunnerWithDonations:
|
||||||
properties:
|
properties:
|
||||||
@ -114,6 +144,12 @@ definitions:
|
|||||||
type: integer
|
type: integer
|
||||||
total_per_distance:
|
total_per_distance:
|
||||||
type: integer
|
type: integer
|
||||||
|
required:
|
||||||
|
- distance
|
||||||
|
- first_name
|
||||||
|
- group
|
||||||
|
- id
|
||||||
|
- last_name
|
||||||
type: object
|
type: object
|
||||||
info:
|
info:
|
||||||
contact: {}
|
contact: {}
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
type CardRequest struct {
|
type CardRequest struct {
|
||||||
Cards []Card `json:"cards"`
|
Cards []Card `json:"cards" validate:"required"`
|
||||||
Locale string `json:"locale" enums:"en,de"`
|
Locale string `json:"locale" enums:"en,de" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Card struct {
|
type Card struct {
|
||||||
ID int `json:"id"`
|
ID int `json:"id" validate:"required"`
|
||||||
Enabled bool `json:"enabled"`
|
Enabled bool `json:"enabled" default:"true"`
|
||||||
Runner Runner `json:"runner"`
|
Runner Runner `json:"runner" validate:"required"`
|
||||||
Code string `json:"code"`
|
Code string `json:"code" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CardTemplateOptions struct {
|
type CardTemplateOptions struct {
|
||||||
|
@ -1,35 +1,35 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
type CertificateRequest struct {
|
type CertificateRequest struct {
|
||||||
Runners []RunnerWithDonations `json:"runners"`
|
Runners []RunnerWithDonations `json:"runners" validate:"required"`
|
||||||
Locale string `json:"locale" enums:"en,de"`
|
Locale string `json:"locale" enums:"en,de" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type RunnerWithDonations struct {
|
type RunnerWithDonations struct {
|
||||||
ID int `json:"id"`
|
ID int `json:"id" validate:"required"`
|
||||||
FirstName string `json:"first_name"`
|
FirstName string `json:"first_name" validate:"required"`
|
||||||
MiddleName string `json:"middle_name"`
|
MiddleName string `json:"middle_name" validate:"optional"`
|
||||||
LastName string `json:"last_name"`
|
LastName string `json:"last_name" validate:"required"`
|
||||||
Group Group `json:"group"`
|
Group Group `json:"group" validate:"required"`
|
||||||
Distance int `json:"distance"`
|
Distance int `json:"distance" validate:"required"`
|
||||||
DistanceDonations []DistanceDonation `json:"distance_donations"`
|
DistanceDonations []DistanceDonation `json:"distance_donations" validate:"optional"`
|
||||||
TotalPerDistance int `json:"total_per_distance"`
|
TotalPerDistance int `json:"total_per_distance" validate:"optional"`
|
||||||
TotalDonations int `json:"total_donations"`
|
TotalDonations int `json:"total_donations" validate:"optional"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type DistanceDonation struct {
|
type DistanceDonation struct {
|
||||||
ID int `json:"id"`
|
ID int `json:"id" validate:"required"`
|
||||||
Amount int `json:"amount"`
|
Amount int `json:"amount"`
|
||||||
PaidAmount int `json:"paid_amount"`
|
PaidAmount int `json:"paid_amount" validate:"optional"`
|
||||||
AmountPerDistance int `json:"amount_per_distance"`
|
AmountPerDistance int `json:"amount_per_distance" validate:"required"`
|
||||||
Donor Donor `json:"donor"`
|
Donor Donor `json:"donor" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Donor struct {
|
type Donor struct {
|
||||||
ID int `json:"id"`
|
ID int `json:"id" validate:"required"`
|
||||||
FirstName string `json:"first_name"`
|
FirstName string `json:"first_name" validate:"required"`
|
||||||
MiddleName string `json:"middle_name"`
|
MiddleName string `json:"middle_name" validate:"optional"`
|
||||||
LastName string `json:"last_name"`
|
LastName string `json:"last_name" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CertificateTemplateOptions struct {
|
type CertificateTemplateOptions struct {
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
type ContractRequest struct {
|
type ContractRequest struct {
|
||||||
Runners []Runner `json:"runners"`
|
Runners []Runner `json:"runners" validate:"required"`
|
||||||
Locale string `json:"locale" enums:"en,de"`
|
Locale string `json:"locale" enums:"en,de" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Runner struct {
|
type Runner struct {
|
||||||
ID int `json:"id"`
|
ID int `json:"id" validate:"required"`
|
||||||
FirstName string `json:"first_name"`
|
FirstName string `json:"first_name" validate:"required"`
|
||||||
MiddleName string `json:"middle_name"`
|
MiddleName string `json:"middle_name" validate:"optional"`
|
||||||
LastName string `json:"last_name"`
|
LastName string `json:"last_name" validate:"required"`
|
||||||
Group Group `json:"group"`
|
Group Group `json:"group" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Group struct {
|
type Group struct {
|
||||||
ID int `json:"id"`
|
ID int `json:"id" validate:"required"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name" validate:"required"`
|
||||||
ParentGroup *Group `json:"parent_group"`
|
ParentGroup *Group `json:"parent_group" validate:"optional"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ContractTemplateOptions struct {
|
type ContractTemplateOptions struct {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user