Documentation
¶
Index ¶
- func GleeceRequestAuthorization(ctx *gin.Context, check external.SecurityCheck) *external.SecurityError
- func ValidateStartsWithLetter(fl external.ValidationFieldLevel) bool
- type DefinedInSameFile
- type Domicile
- type EmbedsAnError
- type ExtendedController
- func (ec *ExtendedController) DefinedInSameFileRetType() (DefinedInSameFile, error)
- func (ec *ExtendedController) DeprecatedMethodConditional(value uint32) error
- func (ec *ExtendedController) DeprecatedMethodSimple(value uint32) error
- func (ec *ExtendedController) HiddenMethodConditional(value uint32) error
- func (ec *ExtendedController) HiddenMethodSimple(value uint32) error
- func (ec *ExtendedController) ImportedWithCustomAliasRetType() (CustomAlias.ImportedWithCustomAlias, error)
- func (ec *ExtendedController) ImportedWithDefaultAliasRetType(definedElseWhere string) (types.ImportedWithDefaultAlias, error)
- func (ec *ExtendedController) ImportedWithDotRetType() (ImportedWithDot, error)
- func (ec *ExtendedController) ReturnEmbedsAndError() (HoldsVeryNestedStructs, EmbedsAnError)
- type UsersController
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GleeceRequestAuthorization ¶
func GleeceRequestAuthorization(ctx *gin.Context, check external.SecurityCheck) *external.SecurityError
func ValidateStartsWithLetter ¶
func ValidateStartsWithLetter(fl external.ValidationFieldLevel) bool
Custom validation function to check if a string starts with a letter
Types ¶
type DefinedInSameFile ¶
type DefinedInSameFile struct { // Some comment SomeField string `json:"someField" validator:"required,email"` }
@Description Ahhhh
type Domicile ¶
type Domicile struct { // @Description The address Address string `json:"address" validate:"required"` // @Description The number of the house (must be at least 1) HouseNumber int `json:"houseNumber" validate:"gte=1"` }
@Description User's domicile
type EmbedsAnError ¶
type EmbedsAnError struct {
// contains filtered or unexported fields
}
type ExtendedController ¶
type ExtendedController struct {
SomeRandomName.GleeceController // Embedding the GleeceController to inherit its methods
}
ExtendedController @Tag(Something with a space) @Route(/soothing-with-a-space) @Description This is an extended controller
func (*ExtendedController) DefinedInSameFileRetType ¶
func (ec *ExtendedController) DefinedInSameFileRetType() (DefinedInSameFile, error)
A test for simple imports @Method(POST) @Route(/test4) @Response(204) @ErrorResponse(400) <p>Test Error 400</p>
func (*ExtendedController) DeprecatedMethodConditional ¶
func (ec *ExtendedController) DeprecatedMethodConditional(value uint32) error
For conditional @Deprecated annotation test
@Method(GET) @Route(/deprecated-method-2) @Response(204) @Query(value) @Deprecated This method is deprecated
func (*ExtendedController) DeprecatedMethodSimple ¶
func (ec *ExtendedController) DeprecatedMethodSimple(value uint32) error
For simple @Deprecated annotation test
@Method(GET) @Route(/deprecated-method) @Response(204) @Query(value) @Deprecated
func (*ExtendedController) HiddenMethodConditional ¶
func (ec *ExtendedController) HiddenMethodConditional(value uint32) error
For conditional @Hidden annotation test
@Method(GET) @Route(/ignored-method-2) @Response(204) @Query(value) @Hidden($BRANCH=="master")
func (*ExtendedController) HiddenMethodSimple ¶
func (ec *ExtendedController) HiddenMethodSimple(value uint32) error
For simple @Hidden annotation test
@Method(GET) @Route(/ignored-method) @Response(204) @Query(value) @Hidden
func (*ExtendedController) ImportedWithCustomAliasRetType ¶
func (ec *ExtendedController) ImportedWithCustomAliasRetType() (CustomAlias.ImportedWithCustomAlias, error)
A test for simple imports @Query definedElseWhere Testing simple type import @Method(POST) @Route(/test2) @Response(204) @ErrorResponse(400) <p>Test Error 400</p>
func (*ExtendedController) ImportedWithDefaultAliasRetType ¶
func (ec *ExtendedController) ImportedWithDefaultAliasRetType(definedElseWhere string) (types.ImportedWithDefaultAlias, error)
A test for simple imports @Query(definedElseWhere, {name:'someAlias', validate:'required,email'}) Testing simple type import @Method(POST) @Route(/test) @Response(204) @Security(securitySchemaName, { scopes: ["c"]}) @ErrorResponse(400) <p>Test Error 400</p>
func (*ExtendedController) ImportedWithDotRetType ¶
func (ec *ExtendedController) ImportedWithDotRetType() (ImportedWithDot, error)
A test for simple imports @Method(POST) @Route(/test3) @Response(204) @ErrorResponse(400) <p>Test Error 400</p>
func (*ExtendedController) ReturnEmbedsAndError ¶
func (ec *ExtendedController) ReturnEmbedsAndError() (HoldsVeryNestedStructs, EmbedsAnError)
A test for returning embedded errors @Method(POST) @Route(/test/embedded/error, {"someContext": 53553}) @Security(securitySchemaName, { scopes: ["a", "b"]}) @Security(securitySchemaName, { scopes: ["c"]})
type UsersController ¶
type UsersController struct {
SomeRandomName.GleeceController // Embedding the GleeceController to inherit its methods
}
UsersController @Tag(Users) Users @Route(/users) @Description The Users API
func (*UsersController) CreateNewUser ¶
func (ec *UsersController) CreateNewUser(id int, id2 int, email string, name string, origin string, trace string, domicile Domicile) (string, error)
@Description Create a new user @Method(POST) This text is not part of the OpenAPI spec @Route(/user/{user_name}/{user_id}/{user_id_2}) Same here @Query(email, { validate: "required,email" }) The user's email @Path(id, { name: "user_id", validate:"gt=1" }) The user's ID @Path(id2, { name: "user_id_2", validate:"gt=10" }) The user's ID 2 @Path(name, { name: "user_name" }) The user's name @Body(domicile) The user's domicile @Header(origin, { name: "x-origin" }) The request origin @Header(trace) The trace info @Response(200) The ID of the newly created user @ErrorResponse(500) The error when process failed @Security(securitySchemaName, { scopes: ["read:users", "write:users"] })
func (*UsersController) GetUserDomicile ¶
func (ec *UsersController) GetUserDomicile(id string) (Domicile, error)
@Description Get user's domicile @Method(GET) This text is not part of the OpenAPI spec @Route(/user/{id}/domicile) @Path(id) @Response(200) The user's domicile @ErrorResponse(404) The user not found @ErrorResponse(500) The error when process failed @Security(securitySchemaName, { scopes: ["read:users"] })
func (*UsersController) SetUserDomicile ¶
func (ec *UsersController) SetUserDomicile(id string, domicile Domicile) error
@Method(POST) This text is not part of the OpenAPI spec @Route(/user/{id}/domicile) @Path(id) @Body(domicile) @Response(200) The user's domicile @ErrorResponse(404) The user not found @ErrorResponse(500) The error when process failed @Security(securitySchemaName, { scopes: ["read:users"] })