update and generate code

This commit is contained in:
Hayden 2022-10-29 12:25:49 -08:00
parent 3a93e336c9
commit 4b7f279bcc
5 changed files with 46 additions and 46 deletions

View file

@ -28,7 +28,7 @@ type (
// @Param type formData string true "Type of file" // @Param type formData string true "Type of file"
// @Param name formData string true "name of the file including extension" // @Param name formData string true "name of the file including extension"
// @Success 200 {object} repo.ItemOut // @Success 200 {object} repo.ItemOut
// @Failure 422 {object} []server.ValidationError // @Failure 422 {object} server.ErrorResponse
// @Router /v1/items/{id}/attachments [POST] // @Router /v1/items/{id}/attachments [POST]
// @Security Bearer // @Security Bearer
func (ctrl *V1Controller) HandleItemAttachmentCreate() server.HandlerFunc { func (ctrl *V1Controller) HandleItemAttachmentCreate() server.HandlerFunc {

View file

@ -395,10 +395,7 @@ const docTemplate = `{
"422": { "422": {
"description": "Unprocessable Entity", "description": "Unprocessable Entity",
"schema": { "schema": {
"type": "array", "$ref": "#/definitions/server.ErrorResponse"
"items": {
"$ref": "#/definitions/server.ValidationError"
}
} }
} }
} }
@ -1735,6 +1732,20 @@ const docTemplate = `{
} }
} }
}, },
"server.ErrorResponse": {
"type": "object",
"properties": {
"error": {
"type": "string"
},
"fields": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
},
"server.Result": { "server.Result": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -1754,17 +1765,6 @@ const docTemplate = `{
"items": {} "items": {}
} }
}, },
"server.ValidationError": {
"type": "object",
"properties": {
"field": {
"type": "string"
},
"reason": {
"type": "string"
}
}
},
"services.UserRegistration": { "services.UserRegistration": {
"type": "object", "type": "object",
"properties": { "properties": {

View file

@ -387,10 +387,7 @@
"422": { "422": {
"description": "Unprocessable Entity", "description": "Unprocessable Entity",
"schema": { "schema": {
"type": "array", "$ref": "#/definitions/server.ErrorResponse"
"items": {
"$ref": "#/definitions/server.ValidationError"
}
} }
} }
} }
@ -1727,6 +1724,20 @@
} }
} }
}, },
"server.ErrorResponse": {
"type": "object",
"properties": {
"error": {
"type": "string"
},
"fields": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
},
"server.Result": { "server.Result": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -1746,17 +1757,6 @@
"items": {} "items": {}
} }
}, },
"server.ValidationError": {
"type": "object",
"properties": {
"field": {
"type": "string"
},
"reason": {
"type": "string"
}
}
},
"services.UserRegistration": { "services.UserRegistration": {
"type": "object", "type": "object",
"properties": { "properties": {

View file

@ -394,6 +394,15 @@ definitions:
name: name:
type: string type: string
type: object type: object
server.ErrorResponse:
properties:
error:
type: string
fields:
additionalProperties:
type: string
type: object
type: object
server.Result: server.Result:
properties: properties:
details: {} details: {}
@ -407,13 +416,6 @@ definitions:
properties: properties:
items: {} items: {}
type: object type: object
server.ValidationError:
properties:
field:
type: string
reason:
type: string
type: object
services.UserRegistration: services.UserRegistration:
properties: properties:
email: email:
@ -708,9 +710,7 @@ paths:
"422": "422":
description: Unprocessable Entity description: Unprocessable Entity
schema: schema:
items: $ref: '#/definitions/server.ErrorResponse'
$ref: '#/definitions/server.ValidationError'
type: array
security: security:
- Bearer: [] - Bearer: []
summary: imports items into the database summary: imports items into the database

View file

@ -247,6 +247,11 @@ export interface UserUpdate {
name: string; name: string;
} }
export interface ServerErrorResponse {
error: string;
fields: Record<string, string>;
}
export interface ServerResult { export interface ServerResult {
details: any; details: any;
error: boolean; error: boolean;
@ -258,11 +263,6 @@ export interface ServerResults {
items: any; items: any;
} }
export interface ServerValidationError {
field: string;
reason: string;
}
export interface UserRegistration { export interface UserRegistration {
email: string; email: string;
name: string; name: string;