chore: refactor api endpoints (#339)

* move typegen code

* update taskfile to fix code-gen caches and use 'dir' attribute

* enable dumping stack traces for errors

* log request start and stop

* set zerolog stack handler

* fix routes function

* refactor context adapters to use requests directly

* change some method signatures to support GID

* start requiring validation tags

* first pass on updating handlers to use adapters

* add errs package

* code gen

* tidy

* rework API to use external server package
This commit is contained in:
Hayden 2023-03-20 20:32:10 -08:00 committed by GitHub
parent 184b494fc3
commit db80f8a159
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
56 changed files with 806 additions and 1947 deletions

View file

@ -417,8 +417,8 @@
}
],
"responses": {
"200": {
"description": "OK",
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/repo.ItemSummary"
}
@ -686,7 +686,7 @@
"422": {
"description": "Unprocessable Entity",
"schema": {
"$ref": "#/definitions/server.ErrorResponse"
"$ref": "#/definitions/mid.ErrorResponse"
}
}
}
@ -856,8 +856,8 @@
}
],
"responses": {
"200": {
"description": "OK",
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/repo.MaintenanceEntry"
}
@ -939,7 +939,7 @@
"schema": {
"allOf": [
{
"$ref": "#/definitions/server.Results"
"$ref": "#/definitions/v1.Wrapped"
},
{
"type": "object",
@ -1111,7 +1111,7 @@
"schema": {
"allOf": [
{
"$ref": "#/definitions/server.Results"
"$ref": "#/definitions/v1.Wrapped"
},
{
"type": "object",
@ -1191,7 +1191,7 @@
"schema": {
"allOf": [
{
"$ref": "#/definitions/server.Results"
"$ref": "#/definitions/v1.Wrapped"
},
{
"type": "object",
@ -1331,7 +1331,7 @@
"schema": {
"allOf": [
{
"$ref": "#/definitions/server.Results"
"$ref": "#/definitions/v1.Wrapped"
},
{
"type": "object",
@ -1711,7 +1711,7 @@
"schema": {
"allOf": [
{
"$ref": "#/definitions/server.Result"
"$ref": "#/definitions/v1.Wrapped"
},
{
"type": "object",
@ -1756,7 +1756,7 @@
"schema": {
"allOf": [
{
"$ref": "#/definitions/server.Result"
"$ref": "#/definitions/v1.Wrapped"
},
{
"type": "object",
@ -1793,6 +1793,20 @@
}
},
"definitions": {
"mid.ErrorResponse": {
"type": "object",
"properties": {
"error": {
"type": "string"
},
"fields": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
},
"repo.DocumentOut": {
"type": "object",
"properties": {
@ -1894,9 +1908,15 @@
},
"repo.ItemCreate": {
"type": "object",
"required": [
"description",
"name"
],
"properties": {
"description": {
"type": "string"
"type": "string",
"maxLength": 1000,
"minLength": 1
},
"labelIds": {
"type": "array",
@ -1909,7 +1929,9 @@
"type": "string"
},
"name": {
"type": "string"
"type": "string",
"maxLength": 255,
"minLength": 1
},
"parentId": {
"type": "string",
@ -2200,15 +2222,21 @@
},
"repo.LabelCreate": {
"type": "object",
"required": [
"name"
],
"properties": {
"color": {
"type": "string"
},
"description": {
"type": "string"
"type": "string",
"maxLength": 255
},
"name": {
"type": "string"
"type": "string",
"maxLength": 255,
"minLength": 1
}
}
},
@ -2655,39 +2683,6 @@
}
}
},
"server.ErrorResponse": {
"type": "object",
"properties": {
"error": {
"type": "string"
},
"fields": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
},
"server.Result": {
"type": "object",
"properties": {
"details": {},
"error": {
"type": "boolean"
},
"item": {},
"message": {
"type": "string"
}
}
},
"server.Results": {
"type": "object",
"properties": {
"items": {}
}
},
"services.UserRegistration": {
"type": "object",
"properties": {
@ -2783,12 +2778,17 @@
},
"v1.GroupInvitationCreate": {
"type": "object",
"required": [
"uses"
],
"properties": {
"expiresAt": {
"type": "string"
},
"uses": {
"type": "integer"
"type": "integer",
"maximum": 100,
"minimum": 1
}
}
},
@ -2813,6 +2813,12 @@
"type": "string"
}
}
},
"v1.Wrapped": {
"type": "object",
"properties": {
"item": {}
}
}
},
"securityDefinitions": {