Skip to content

Commit 7d5da8c

Browse files
authored
Merge pull request #13 from flohoss/12-increase-max-length-for-job-name
Push limit of job name to 255
2 parents ae6ae96 + 72cd0bc commit 7d5da8c

File tree

4 files changed

+40
-4
lines changed

4 files changed

+40
-4
lines changed

handlers/jobs.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ type Job struct {
7171
}
7272

7373
func (jh *JobHandler) listJobHandler(ctx context.Context, input *struct {
74-
Name string `path:"name" maxLength:"20" doc:"job name"`
74+
Name string `path:"name" maxLength:"255" doc:"job name"`
7575
Limit int64 `query:"limit" default:"5" doc:"number of runs to return"`
7676
}) (*Job, error) {
7777
jobView, err := jh.JobService.ListJob(input.Name, input.Limit)
@@ -109,7 +109,7 @@ func (jh *JobHandler) executeJobOperation() huma.Operation {
109109
}
110110

111111
func (jh *JobHandler) executeJobHandler(ctx context.Context, input *struct {
112-
Name string `path:"name" maxLength:"20" doc:"job name"`
112+
Name string `path:"name" maxLength:"255" doc:"job name"`
113113
}) (*struct{}, error) {
114114
job, err := jh.JobService.GetQueries().GetJob(context.Background(), input.Name)
115115
if err != nil {

web/openapi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"components":{"schemas":{"ErrorDetail":{"additionalProperties":false,"properties":{"location":{"description":"Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id'","type":"string"},"message":{"description":"Error message text","type":"string"},"value":{"description":"The value at the given location"}},"type":"object"},"ErrorModel":{"additionalProperties":false,"properties":{"$schema":{"description":"A URL to the JSON Schema for this object.","examples":["https://example.com/api/schemas/ErrorModel.json"],"format":"uri","readOnly":true,"type":"string"},"detail":{"description":"A human-readable explanation specific to this occurrence of the problem.","examples":["Property foo is required but is missing."],"type":"string"},"errors":{"description":"Optional list of individual error details","items":{"$ref":"#/components/schemas/ErrorDetail"},"type":["array","null"]},"instance":{"description":"A URI reference that identifies the specific occurrence of the problem.","examples":["https://example.com/error-log/abc123"],"format":"uri","type":"string"},"status":{"description":"HTTP status code","examples":[400],"format":"int64","type":"integer"},"title":{"description":"A short, human-readable summary of the problem type. This value should not change between occurrences of the error.","examples":["Bad Request"],"type":"string"},"type":{"default":"about:blank","description":"A URI reference to human-readable documentation for the error.","examples":["https://example.com/errors/example"],"format":"uri","type":"string"}},"type":"object"},"Information":{"additionalProperties":false,"properties":{"name":{"type":"string"},"repo":{"type":"string"},"version":{"type":"string"}},"required":["name","version","repo"],"type":"object"},"JobsView":{"additionalProperties":false,"properties":{"$schema":{"description":"A URL to the JSON Schema for this object.","examples":["https://example.com/api/schemas/JobsView.json"],"format":"uri","readOnly":true,"type":"string"},"cron":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"},"runs":{"items":{"$ref":"#/components/schemas/RunsView"},"type":["array","null"]}},"required":["id","name","cron","runs"],"type":"object"},"ListLogsByRunIDRow":{"additionalProperties":false,"properties":{"created_at":{"format":"int64","type":"integer"},"created_at_time":{},"message":{"type":"string"},"run_id":{"format":"int64","type":"integer"},"severity_id":{"format":"int64","type":"integer"}},"required":["created_at","run_id","severity_id","message","created_at_time"],"type":"object"},"NullInt64":{"additionalProperties":false,"properties":{"Int64":{"format":"int64","type":"integer"},"Valid":{"type":"boolean"}},"required":["Int64","Valid"],"type":"object"},"NullString":{"additionalProperties":false,"properties":{"String":{"type":"string"},"Valid":{"type":"boolean"}},"required":["String","Valid"],"type":"object"},"RunsView":{"additionalProperties":false,"properties":{"duration":{"$ref":"#/components/schemas/NullInt64"},"end_time":{"$ref":"#/components/schemas/NullInt64"},"fmt_end_time":{"$ref":"#/components/schemas/NullString"},"fmt_start_time":{"type":"string"},"id":{"format":"int64","type":"integer"},"job_id":{"type":"string"},"logs":{"items":{"$ref":"#/components/schemas/ListLogsByRunIDRow"},"type":["array","null"]},"start_time":{"format":"int64","type":"integer"},"status_id":{"format":"int64","type":"integer"}},"required":["id","job_id","status_id","start_time","end_time","fmt_start_time","fmt_end_time","duration","logs"],"type":"object"}}},"info":{"title":"GoCron API","version":"1.0.0"},"openapi":"3.1.0","paths":{"/api/jobs":{"get":{"description":"Get jobs with run details but no logs.","operationId":"get-jobs","responses":{"200":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/JobsView"},"type":["array","null"]}}},"description":"OK"},"default":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorModel"}}},"description":"Error"}},"summary":"Get jobs","tags":["Jobs"]},"post":{"description":"Start all jobs in order of name.","operationId":"post-jobs","responses":{"204":{"description":"No Content"},"default":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorModel"}}},"description":"Error"}},"summary":"Start jobs","tags":["Jobs"]}},"/api/jobs/{name}":{"get":{"description":"Get job with run details and logs.","operationId":"get-job","parameters":[{"description":"job name","in":"path","name":"name","required":true,"schema":{"description":"job name","maxLength":20,"type":"string"}},{"description":"number of runs to return","explode":false,"in":"query","name":"limit","schema":{"default":5,"description":"number of runs to return","format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobsView"}}},"description":"OK"},"default":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorModel"}}},"description":"Error"}},"summary":"Get job","tags":["Jobs"]},"post":{"description":"Start single job.","operationId":"post-job","parameters":[{"description":"job name","in":"path","name":"name","required":true,"schema":{"description":"job name","maxLength":20,"type":"string"}}],"responses":{"204":{"description":"No Content"},"default":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorModel"}}},"description":"Error"}},"summary":"Start job","tags":["Jobs"]}},"/api/versions":{"get":{"description":"Get installed versions of software.","operationId":"get-versions","responses":{"200":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/Information"},"type":["array","null"]}}},"description":"OK"},"default":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorModel"}}},"description":"Error"}},"summary":"Get installed versions","tags":["Software"]}}}}
1+
{"components":{"schemas":{"ErrorDetail":{"additionalProperties":false,"properties":{"location":{"description":"Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id'","type":"string"},"message":{"description":"Error message text","type":"string"},"value":{"description":"The value at the given location"}},"type":"object"},"ErrorModel":{"additionalProperties":false,"properties":{"$schema":{"description":"A URL to the JSON Schema for this object.","examples":["https://example.com/api/schemas/ErrorModel.json"],"format":"uri","readOnly":true,"type":"string"},"detail":{"description":"A human-readable explanation specific to this occurrence of the problem.","examples":["Property foo is required but is missing."],"type":"string"},"errors":{"description":"Optional list of individual error details","items":{"$ref":"#/components/schemas/ErrorDetail"},"type":["array","null"]},"instance":{"description":"A URI reference that identifies the specific occurrence of the problem.","examples":["https://example.com/error-log/abc123"],"format":"uri","type":"string"},"status":{"description":"HTTP status code","examples":[400],"format":"int64","type":"integer"},"title":{"description":"A short, human-readable summary of the problem type. This value should not change between occurrences of the error.","examples":["Bad Request"],"type":"string"},"type":{"default":"about:blank","description":"A URI reference to human-readable documentation for the error.","examples":["https://example.com/errors/example"],"format":"uri","type":"string"}},"type":"object"},"Information":{"additionalProperties":false,"properties":{"name":{"type":"string"},"repo":{"type":"string"},"version":{"type":"string"}},"required":["name","version","repo"],"type":"object"},"JobsView":{"additionalProperties":false,"properties":{"$schema":{"description":"A URL to the JSON Schema for this object.","examples":["https://example.com/api/schemas/JobsView.json"],"format":"uri","readOnly":true,"type":"string"},"cron":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"},"runs":{"items":{"$ref":"#/components/schemas/RunsView"},"type":["array","null"]}},"required":["id","name","cron","runs"],"type":"object"},"ListLogsByRunIDRow":{"additionalProperties":false,"properties":{"created_at":{"format":"int64","type":"integer"},"created_at_time":{},"message":{"type":"string"},"run_id":{"format":"int64","type":"integer"},"severity_id":{"format":"int64","type":"integer"}},"required":["created_at","run_id","severity_id","message","created_at_time"],"type":"object"},"NullInt64":{"additionalProperties":false,"properties":{"Int64":{"format":"int64","type":"integer"},"Valid":{"type":"boolean"}},"required":["Int64","Valid"],"type":"object"},"NullString":{"additionalProperties":false,"properties":{"String":{"type":"string"},"Valid":{"type":"boolean"}},"required":["String","Valid"],"type":"object"},"RunsView":{"additionalProperties":false,"properties":{"duration":{"$ref":"#/components/schemas/NullInt64"},"end_time":{"$ref":"#/components/schemas/NullInt64"},"fmt_end_time":{"$ref":"#/components/schemas/NullString"},"fmt_start_time":{"type":"string"},"id":{"format":"int64","type":"integer"},"job_id":{"type":"string"},"logs":{"items":{"$ref":"#/components/schemas/ListLogsByRunIDRow"},"type":["array","null"]},"start_time":{"format":"int64","type":"integer"},"status_id":{"format":"int64","type":"integer"}},"required":["id","job_id","status_id","start_time","end_time","fmt_start_time","fmt_end_time","duration","logs"],"type":"object"}}},"info":{"title":"GoCron API","version":"1.0.0"},"openapi":"3.1.0","paths":{"/api/jobs":{"get":{"description":"Get jobs with run details but no logs.","operationId":"get-jobs","responses":{"200":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/JobsView"},"type":["array","null"]}}},"description":"OK"},"default":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorModel"}}},"description":"Error"}},"summary":"Get jobs","tags":["Jobs"]},"post":{"description":"Start all jobs in order of name.","operationId":"post-jobs","responses":{"204":{"description":"No Content"},"default":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorModel"}}},"description":"Error"}},"summary":"Start jobs","tags":["Jobs"]}},"/api/jobs/{name}":{"get":{"description":"Get job with run details and logs.","operationId":"get-job","parameters":[{"description":"job name","in":"path","name":"name","required":true,"schema":{"description":"job name","maxLength":255,"type":"string"}},{"description":"number of runs to return","explode":false,"in":"query","name":"limit","schema":{"default":5,"description":"number of runs to return","format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobsView"}}},"description":"OK"},"default":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorModel"}}},"description":"Error"}},"summary":"Get job","tags":["Jobs"]},"post":{"description":"Start single job.","operationId":"post-job","parameters":[{"description":"job name","in":"path","name":"name","required":true,"schema":{"description":"job name","maxLength":255,"type":"string"}}],"responses":{"204":{"description":"No Content"},"default":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorModel"}}},"description":"Error"}},"summary":"Start job","tags":["Jobs"]}},"/api/notify":{"post":{"description":"Send a test notification to the configured URL.","operationId":"post-notify","responses":{"204":{"description":"No Content"},"default":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorModel"}}},"description":"Error"}},"summary":"Test notification","tags":["Notify"]}},"/api/versions":{"get":{"description":"Get installed versions of software.","operationId":"get-versions","responses":{"200":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/Information"},"type":["array","null"]}}},"description":"OK"},"default":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorModel"}}},"description":"Error"}},"summary":"Get installed versions","tags":["Software"]}}}}

web/src/client/sdk.gen.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This file is auto-generated by @hey-api/openapi-ts
22

33
import type { Options as ClientOptions, TDataShape, Client } from '@hey-api/client-fetch';
4-
import type { GetJobsData, GetJobsResponse, GetJobsError, PostJobsData, PostJobsResponse, PostJobsError, GetJobData, GetJobResponse, GetJobError, PostJobData, PostJobResponse, PostJobError, GetVersionsData, GetVersionsResponse, GetVersionsError } from './types.gen';
4+
import type { GetJobsData, GetJobsResponse, GetJobsError, PostJobsData, PostJobsResponse, PostJobsError, GetJobData, GetJobResponse, GetJobError, PostJobData, PostJobResponse, PostJobError, PostNotifyData, PostNotifyResponse, PostNotifyError, GetVersionsData, GetVersionsResponse, GetVersionsError } from './types.gen';
55
import { client as _heyApiClient } from './client.gen';
66

77
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
@@ -62,6 +62,17 @@ export const postJob = <ThrowOnError extends boolean = false>(options: Options<P
6262
});
6363
};
6464

65+
/**
66+
* Test notification
67+
* Send a test notification to the configured URL.
68+
*/
69+
export const postNotify = <ThrowOnError extends boolean = false>(options?: Options<PostNotifyData, ThrowOnError>) => {
70+
return (options?.client ?? _heyApiClient).post<PostNotifyResponse, PostNotifyError, ThrowOnError>({
71+
url: '/api/notify',
72+
...options
73+
});
74+
};
75+
6576
/**
6677
* Get installed versions
6778
* Get installed versions of software.

web/src/client/types.gen.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,31 @@ export type PostJobResponses = {
208208

209209
export type PostJobResponse = PostJobResponses[keyof PostJobResponses];
210210

211+
export type PostNotifyData = {
212+
body?: never;
213+
path?: never;
214+
query?: never;
215+
url: '/api/notify';
216+
};
217+
218+
export type PostNotifyErrors = {
219+
/**
220+
* Error
221+
*/
222+
default: ErrorModel;
223+
};
224+
225+
export type PostNotifyError = PostNotifyErrors[keyof PostNotifyErrors];
226+
227+
export type PostNotifyResponses = {
228+
/**
229+
* No Content
230+
*/
231+
204: void;
232+
};
233+
234+
export type PostNotifyResponse = PostNotifyResponses[keyof PostNotifyResponses];
235+
211236
export type GetVersionsData = {
212237
body?: never;
213238
path?: never;

0 commit comments

Comments
 (0)