fix type generator

This commit is contained in:
Hayden 2023-07-27 16:12:25 -05:00
parent c46d691297
commit 9ddce9e28d
No known key found for this signature in database
GPG key ID: 17CF79474E257545
6 changed files with 51 additions and 62 deletions

View file

@ -20,7 +20,7 @@ tasks:
- db:generate - db:generate
cmds: cmds:
- cd backend/app/api/static && swag fmt --dir=../ - cd backend/app/api/static && swag fmt --dir=../
- cd backend/app/api/static && swag init --dir=../,../../../internal,../../../pkgs --parseDependency - cd backend/app/api/static && swag init --dir=../,../../../internal,../../../pkgs
- | - |
npx swagger-typescript-api \ npx swagger-typescript-api \
--no-client \ --no-client \

View file

@ -731,7 +731,7 @@ const docTemplate = `{
"422": { "422": {
"description": "Unprocessable Entity", "description": "Unprocessable Entity",
"schema": { "schema": {
"$ref": "#/definitions/mid.ErrorResponse" "$ref": "#/definitions/validate.ErrorResponse"
} }
} }
} }
@ -1799,20 +1799,6 @@ const docTemplate = `{
} }
}, },
"definitions": { "definitions": {
"mid.ErrorResponse": {
"type": "object",
"properties": {
"error": {
"type": "string"
},
"fields": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
},
"repo.DocumentOut": { "repo.DocumentOut": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -2853,6 +2839,17 @@ const docTemplate = `{
"properties": { "properties": {
"item": {} "item": {}
} }
},
"validate.ErrorResponse": {
"type": "object",
"properties": {
"error": {
"type": "string"
},
"fields": {
"type": "string"
}
}
} }
}, },
"securityDefinitions": { "securityDefinitions": {

View file

@ -723,7 +723,7 @@
"422": { "422": {
"description": "Unprocessable Entity", "description": "Unprocessable Entity",
"schema": { "schema": {
"$ref": "#/definitions/mid.ErrorResponse" "$ref": "#/definitions/validate.ErrorResponse"
} }
} }
} }
@ -1791,20 +1791,6 @@
} }
}, },
"definitions": { "definitions": {
"mid.ErrorResponse": {
"type": "object",
"properties": {
"error": {
"type": "string"
},
"fields": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
},
"repo.DocumentOut": { "repo.DocumentOut": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -2845,6 +2831,17 @@
"properties": { "properties": {
"item": {} "item": {}
} }
},
"validate.ErrorResponse": {
"type": "object",
"properties": {
"error": {
"type": "string"
},
"fields": {
"type": "string"
}
}
} }
}, },
"securityDefinitions": { "securityDefinitions": {

View file

@ -1,14 +1,5 @@
basePath: /api basePath: /api
definitions: definitions:
mid.ErrorResponse:
properties:
error:
type: string
fields:
additionalProperties:
type: string
type: object
type: object
repo.DocumentOut: repo.DocumentOut:
properties: properties:
id: id:
@ -707,6 +698,13 @@ definitions:
properties: properties:
item: {} item: {}
type: object type: object
validate.ErrorResponse:
properties:
error:
type: string
fields:
type: string
type: object
info: info:
contact: contact:
name: Don't name: Don't
@ -1084,7 +1082,7 @@ paths:
"422": "422":
description: Unprocessable Entity description: Unprocessable Entity
schema: schema:
$ref: '#/definitions/mid.ErrorResponse' $ref: '#/definitions/validate.ErrorResponse'
security: security:
- Bearer: [] - Bearer: []
summary: Create Item Attachment summary: Create Item Attachment

View file

@ -723,7 +723,7 @@
"422": { "422": {
"description": "Unprocessable Entity", "description": "Unprocessable Entity",
"schema": { "schema": {
"$ref": "#/definitions/mid.ErrorResponse" "$ref": "#/definitions/validate.ErrorResponse"
} }
} }
} }
@ -1791,20 +1791,6 @@
} }
}, },
"definitions": { "definitions": {
"mid.ErrorResponse": {
"type": "object",
"properties": {
"error": {
"type": "string"
},
"fields": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
},
"repo.DocumentOut": { "repo.DocumentOut": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -2845,6 +2831,17 @@
"properties": { "properties": {
"item": {} "item": {}
} }
},
"validate.ErrorResponse": {
"type": "object",
"properties": {
"error": {
"type": "string"
},
"fields": {
"type": "string"
}
}
} }
}, },
"securityDefinitions": { "securityDefinitions": {

View file

@ -10,11 +10,6 @@
* --------------------------------------------------------------- * ---------------------------------------------------------------
*/ */
export interface MidErrorResponse {
error: string;
fields: Record<string, string>;
}
export interface DocumentOut { export interface DocumentOut {
id: string; id: string;
path: string; path: string;
@ -432,3 +427,8 @@ export interface TokenResponse {
export interface Wrapped { export interface Wrapped {
item: any; item: any;
} }
export interface ValidateErrorResponse {
error: string;
fields: string;
}