diff --git a/api/gen/admin/client.go b/api/gen/admin/client.go index 560a26ec06..9d2c5d35b0 100644 --- a/api/gen/admin/client.go +++ b/api/gen/admin/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // admin client // diff --git a/api/gen/admin/endpoints.go b/api/gen/admin/endpoints.go index 8909c3bc0f..59d9ad280f 100644 --- a/api/gen/admin/endpoints.go +++ b/api/gen/admin/endpoints.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // admin endpoints // diff --git a/api/gen/admin/service.go b/api/gen/admin/service.go index 29ad94aad5..30fee078fb 100644 --- a/api/gen/admin/service.go +++ b/api/gen/admin/service.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // admin service // diff --git a/api/gen/catalog/client.go b/api/gen/catalog/client.go index 8daa4dc1b0..327ed6c060 100644 --- a/api/gen/catalog/client.go +++ b/api/gen/catalog/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // catalog client // diff --git a/api/gen/catalog/endpoints.go b/api/gen/catalog/endpoints.go index 3f9da4361a..481d6318ef 100644 --- a/api/gen/catalog/endpoints.go +++ b/api/gen/catalog/endpoints.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // catalog endpoints // diff --git a/api/gen/catalog/service.go b/api/gen/catalog/service.go index 85526a9b4e..f9de28f554 100644 --- a/api/gen/catalog/service.go +++ b/api/gen/catalog/service.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // catalog service // diff --git a/api/gen/catalog/views/view.go b/api/gen/catalog/views/view.go index a95d16cdbe..2050c34e51 100644 --- a/api/gen/catalog/views/view.go +++ b/api/gen/catalog/views/view.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // catalog views // diff --git a/api/gen/category/client.go b/api/gen/category/client.go index 36a1f15dff..2580bc4942 100644 --- a/api/gen/category/client.go +++ b/api/gen/category/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // category client // diff --git a/api/gen/category/endpoints.go b/api/gen/category/endpoints.go index 86fad88736..de35efa426 100644 --- a/api/gen/category/endpoints.go +++ b/api/gen/category/endpoints.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // category endpoints // diff --git a/api/gen/category/service.go b/api/gen/category/service.go index c8e98cd452..8924da9dd1 100644 --- a/api/gen/category/service.go +++ b/api/gen/category/service.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // category service // diff --git a/api/gen/http/admin/client/cli.go b/api/gen/http/admin/client/cli.go index c765baa724..b616635294 100644 --- a/api/gen/http/admin/client/cli.go +++ b/api/gen/http/admin/client/cli.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // admin HTTP client CLI support package // diff --git a/api/gen/http/admin/client/client.go b/api/gen/http/admin/client/client.go index b0b588d12b..aa09c9581d 100644 --- a/api/gen/http/admin/client/client.go +++ b/api/gen/http/admin/client/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // admin client HTTP transport // diff --git a/api/gen/http/admin/client/encode_decode.go b/api/gen/http/admin/client/encode_decode.go index 501eba14e3..6ad267a325 100644 --- a/api/gen/http/admin/client/encode_decode.go +++ b/api/gen/http/admin/client/encode_decode.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // admin HTTP client encoders and decoders // diff --git a/api/gen/http/admin/client/paths.go b/api/gen/http/admin/client/paths.go index c3d4fab3ed..60215af475 100644 --- a/api/gen/http/admin/client/paths.go +++ b/api/gen/http/admin/client/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // HTTP request path constructors for the admin service. // diff --git a/api/gen/http/admin/client/types.go b/api/gen/http/admin/client/types.go index ce2c8221d1..bd6df582ec 100644 --- a/api/gen/http/admin/client/types.go +++ b/api/gen/http/admin/client/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // admin HTTP client types // diff --git a/api/gen/http/admin/server/encode_decode.go b/api/gen/http/admin/server/encode_decode.go index 9d88c2a27f..4a0bd2913b 100644 --- a/api/gen/http/admin/server/encode_decode.go +++ b/api/gen/http/admin/server/encode_decode.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // admin HTTP server encoders and decoders // diff --git a/api/gen/http/admin/server/paths.go b/api/gen/http/admin/server/paths.go index b44c05b23e..97a69e6e76 100644 --- a/api/gen/http/admin/server/paths.go +++ b/api/gen/http/admin/server/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // HTTP request path constructors for the admin service. // diff --git a/api/gen/http/admin/server/server.go b/api/gen/http/admin/server/server.go index ebe7b114aa..f997a7ef5e 100644 --- a/api/gen/http/admin/server/server.go +++ b/api/gen/http/admin/server/server.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // admin HTTP server // diff --git a/api/gen/http/admin/server/types.go b/api/gen/http/admin/server/types.go index a29b968574..3b38510f32 100644 --- a/api/gen/http/admin/server/types.go +++ b/api/gen/http/admin/server/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // admin HTTP server types // diff --git a/api/gen/http/catalog/client/cli.go b/api/gen/http/catalog/client/cli.go index 799b2328f4..ee9b2b7bf1 100644 --- a/api/gen/http/catalog/client/cli.go +++ b/api/gen/http/catalog/client/cli.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // catalog HTTP client CLI support package // diff --git a/api/gen/http/catalog/client/client.go b/api/gen/http/catalog/client/client.go index 589ef420c4..87ab7d29be 100644 --- a/api/gen/http/catalog/client/client.go +++ b/api/gen/http/catalog/client/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // catalog client HTTP transport // diff --git a/api/gen/http/catalog/client/encode_decode.go b/api/gen/http/catalog/client/encode_decode.go index 9db3ace093..f59fcca4a0 100644 --- a/api/gen/http/catalog/client/encode_decode.go +++ b/api/gen/http/catalog/client/encode_decode.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // catalog HTTP client encoders and decoders // diff --git a/api/gen/http/catalog/client/paths.go b/api/gen/http/catalog/client/paths.go index 0d4e30c5f9..5043c3faee 100644 --- a/api/gen/http/catalog/client/paths.go +++ b/api/gen/http/catalog/client/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // HTTP request path constructors for the catalog service. // diff --git a/api/gen/http/catalog/client/types.go b/api/gen/http/catalog/client/types.go index 8b5df473e7..ad5649f74e 100644 --- a/api/gen/http/catalog/client/types.go +++ b/api/gen/http/catalog/client/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // catalog HTTP client types // diff --git a/api/gen/http/catalog/server/encode_decode.go b/api/gen/http/catalog/server/encode_decode.go index dcb2023fae..141582b9f6 100644 --- a/api/gen/http/catalog/server/encode_decode.go +++ b/api/gen/http/catalog/server/encode_decode.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // catalog HTTP server encoders and decoders // diff --git a/api/gen/http/catalog/server/paths.go b/api/gen/http/catalog/server/paths.go index 9428f8aec0..c3884b09ba 100644 --- a/api/gen/http/catalog/server/paths.go +++ b/api/gen/http/catalog/server/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // HTTP request path constructors for the catalog service. // diff --git a/api/gen/http/catalog/server/server.go b/api/gen/http/catalog/server/server.go index e163769f99..24308d6980 100644 --- a/api/gen/http/catalog/server/server.go +++ b/api/gen/http/catalog/server/server.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // catalog HTTP server // diff --git a/api/gen/http/catalog/server/types.go b/api/gen/http/catalog/server/types.go index ee44ee7149..898cccce35 100644 --- a/api/gen/http/catalog/server/types.go +++ b/api/gen/http/catalog/server/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // catalog HTTP server types // diff --git a/api/gen/http/category/client/cli.go b/api/gen/http/category/client/cli.go index 1212084f1d..71673f8559 100644 --- a/api/gen/http/category/client/cli.go +++ b/api/gen/http/category/client/cli.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // category HTTP client CLI support package // diff --git a/api/gen/http/category/client/client.go b/api/gen/http/category/client/client.go index babb37e374..e07a1ad62a 100644 --- a/api/gen/http/category/client/client.go +++ b/api/gen/http/category/client/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // category client HTTP transport // diff --git a/api/gen/http/category/client/encode_decode.go b/api/gen/http/category/client/encode_decode.go index 23a69a7512..7ff52e15ce 100644 --- a/api/gen/http/category/client/encode_decode.go +++ b/api/gen/http/category/client/encode_decode.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // category HTTP client encoders and decoders // diff --git a/api/gen/http/category/client/paths.go b/api/gen/http/category/client/paths.go index ee85e65e1b..d365cb2c08 100644 --- a/api/gen/http/category/client/paths.go +++ b/api/gen/http/category/client/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // HTTP request path constructors for the category service. // diff --git a/api/gen/http/category/client/types.go b/api/gen/http/category/client/types.go index 87ea030cab..805883b2ee 100644 --- a/api/gen/http/category/client/types.go +++ b/api/gen/http/category/client/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // category HTTP client types // diff --git a/api/gen/http/category/server/encode_decode.go b/api/gen/http/category/server/encode_decode.go index 37c4e8cb0d..879a63c195 100644 --- a/api/gen/http/category/server/encode_decode.go +++ b/api/gen/http/category/server/encode_decode.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // category HTTP server encoders and decoders // diff --git a/api/gen/http/category/server/paths.go b/api/gen/http/category/server/paths.go index acb663fbda..0e4154f15b 100644 --- a/api/gen/http/category/server/paths.go +++ b/api/gen/http/category/server/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // HTTP request path constructors for the category service. // diff --git a/api/gen/http/category/server/server.go b/api/gen/http/category/server/server.go index 636effcb63..1bd69f3e94 100644 --- a/api/gen/http/category/server/server.go +++ b/api/gen/http/category/server/server.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // category HTTP server // diff --git a/api/gen/http/category/server/types.go b/api/gen/http/category/server/types.go index aaffd07c38..1f6c465bf9 100644 --- a/api/gen/http/category/server/types.go +++ b/api/gen/http/category/server/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // category HTTP server types // diff --git a/api/gen/http/cli/hub/cli.go b/api/gen/http/cli/hub/cli.go index abe2c89521..a93472bd56 100644 --- a/api/gen/http/cli/hub/cli.go +++ b/api/gen/http/cli/hub/cli.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // hub HTTP client CLI support package // diff --git a/api/gen/http/openapi3.json b/api/gen/http/openapi3.json index bf54282715..62935d37e9 100644 --- a/api/gen/http/openapi3.json +++ b/api/gen/http/openapi3.json @@ -1 +1 @@ -{"openapi":"3.0.3","info":{"title":"Tekton Hub","description":"HTTP services for managing Tekton Hub","version":"1.0"},"servers":[{"url":"https://api.hub.tekton.dev"}],"paths":{"/":{"get":{"tags":["status"],"summary":"Status status","description":"Return status of the services","operationId":"status#Status","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponseBody"},"example":{"services":[{"error":"unable to reach db","name":"api","status":"ok"},{"error":"unable to reach db","name":"api","status":"ok"}]}}}}}}},"/catalog/refresh":{"post":{"tags":["catalog"],"summary":"RefreshAll catalog","description":"Refresh all catalogs","operationId":"catalog#RefreshAll","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Job"},"example":[{"catalogName":"tekton","id":1,"status":"queued"},{"catalogName":"tekton","id":1,"status":"queued"},{"catalogName":"tekton","id":1,"status":"queued"}]},"example":[{"catalogName":"tekton","id":1,"status":"queued"},{"catalogName":"tekton","id":1,"status":"queued"}]}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"jwt_header_Authorization":["rating:read","rating:write","agent:create","catalog:refresh","config:refresh","refresh:token"]}]}},"/catalog/{catalogName}/error":{"get":{"tags":["catalog"],"summary":"CatalogError catalog","description":"List all errors occurred refreshing a catalog","operationId":"catalog#CatalogError","parameters":[{"name":"catalogName","in":"path","description":"Name of catalog","required":true,"schema":{"type":"string","description":"Name of catalog","example":"tekton"},"example":"tekton"}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogErrorResponseBody"},"example":{"data":[{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"}]}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"jwt_header_Authorization":["rating:read","rating:write","agent:create","catalog:refresh","config:refresh","refresh:token"]}]}},"/catalog/{catalogName}/refresh":{"post":{"tags":["catalog"],"summary":"Refresh catalog","description":"Refresh a Catalog by it's name","operationId":"catalog#Refresh","parameters":[{"name":"catalogName","in":"path","description":"Name of catalog","required":true,"schema":{"type":"string","description":"Name of catalog","example":"tekton"},"example":"tekton"}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"},"example":{"catalogName":"tekton","id":1,"status":"queued"}}}},"404":{"description":"not-found: Resource Not Found Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"jwt_header_Authorization":["rating:read","rating:write","agent:create","catalog:refresh","config:refresh","refresh:token"]}]}},"/categories":{"get":{"tags":["category"],"summary":"list category","description":"List all categories along with their tags sorted by name","operationId":"category#list","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResponseBody"},"example":{"data":[{"id":1,"name":"Image Builder"},{"id":1,"name":"Image Builder"}]}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/query":{"get":{"tags":["resource"],"summary":"Query resource","description":"Find resources by a combination of name, kind, catalog, categories, platforms and tags","operationId":"resource#Query","parameters":[{"name":"name","in":"query","description":"Name of resource","allowEmptyValue":true,"schema":{"type":"string","description":"Name of resource","default":"","example":"buildah"},"example":"buildah"},{"name":"catalogs","in":"query","description":"Catalogs of resource to filter by","allowEmptyValue":true,"schema":{"type":"array","items":{"type":"string","example":"Vero reiciendis est corporis."},"description":"Catalogs of resource to filter by","example":["tekton","openshift"]},"example":["tekton","openshift"]},{"name":"categories","in":"query","description":"Category associated with a resource to filter by","allowEmptyValue":true,"schema":{"type":"array","items":{"type":"string","example":"Architecto nisi consequatur aut ab ea."},"description":"Category associated with a resource to filter by","example":["build","tools"]},"example":["build","tools"]},{"name":"kinds","in":"query","description":"Kinds of resource to filter by","allowEmptyValue":true,"schema":{"type":"array","items":{"type":"string","example":"Voluptatem ratione."},"description":"Kinds of resource to filter by","example":["task","pipelines"]},"example":["task","pipelines"]},{"name":"tags","in":"query","description":"Tags associated with a resource to filter by","allowEmptyValue":true,"schema":{"type":"array","items":{"type":"string","example":"Et vero aperiam."},"description":"Tags associated with a resource to filter by","example":["image","build"]},"example":["image","build"]},{"name":"platforms","in":"query","description":"Platforms associated with a resource to filter by","allowEmptyValue":true,"schema":{"type":"array","items":{"type":"string","example":"Enim corrupti consequatur."},"description":"Platforms associated with a resource to filter by","example":["linux/s390x","linux/amd64"]},"example":["linux/s390x","linux/amd64"]},{"name":"limit","in":"query","description":"Maximum number of resources to be returned","allowEmptyValue":true,"schema":{"type":"integer","description":"Maximum number of resources to be returned","default":1000,"example":100},"example":100},{"name":"match","in":"query","description":"Strategy used to find matching resources","allowEmptyValue":true,"schema":{"type":"string","description":"Strategy used to find matching resources","default":"contains","example":"contains","enum":["exact","contains"]},"example":"exact"}],"responses":{"302":{"description":"Found response.","headers":{"location":{"description":"Redirect URL","required":true,"schema":{"type":"string","description":"Redirect URL","example":"http://von.name/kasandra","format":"uri"},"example":"http://lueilwitz.com/caroline"}}}}}},"/resource/version/{versionID}":{"get":{"tags":["resource"],"summary":"ByVersionId resource","description":"Find a resource using its version's id","operationId":"resource#ByVersionId","parameters":[{"name":"versionID","in":"path","description":"Version ID of a resource's version","required":true,"schema":{"type":"integer","description":"Version ID of a resource's version","example":1},"example":1}],"responses":{"302":{"description":"Found response.","headers":{"location":{"description":"Redirect URL","required":true,"schema":{"type":"string","description":"Redirect URL","example":"http://senger.info/johnathan","format":"uri"},"example":"http://kovacekcassin.name/baron_rutherford"}}}}}},"/resource/{catalog}/{kind}/{name}":{"get":{"tags":["resource"],"summary":"ByCatalogKindName resource","description":"Find resources using name of catalog, resource name and kind of resource","operationId":"resource#ByCatalogKindName","parameters":[{"name":"pipelinesversion","in":"query","description":"To find resource compatible with a Tekton pipelines version, use this param","allowEmptyValue":true,"schema":{"type":"string","description":"To find resource compatible with a Tekton pipelines version, use this param","example":"0.21.0","pattern":"^\\d+(?:\\.\\d+){0,2}$"},"example":"0.21.0"},{"name":"catalog","in":"path","description":"name of catalog","required":true,"schema":{"type":"string","description":"name of catalog","example":"tektoncd"},"example":"tektoncd"},{"name":"kind","in":"path","description":"kind of resource","required":true,"schema":{"type":"string","description":"kind of resource","example":"task","enum":["task","pipeline"]},"example":"pipeline"},{"name":"name","in":"path","description":"Name of resource","required":true,"schema":{"type":"string","description":"Name of resource","example":"buildah"},"example":"buildah"}],"responses":{"302":{"description":"Found response.","headers":{"location":{"description":"Redirect URL","required":true,"schema":{"type":"string","description":"Redirect URL","example":"http://schroeder.org/nia.rolfson","format":"uri"},"example":"http://christiansenmertz.biz/sincere"}}}}}},"/resource/{catalog}/{kind}/{name}/{version}":{"get":{"tags":["resource"],"summary":"ByCatalogKindNameVersion resource","description":"Find resource using name of catalog \u0026 name, kind and version of resource","operationId":"resource#ByCatalogKindNameVersion","parameters":[{"name":"catalog","in":"path","description":"name of catalog","required":true,"schema":{"type":"string","description":"name of catalog","example":"tektoncd"},"example":"tektoncd"},{"name":"kind","in":"path","description":"kind of resource","required":true,"schema":{"type":"string","description":"kind of resource","example":"task","enum":["task","pipeline"]},"example":"pipeline"},{"name":"name","in":"path","description":"name of resource","required":true,"schema":{"type":"string","description":"name of resource","example":"buildah"},"example":"buildah"},{"name":"version","in":"path","description":"version of resource","required":true,"schema":{"type":"string","description":"version of resource","example":"0.1"},"example":"0.1"}],"responses":{"302":{"description":"Found response.","headers":{"location":{"description":"Redirect URL","required":true,"schema":{"type":"string","description":"Redirect URL","example":"http://denesikprohaska.biz/esmeralda.d'amore","format":"uri"},"example":"http://hoeger.biz/eric"}}}}}},"/resource/{id}":{"get":{"tags":["resource"],"summary":"ById resource","description":"Find a resource using it's id","operationId":"resource#ById","parameters":[{"name":"id","in":"path","description":"ID of a resource","required":true,"schema":{"type":"integer","description":"ID of a resource","example":1},"example":1}],"responses":{"302":{"description":"Found response.","headers":{"location":{"description":"Redirect URL","required":true,"schema":{"type":"string","description":"Redirect URL","example":"http://schiller.name/kayli","format":"uri"},"example":"http://hahnbergstrom.info/jacklyn_brown"}}}}}},"/resource/{id}/rating":{"get":{"tags":["rating"],"summary":"Get rating","description":"Find user's rating for a resource","operationId":"rating#Get","parameters":[{"name":"id","in":"path","description":"ID of a resource","required":true,"schema":{"type":"integer","description":"ID of a resource","example":6138028468518471795},"example":8114659548213764512}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetResponseBody"},"example":{"rating":4}}}},"401":{"description":"invalid-token: Invalid User token","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"invalid-scopes: Invalid User scope","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not-found: Resource Not Found Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal server error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"jwt_header_Authorization":["rating:read","rating:write","agent:create","catalog:refresh","config:refresh","refresh:token"]}]},"put":{"tags":["rating"],"summary":"Update rating","description":"Update user's rating for a resource","operationId":"rating#Update","parameters":[{"name":"id","in":"path","description":"ID of a resource","required":true,"schema":{"type":"integer","description":"ID of a resource","example":9890802013909619962},"example":14770215756158772569}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateRequestBody"},"example":{"rating":0}}}},"responses":{"200":{"description":"OK response."},"401":{"description":"invalid-token: Invalid User token","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"invalid-scopes: Invalid User scope","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not-found: Resource Not Found Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal server error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"jwt_header_Authorization":["rating:read","rating:write","agent:create","catalog:refresh","config:refresh","refresh:token"]}]}},"/resource/{id}/versions":{"get":{"tags":["resource"],"summary":"VersionsByID resource","description":"Find all versions of a resource by its id","operationId":"resource#VersionsByID","parameters":[{"name":"id","in":"path","description":"ID of a resource","required":true,"schema":{"type":"integer","description":"ID of a resource","example":1},"example":1}],"responses":{"302":{"description":"Found response.","headers":{"location":{"description":"Redirect URL","required":true,"schema":{"type":"string","description":"Redirect URL","example":"http://muller.org/kraig","format":"uri"},"example":"http://kreigeryost.org/emmanuel.rath"}}}}}},"/resources":{"get":{"tags":["resource"],"summary":"List resource","description":"List all resources sorted by rating and name","operationId":"resource#List","responses":{"301":{"description":"Moved Permanently response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Resources"},"example":{"data":[{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubRawURLPath":"/tekton/task/buildah/raw","hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","hubRawURLPath":"/tekton/task/buildah/latest/raw","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]},{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubRawURLPath":"/tekton/task/buildah/raw","hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","hubRawURLPath":"/tekton/task/buildah/latest/raw","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]}]}}}}}}},"/schema/swagger.json":{"get":{"tags":["swagger"],"summary":"Download docs/openapi3.json","description":"JSON document containing the API swagger definition","operationId":"swagger#/schema/swagger.json","responses":{"200":{"description":"File downloaded"}}}},"/system/config/refresh":{"post":{"tags":["admin"],"summary":"RefreshConfig admin","description":"Refresh the changes in config file","operationId":"admin#RefreshConfig","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefreshConfigResponseBody"},"example":{"checksum":"41ba391c8baf1fcd3c62c11272b913dc6613f4cf3b1833cfbb32431dc4384c93"}}}},"401":{"description":"invalid-token: Invalid User token","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"invalid-scopes: Invalid Token scopes ","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal server error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"jwt_header_Authorization":["rating:read","rating:write","agent:create","catalog:refresh","config:refresh","refresh:token"]}]}},"/system/user/agent":{"put":{"tags":["admin"],"summary":"UpdateAgent admin","description":"Create or Update an agent user with required scopes","operationId":"admin#UpdateAgent","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAgentRequestBody"},"example":{"name":"abc","scopes":["catalog-refresh","agent:create"]}}}},"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAgentResponseBody"},"example":{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1Nzc4ODAzMDAsImlhdCI6MTU3Nzg4MDAwMCwiaWQiOjExLCJpc3MiOiJUZWt0b24gSHViIiwic2NvcGVzIjpbInJhdGluZzpyZWFkIiwicmF0aW5nOndyaXRlIiwiYWdlbnQ6Y3JlYXRlIl0sInR5cGUiOiJhY2Nlc3MtdG9rZW4ifQ.6pDmziSKkoSqI1f0rc4-AqVdcfY0Q8wA-tSLzdTCLgM"}}}},"400":{"description":"invalid-payload: Invalid request body","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid-token: Invalid User token","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"invalid-scopes: Invalid Token scopes ","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal server error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"jwt_header_Authorization":["rating:read","rating:write","agent:create","catalog:refresh","config:refresh","refresh:token"]}]}},"/v1":{"get":{"tags":["status"],"summary":"Status status","description":"Return status of the services","operationId":"status#Status#1","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponseBody"},"example":{"services":[{"error":"unable to reach db","name":"api","status":"ok"},{"error":"unable to reach db","name":"api","status":"ok"}]}}}}}}},"/v1/categories":{"get":{"tags":["category"],"summary":"list category","description":"List all categories along with their tags sorted by name","operationId":"category#list#1","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResponseBody"},"example":{"data":[{"id":1,"name":"Image Builder"},{"id":1,"name":"Image Builder"}]}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"schemas":{"Catalog":{"type":"object","properties":{"id":{"type":"integer","description":"ID is the unique id of the catalog","example":1},"name":{"type":"string","description":"Name of catalog","example":"Tekton"},"provider":{"type":"string","description":"Provider of catalog","example":"github"},"type":{"type":"string","description":"Type of catalog","example":"community","enum":["official","community"]},"url":{"type":"string","description":"URL of catalog","example":"https://github.com/tektoncd/hub"}},"example":{"id":1,"name":"Tekton","provider":"github","type":"community","url":"https://github.com/tektoncd/hub"},"required":["id","name","type","url","provider"]},"CatalogErrorResponseBody":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CatalogErrors"},"description":"Catalog errors","example":[{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"}]}},"example":{"data":[{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"}]},"required":["data"]},"CatalogErrors":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"string","example":"Nesciunt delectus sunt quidem asperiores quis."},"description":"Catalog Error message","example":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"]},"type":{"type":"string","description":"Catalog Errror type","example":"warning"}},"description":"CatalogErrors define the errors that occurred during catalog refresh","example":{"errors":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"],"type":"warning"},"required":["type","errors"]},"Category":{"type":"object","properties":{"id":{"type":"integer","description":"ID is the unique id of the category","example":1},"name":{"type":"string","description":"Name of category","example":"Image Builder"}},"example":{"id":1,"name":"Image Builder"},"required":["id","name"]},"Error":{"type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":false},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":true},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":false}},"description":"Invalid request body","example":{"fault":false,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":false,"timeout":true},"required":["name","id","message","temporary","timeout","fault"]},"GetResponseBody":{"type":"object","properties":{"rating":{"type":"integer","description":"User rating for resource","example":4,"format":"int64"}},"example":{"rating":4},"required":["rating"]},"HubService":{"type":"object","properties":{"error":{"type":"string","description":"Details of the error if any","example":"unable to reach db"},"name":{"type":"string","description":"Name of the service","example":"api"},"status":{"type":"string","description":"Status of the service","example":"ok","enum":["ok","error"]}},"description":"Describes the services and their status","example":{"error":"unable to reach db","name":"api","status":"ok"},"required":["name","status"]},"Job":{"type":"object","properties":{"catalogName":{"type":"string","description":"Name of the catalog","example":"tekton"},"id":{"type":"integer","description":"id of the job","example":1},"status":{"type":"string","description":"status of the job","example":"queued"}},"example":{"catalogName":"tekton","id":1,"status":"queued"},"required":["id","catalogName","status"]},"ListResponseBody":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Category"},"example":[{"id":1,"name":"Image Builder"},{"id":1,"name":"Image Builder"}]}},"example":{"data":[{"id":1,"name":"Image Builder"},{"id":1,"name":"Image Builder"},{"id":1,"name":"Image Builder"},{"id":1,"name":"Image Builder"}]}},"RefreshConfigResponseBody":{"type":"object","properties":{"checksum":{"type":"string","description":"Config file checksum","example":"41ba391c8baf1fcd3c62c11272b913dc6613f4cf3b1833cfbb32431dc4384c93"}},"example":{"checksum":"41ba391c8baf1fcd3c62c11272b913dc6613f4cf3b1833cfbb32431dc4384c93"},"required":["checksum"]},"ResourceData":{"type":"object","properties":{"catalog":{"$ref":"#/components/schemas/Catalog"},"categories":{"type":"array","items":{"$ref":"#/components/schemas/Category"},"description":"Categories related to resource","example":[{"id":1,"name":"image-build"}]},"hubRawURLPath":{"type":"string","description":"Path of the api to get the raw yaml of resource from hub apiserver","example":"/tekton/task/buildah/raw"},"hubURLPath":{"type":"string","description":"Url path of the resource in hub","example":"tekton/task/buildah"},"id":{"type":"integer","description":"ID is the unique id of the resource","example":1},"kind":{"type":"string","description":"Kind of resource","example":"task"},"latestVersion":{"$ref":"#/components/schemas/ResourceVersionData"},"name":{"type":"string","description":"Name of resource","example":"buildah"},"platforms":{"type":"array","items":{"$ref":"#/components/schemas/Category"},"description":"Platforms related to resource","example":[{"id":1,"name":"linux/amd64"}]},"rating":{"type":"number","description":"Rating of resource","example":4.3,"format":"double"},"tags":{"type":"array","items":{"$ref":"#/components/schemas/Category"},"description":"Tags related to resource","example":[{"id":1,"name":"image-build"}]},"versions":{"type":"array","items":{"$ref":"#/components/schemas/ResourceVersionData"},"description":"List of all versions of a resource","example":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]}},"description":"The resource type describes resource information.","example":{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubRawURLPath":"/tekton/task/buildah/raw","hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","hubRawURLPath":"/tekton/task/buildah/latest/raw","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]},"required":["id","name","catalog","categories","kind","hubURLPath","latestVersion","tags","platforms","rating","versions","hubRawURLPath"]},"ResourceDataCollection":{"type":"array","items":{"$ref":"#/components/schemas/ResourceData"},"example":[{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubRawURLPath":"/tekton/task/buildah/raw","hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","hubRawURLPath":"/tekton/task/buildah/latest/raw","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]},{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubRawURLPath":"/tekton/task/buildah/raw","hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","hubRawURLPath":"/tekton/task/buildah/latest/raw","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]},{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubRawURLPath":"/tekton/task/buildah/raw","hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","hubRawURLPath":"/tekton/task/buildah/latest/raw","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]},{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubRawURLPath":"/tekton/task/buildah/raw","hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","hubRawURLPath":"/tekton/task/buildah/latest/raw","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]}]},"ResourceVersionData":{"type":"object","properties":{"deprecated":{"type":"boolean","description":"Deprecation status of a version","example":true},"description":{"type":"string","description":"Description of version","example":"Buildah task builds source into a container image and then pushes it to a container registry."},"displayName":{"type":"string","description":"Display name of version","example":"Buildah"},"hubRawURLPath":{"type":"string","description":"Path of the api to get the raw yaml of resource from hub apiserver","example":"/tekton/task/buildah/raw"},"hubURLPath":{"type":"string","description":"Url path of the resource in hub","example":"tekton/task/buildah"},"id":{"type":"integer","description":"ID is the unique id of resource's version","example":1},"minPipelinesVersion":{"type":"string","description":"Minimum pipelines version the resource's version is compatible with","example":"0.12.1"},"platforms":{"type":"array","items":{"$ref":"#/components/schemas/Category"},"description":"Platforms related to resource version","example":[{"id":1,"name":"linux/s390x"}]},"rawURL":{"type":"string","description":"Raw URL of resource's yaml file of the version","example":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","format":"uri"},"resource":{"$ref":"#/components/schemas/ResourceData"},"updatedAt":{"type":"string","description":"Timestamp when version was last updated","example":"2020-01-01 12:00:00 +0000 UTC","format":"date-time"},"version":{"type":"string","description":"Version of resource","example":"0.1"},"webURL":{"type":"string","description":"Web URL of resource's yaml file of the version","example":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml","format":"uri"}},"description":"The Version result type describes resource's version information.","example":{"deprecated":true,"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","hubRawURLPath":"/tekton/task/buildah/raw","hubURLPath":"tekton/task/buildah","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/s390x"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","resource":{"catalog":{"id":1,"type":"community"},"categories":[{"id":1,"name":"Build Tools"}],"id":1,"kind":"task","name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}]},"updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"required":["id","version","displayName","description","minPipelinesVersion","rawURL","webURL","updatedAt","platforms","resource","hubURLPath","hubRawURLPath"]},"Resources":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ResourceDataCollection"}},"example":{"data":[{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubRawURLPath":"/tekton/task/buildah/raw","hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","hubRawURLPath":"/tekton/task/buildah/latest/raw","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]},{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubRawURLPath":"/tekton/task/buildah/raw","hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","hubRawURLPath":"/tekton/task/buildah/latest/raw","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]}]},"required":["data"]},"StatusResponseBody":{"type":"object","properties":{"services":{"type":"array","items":{"$ref":"#/components/schemas/HubService"},"description":"List of services and their status","example":[{"error":"unable to reach db","name":"api","status":"ok"},{"error":"unable to reach db","name":"api","status":"ok"},{"error":"unable to reach db","name":"api","status":"ok"},{"error":"unable to reach db","name":"api","status":"ok"}]}},"example":{"services":[{"error":"unable to reach db","name":"api","status":"ok"},{"error":"unable to reach db","name":"api","status":"ok"}]}},"UpdateAgentRequestBody":{"type":"object","properties":{"name":{"type":"string","description":"Name of Agent","example":"abc"},"scopes":{"type":"array","items":{"type":"string","example":"Est voluptatem id."},"description":"Scopes required for Agent","example":["catalog-refresh","agent:create"]}},"example":{"name":"abc","scopes":["catalog-refresh","agent:create"]},"required":["name","scopes"]},"UpdateAgentResponseBody":{"type":"object","properties":{"token":{"type":"string","description":"Agent JWT","example":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1Nzc4ODAzMDAsImlhdCI6MTU3Nzg4MDAwMCwiaWQiOjExLCJpc3MiOiJUZWt0b24gSHViIiwic2NvcGVzIjpbInJhdGluZzpyZWFkIiwicmF0aW5nOndyaXRlIiwiYWdlbnQ6Y3JlYXRlIl0sInR5cGUiOiJhY2Nlc3MtdG9rZW4ifQ.6pDmziSKkoSqI1f0rc4-AqVdcfY0Q8wA-tSLzdTCLgM"}},"example":{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1Nzc4ODAzMDAsImlhdCI6MTU3Nzg4MDAwMCwiaWQiOjExLCJpc3MiOiJUZWt0b24gSHViIiwic2NvcGVzIjpbInJhdGluZzpyZWFkIiwicmF0aW5nOndyaXRlIiwiYWdlbnQ6Y3JlYXRlIl0sInR5cGUiOiJhY2Nlc3MtdG9rZW4ifQ.6pDmziSKkoSqI1f0rc4-AqVdcfY0Q8wA-tSLzdTCLgM"},"required":["token"]},"UpdateRequestBody":{"type":"object","properties":{"rating":{"type":"integer","description":"User rating for resource","example":2,"minimum":0,"maximum":5}},"example":{"rating":3},"required":["rating"]}},"securitySchemes":{"jwt_header_Authorization":{"type":"http","description":"Secures endpoint by requiring a valid JWT retrieved via the /auth/login endpoint.","scheme":"bearer"}}},"tags":[{"name":"swagger","description":"The swagger service serves the API swagger definition."},{"name":"admin","description":"Admin service"},{"name":"catalog","description":"The Catalog Service exposes endpoints to interact with catalogs"},{"name":"category","description":"The category service provides details about category"},{"name":"rating","description":"The rating service exposes endpoints to read and write user's rating for resources"},{"name":"resource","description":"The resource service provides details about all kind of resources"},{"name":"status","description":"Describes the status of each service"}]} \ No newline at end of file +{"openapi":"3.0.3","info":{"title":"Tekton Hub","description":"HTTP services for managing Tekton Hub","version":"1.0"},"servers":[{"url":"https://api.hub.tekton.dev"}],"paths":{"/":{"get":{"tags":["status"],"summary":"Status status","description":"Return status of the services","operationId":"status#Status","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponseBody"}}}}}}},"/catalog/refresh":{"post":{"tags":["catalog"],"summary":"RefreshAll catalog","description":"Refresh all catalogs","operationId":"catalog#RefreshAll","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Job"}}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"jwt_header_Authorization":["rating:read","rating:write","agent:create","catalog:refresh","config:refresh","refresh:token"]}]}},"/catalog/{catalogName}/error":{"get":{"tags":["catalog"],"summary":"CatalogError catalog","description":"List all errors occurred refreshing a catalog","operationId":"catalog#CatalogError","parameters":[{"name":"catalogName","in":"path","description":"Name of catalog","required":true,"schema":{"type":"string","description":"Name of catalog","example":"tekton"},"example":"tekton"}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogErrorResponseBody"}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"jwt_header_Authorization":["rating:read","rating:write","agent:create","catalog:refresh","config:refresh","refresh:token"]}]}},"/catalog/{catalogName}/refresh":{"post":{"tags":["catalog"],"summary":"Refresh catalog","description":"Refresh a Catalog by it's name","operationId":"catalog#Refresh","parameters":[{"name":"catalogName","in":"path","description":"Name of catalog","required":true,"schema":{"type":"string","description":"Name of catalog","example":"tekton"},"example":"tekton"}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"404":{"description":"not-found: Resource Not Found Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"jwt_header_Authorization":["rating:read","rating:write","agent:create","catalog:refresh","config:refresh","refresh:token"]}]}},"/categories":{"get":{"tags":["category"],"summary":"list category","description":"List all categories along with their tags sorted by name","operationId":"category#list","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResponseBody"}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/query":{"get":{"tags":["resource"],"summary":"Query resource","description":"Find resources by a combination of name, kind, catalog, categories, platforms and tags","operationId":"resource#Query","parameters":[{"name":"name","in":"query","description":"Name of resource","allowEmptyValue":true,"schema":{"type":"string","description":"Name of resource","default":"","example":"buildah"},"example":"buildah"},{"name":"catalogs","in":"query","description":"Catalogs of resource to filter by","allowEmptyValue":true,"schema":{"type":"array","items":{"type":"string"},"description":"Catalogs of resource to filter by","example":["tekton","openshift"]},"example":["tekton","openshift"]},{"name":"categories","in":"query","description":"Category associated with a resource to filter by","allowEmptyValue":true,"schema":{"type":"array","items":{"type":"string"},"description":"Category associated with a resource to filter by","example":["build","tools"]},"example":["build","tools"]},{"name":"kinds","in":"query","description":"Kinds of resource to filter by","allowEmptyValue":true,"schema":{"type":"array","items":{"type":"string"},"description":"Kinds of resource to filter by","example":["task","pipelines"]},"example":["task","pipelines"]},{"name":"tags","in":"query","description":"Tags associated with a resource to filter by","allowEmptyValue":true,"schema":{"type":"array","items":{"type":"string"},"description":"Tags associated with a resource to filter by","example":["image","build"]},"example":["image","build"]},{"name":"platforms","in":"query","description":"Platforms associated with a resource to filter by","allowEmptyValue":true,"schema":{"type":"array","items":{"type":"string"},"description":"Platforms associated with a resource to filter by","example":["linux/s390x","linux/amd64"]},"example":["linux/s390x","linux/amd64"]},{"name":"limit","in":"query","description":"Maximum number of resources to be returned","allowEmptyValue":true,"schema":{"type":"integer","description":"Maximum number of resources to be returned","default":1000,"example":100},"example":100},{"name":"match","in":"query","description":"Strategy used to find matching resources","allowEmptyValue":true,"schema":{"type":"string","description":"Strategy used to find matching resources","default":"contains","enum":["exact","contains"]}}],"responses":{"302":{"description":"Found response.","headers":{"location":{"description":"Redirect URL","required":true,"schema":{"type":"string","description":"Redirect URL","format":"uri"}}}}}}},"/resource/version/{versionID}":{"get":{"tags":["resource"],"summary":"ByVersionId resource","description":"Find a resource using its version's id","operationId":"resource#ByVersionId","parameters":[{"name":"versionID","in":"path","description":"Version ID of a resource's version","required":true,"schema":{"type":"integer","description":"Version ID of a resource's version","example":1},"example":1}],"responses":{"302":{"description":"Found response.","headers":{"location":{"description":"Redirect URL","required":true,"schema":{"type":"string","description":"Redirect URL","format":"uri"}}}}}}},"/resource/{catalog}/{kind}/{name}":{"get":{"tags":["resource"],"summary":"ByCatalogKindName resource","description":"Find resources using name of catalog, resource name and kind of resource","operationId":"resource#ByCatalogKindName","parameters":[{"name":"pipelinesversion","in":"query","description":"To find resource compatible with a Tekton pipelines version, use this param","allowEmptyValue":true,"schema":{"type":"string","description":"To find resource compatible with a Tekton pipelines version, use this param","example":"0.21.0","pattern":"^\\d+(?:\\.\\d+){0,2}$"},"example":"0.21.0"},{"name":"catalog","in":"path","description":"name of catalog","required":true,"schema":{"type":"string","description":"name of catalog","example":"tektoncd"},"example":"tektoncd"},{"name":"kind","in":"path","description":"kind of resource","required":true,"schema":{"type":"string","description":"kind of resource","enum":["task","pipeline"]}},{"name":"name","in":"path","description":"Name of resource","required":true,"schema":{"type":"string","description":"Name of resource","example":"buildah"},"example":"buildah"}],"responses":{"302":{"description":"Found response.","headers":{"location":{"description":"Redirect URL","required":true,"schema":{"type":"string","description":"Redirect URL","format":"uri"}}}}}}},"/resource/{catalog}/{kind}/{name}/{version}":{"get":{"tags":["resource"],"summary":"ByCatalogKindNameVersion resource","description":"Find resource using name of catalog \u0026 name, kind and version of resource","operationId":"resource#ByCatalogKindNameVersion","parameters":[{"name":"catalog","in":"path","description":"name of catalog","required":true,"schema":{"type":"string","description":"name of catalog","example":"tektoncd"},"example":"tektoncd"},{"name":"kind","in":"path","description":"kind of resource","required":true,"schema":{"type":"string","description":"kind of resource","enum":["task","pipeline"]}},{"name":"name","in":"path","description":"name of resource","required":true,"schema":{"type":"string","description":"name of resource","example":"buildah"},"example":"buildah"},{"name":"version","in":"path","description":"version of resource","required":true,"schema":{"type":"string","description":"version of resource","example":"0.1"},"example":"0.1"}],"responses":{"302":{"description":"Found response.","headers":{"location":{"description":"Redirect URL","required":true,"schema":{"type":"string","description":"Redirect URL","format":"uri"}}}}}}},"/resource/{id}":{"get":{"tags":["resource"],"summary":"ById resource","description":"Find a resource using it's id","operationId":"resource#ById","parameters":[{"name":"id","in":"path","description":"ID of a resource","required":true,"schema":{"type":"integer","description":"ID of a resource","example":1},"example":1}],"responses":{"302":{"description":"Found response.","headers":{"location":{"description":"Redirect URL","required":true,"schema":{"type":"string","description":"Redirect URL","format":"uri"}}}}}}},"/resource/{id}/rating":{"get":{"tags":["rating"],"summary":"Get rating","description":"Find user's rating for a resource","operationId":"rating#Get","parameters":[{"name":"id","in":"path","description":"ID of a resource","required":true,"schema":{"type":"integer","description":"ID of a resource"}}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetResponseBody"}}}},"401":{"description":"invalid-token: Invalid User token","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"invalid-scopes: Invalid User scope","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not-found: Resource Not Found Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal server error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"jwt_header_Authorization":["rating:read","rating:write","agent:create","catalog:refresh","config:refresh","refresh:token"]}]},"put":{"tags":["rating"],"summary":"Update rating","description":"Update user's rating for a resource","operationId":"rating#Update","parameters":[{"name":"id","in":"path","description":"ID of a resource","required":true,"schema":{"type":"integer","description":"ID of a resource"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateRequestBody"}}}},"responses":{"200":{"description":"OK response."},"401":{"description":"invalid-token: Invalid User token","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"invalid-scopes: Invalid User scope","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not-found: Resource Not Found Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal server error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"jwt_header_Authorization":["rating:read","rating:write","agent:create","catalog:refresh","config:refresh","refresh:token"]}]}},"/resource/{id}/versions":{"get":{"tags":["resource"],"summary":"VersionsByID resource","description":"Find all versions of a resource by its id","operationId":"resource#VersionsByID","parameters":[{"name":"id","in":"path","description":"ID of a resource","required":true,"schema":{"type":"integer","description":"ID of a resource","example":1},"example":1}],"responses":{"302":{"description":"Found response.","headers":{"location":{"description":"Redirect URL","required":true,"schema":{"type":"string","description":"Redirect URL","format":"uri"}}}}}}},"/resources":{"get":{"tags":["resource"],"summary":"List resource","description":"List all resources sorted by rating and name","operationId":"resource#List","responses":{"301":{"description":"Moved Permanently response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Resources"}}}}}}},"/schema/swagger.json":{"get":{"tags":["swagger"],"summary":"Download docs/openapi3.json","description":"JSON document containing the API swagger definition","operationId":"swagger#/schema/swagger.json","responses":{"200":{"description":"File downloaded"}}}},"/system/config/refresh":{"post":{"tags":["admin"],"summary":"RefreshConfig admin","description":"Refresh the changes in config file","operationId":"admin#RefreshConfig","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefreshConfigResponseBody"}}}},"401":{"description":"invalid-token: Invalid User token","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"invalid-scopes: Invalid Token scopes ","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal server error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"jwt_header_Authorization":["rating:read","rating:write","agent:create","catalog:refresh","config:refresh","refresh:token"]}]}},"/system/user/agent":{"put":{"tags":["admin"],"summary":"UpdateAgent admin","description":"Create or Update an agent user with required scopes","operationId":"admin#UpdateAgent","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAgentRequestBody"}}}},"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAgentResponseBody"}}}},"400":{"description":"invalid-payload: Invalid request body","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid-token: Invalid User token","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"invalid-scopes: Invalid Token scopes ","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal server error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"jwt_header_Authorization":["rating:read","rating:write","agent:create","catalog:refresh","config:refresh","refresh:token"]}]}},"/v1":{"get":{"tags":["status"],"summary":"Status status","description":"Return status of the services","operationId":"status#Status#1","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponseBody"}}}}}}},"/v1/categories":{"get":{"tags":["category"],"summary":"list category","description":"List all categories along with their tags sorted by name","operationId":"category#list#1","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResponseBody"}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"schemas":{"Catalog":{"type":"object","properties":{"id":{"type":"integer","description":"ID is the unique id of the catalog","example":1},"name":{"type":"string","description":"Name of catalog","example":"Tekton"},"provider":{"type":"string","description":"Provider of catalog","example":"github"},"type":{"type":"string","description":"Type of catalog","example":"community","enum":["official","community"]},"url":{"type":"string","description":"URL of catalog","example":"https://github.com/tektoncd/hub"}},"required":["id","name","type","url","provider"]},"CatalogErrorResponseBody":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CatalogErrors"},"description":"Catalog errors"}},"required":["data"]},"CatalogErrors":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"string"},"description":"Catalog Error message","example":["Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name","Resource tekton.dev/v1beta1, Kind=task - curl has no display name"]},"type":{"type":"string","description":"Catalog Errror type","example":"warning"}},"description":"CatalogErrors define the errors that occurred during catalog refresh","required":["type","errors"]},"Category":{"type":"object","properties":{"id":{"type":"integer","description":"ID is the unique id of the category","example":1},"name":{"type":"string","description":"Name of category","example":"Image Builder"}},"required":["id","name"]},"Error":{"type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?"},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?"},"timeout":{"type":"boolean","description":"Is the error a timeout?"}},"description":"Invalid request body","required":["name","id","message","temporary","timeout","fault"]},"GetResponseBody":{"type":"object","properties":{"rating":{"type":"integer","description":"User rating for resource","example":4,"format":"int64"}},"required":["rating"]},"HubService":{"type":"object","properties":{"error":{"type":"string","description":"Details of the error if any","example":"unable to reach db"},"name":{"type":"string","description":"Name of the service","example":"api"},"status":{"type":"string","description":"Status of the service","example":"ok","enum":["ok","error"]}},"description":"Describes the services and their status","required":["name","status"]},"Job":{"type":"object","properties":{"catalogName":{"type":"string","description":"Name of the catalog","example":"tekton"},"id":{"type":"integer","description":"id of the job","example":1},"status":{"type":"string","description":"status of the job","example":"queued"}},"required":["id","catalogName","status"]},"ListResponseBody":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Category"}}}},"RefreshConfigResponseBody":{"type":"object","properties":{"checksum":{"type":"string","description":"Config file checksum","example":"41ba391c8baf1fcd3c62c11272b913dc6613f4cf3b1833cfbb32431dc4384c93"}},"required":["checksum"]},"ResourceData":{"type":"object","properties":{"catalog":{"$ref":"#/components/schemas/Catalog"},"categories":{"type":"array","items":{"$ref":"#/components/schemas/Category"},"description":"Categories related to resource","example":[{"id":1,"name":"image-build"}]},"hubRawURLPath":{"type":"string","description":"Path of the api to get the raw yaml of resource from hub apiserver","example":"/tekton/task/buildah/raw"},"hubURLPath":{"type":"string","description":"Url path of the resource in hub","example":"tekton/task/buildah"},"id":{"type":"integer","description":"ID is the unique id of the resource","example":1},"kind":{"type":"string","description":"Kind of resource","example":"task"},"latestVersion":{"$ref":"#/components/schemas/ResourceVersionData"},"name":{"type":"string","description":"Name of resource","example":"buildah"},"platforms":{"type":"array","items":{"$ref":"#/components/schemas/Category"},"description":"Platforms related to resource","example":[{"id":1,"name":"linux/amd64"}]},"rating":{"type":"number","description":"Rating of resource","example":4.3,"format":"double"},"tags":{"type":"array","items":{"$ref":"#/components/schemas/Category"},"description":"Tags related to resource","example":[{"id":1,"name":"image-build"}]},"versions":{"type":"array","items":{"$ref":"#/components/schemas/ResourceVersionData"},"description":"List of all versions of a resource","example":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]}},"description":"The resource type describes resource information.","required":["id","name","catalog","categories","kind","hubURLPath","latestVersion","tags","platforms","rating","versions","hubRawURLPath"]},"ResourceDataCollection":{"type":"array","items":{"$ref":"#/components/schemas/ResourceData"}},"ResourceVersionData":{"type":"object","properties":{"deprecated":{"type":"boolean","description":"Deprecation status of a version","example":true},"description":{"type":"string","description":"Description of version","example":"Buildah task builds source into a container image and then pushes it to a container registry."},"displayName":{"type":"string","description":"Display name of version","example":"Buildah"},"hubRawURLPath":{"type":"string","description":"Path of the api to get the raw yaml of resource from hub apiserver","example":"/tekton/task/buildah/raw"},"hubURLPath":{"type":"string","description":"Url path of the resource in hub","example":"tekton/task/buildah"},"id":{"type":"integer","description":"ID is the unique id of resource's version","example":1},"minPipelinesVersion":{"type":"string","description":"Minimum pipelines version the resource's version is compatible with","example":"0.12.1"},"platforms":{"type":"array","items":{"$ref":"#/components/schemas/Category"},"description":"Platforms related to resource version","example":[{"id":1,"name":"linux/s390x"}]},"rawURL":{"type":"string","description":"Raw URL of resource's yaml file of the version","example":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","format":"uri"},"resource":{"$ref":"#/components/schemas/ResourceData"},"updatedAt":{"type":"string","description":"Timestamp when version was last updated","example":"2020-01-01 12:00:00 +0000 UTC","format":"date-time"},"version":{"type":"string","description":"Version of resource","example":"0.1"},"webURL":{"type":"string","description":"Web URL of resource's yaml file of the version","example":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml","format":"uri"}},"description":"The Version result type describes resource's version information.","required":["id","version","displayName","description","minPipelinesVersion","rawURL","webURL","updatedAt","platforms","resource","hubURLPath","hubRawURLPath"]},"Resources":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ResourceDataCollection"}},"required":["data"]},"StatusResponseBody":{"type":"object","properties":{"services":{"type":"array","items":{"$ref":"#/components/schemas/HubService"},"description":"List of services and their status"}}},"UpdateAgentRequestBody":{"type":"object","properties":{"name":{"type":"string","description":"Name of Agent","example":"abc"},"scopes":{"type":"array","items":{"type":"string"},"description":"Scopes required for Agent","example":["catalog-refresh","agent:create"]}},"required":["name","scopes"]},"UpdateAgentResponseBody":{"type":"object","properties":{"token":{"type":"string","description":"Agent JWT","example":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1Nzc4ODAzMDAsImlhdCI6MTU3Nzg4MDAwMCwiaWQiOjExLCJpc3MiOiJUZWt0b24gSHViIiwic2NvcGVzIjpbInJhdGluZzpyZWFkIiwicmF0aW5nOndyaXRlIiwiYWdlbnQ6Y3JlYXRlIl0sInR5cGUiOiJhY2Nlc3MtdG9rZW4ifQ.6pDmziSKkoSqI1f0rc4-AqVdcfY0Q8wA-tSLzdTCLgM"}},"required":["token"]},"UpdateRequestBody":{"type":"object","properties":{"rating":{"type":"integer","description":"User rating for resource","minimum":0,"maximum":5}},"required":["rating"]}},"securitySchemes":{"jwt_header_Authorization":{"type":"http","description":"Secures endpoint by requiring a valid JWT retrieved via the /auth/login endpoint.","scheme":"bearer"}}},"tags":[{"name":"swagger","description":"The swagger service serves the API swagger definition."},{"name":"admin","description":"Admin service"},{"name":"catalog","description":"The Catalog Service exposes endpoints to interact with catalogs"},{"name":"category","description":"The category service provides details about category"},{"name":"rating","description":"The rating service exposes endpoints to read and write user's rating for resources"},{"name":"resource","description":"The resource service provides details about all kind of resources"},{"name":"status","description":"Describes the status of each service"}]} \ No newline at end of file diff --git a/api/gen/http/openapi3.yaml b/api/gen/http/openapi3.yaml index 11fef1609d..3e309741fb 100644 --- a/api/gen/http/openapi3.yaml +++ b/api/gen/http/openapi3.yaml @@ -20,14 +20,6 @@ paths: application/json: schema: $ref: '#/components/schemas/StatusResponseBody' - example: - services: - - error: unable to reach db - name: api - status: ok - - error: unable to reach db - name: api - status: ok /catalog/{catalogName}/error: get: tags: @@ -52,24 +44,6 @@ paths: application/json: schema: $ref: '#/components/schemas/CatalogErrorResponseBody' - example: - data: - - errors: - - Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name - - Resource tekton.dev/v1beta1, Kind=task - curl has no display name - type: warning - - errors: - - Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name - - Resource tekton.dev/v1beta1, Kind=task - curl has no display name - type: warning - - errors: - - Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name - - Resource tekton.dev/v1beta1, Kind=task - curl has no display name - type: warning - - errors: - - Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name - - Resource tekton.dev/v1beta1, Kind=task - curl has no display name - type: warning "500": description: 'internal-error: Internal Server Error' content: @@ -108,10 +82,6 @@ paths: application/json: schema: $ref: '#/components/schemas/Job' - example: - catalogName: tekton - id: 1 - status: queued "404": description: 'not-found: Resource Not Found Error' content: @@ -148,23 +118,6 @@ paths: type: array items: $ref: '#/components/schemas/Job' - example: - - catalogName: tekton - id: 1 - status: queued - - catalogName: tekton - id: 1 - status: queued - - catalogName: tekton - id: 1 - status: queued - example: - - catalogName: tekton - id: 1 - status: queued - - catalogName: tekton - id: 1 - status: queued "500": description: 'internal-error: Internal Server Error' content: @@ -193,12 +146,6 @@ paths: application/json: schema: $ref: '#/components/schemas/ListResponseBody' - example: - data: - - id: 1 - name: Image Builder - - id: 1 - name: Image Builder "500": description: 'internal-error: Internal Server Error' content: @@ -231,7 +178,6 @@ paths: type: array items: type: string - example: Vero reiciendis est corporis. description: Catalogs of resource to filter by example: - tekton @@ -247,7 +193,6 @@ paths: type: array items: type: string - example: Architecto nisi consequatur aut ab ea. description: Category associated with a resource to filter by example: - build @@ -263,7 +208,6 @@ paths: type: array items: type: string - example: Voluptatem ratione. description: Kinds of resource to filter by example: - task @@ -279,7 +223,6 @@ paths: type: array items: type: string - example: Et vero aperiam. description: Tags associated with a resource to filter by example: - image @@ -295,7 +238,6 @@ paths: type: array items: type: string - example: Enim corrupti consequatur. description: Platforms associated with a resource to filter by example: - linux/s390x @@ -321,11 +263,9 @@ paths: type: string description: Strategy used to find matching resources default: contains - example: contains enum: - exact - contains - example: exact responses: "302": description: Found response. @@ -336,9 +276,7 @@ paths: schema: type: string description: Redirect URL - example: http://von.name/kasandra format: uri - example: http://lueilwitz.com/caroline /resource/{catalog}/{kind}/{name}: get: tags: @@ -373,11 +311,9 @@ paths: schema: type: string description: kind of resource - example: task enum: - task - pipeline - example: pipeline - name: name in: path description: Name of resource @@ -397,9 +333,7 @@ paths: schema: type: string description: Redirect URL - example: http://schroeder.org/nia.rolfson format: uri - example: http://christiansenmertz.biz/sincere /resource/{catalog}/{kind}/{name}/{version}: get: tags: @@ -424,11 +358,9 @@ paths: schema: type: string description: kind of resource - example: task enum: - task - pipeline - example: pipeline - name: name in: path description: name of resource @@ -457,9 +389,7 @@ paths: schema: type: string description: Redirect URL - example: http://denesikprohaska.biz/esmeralda.d'amore format: uri - example: http://hoeger.biz/eric /resource/{id}: get: tags: @@ -487,9 +417,7 @@ paths: schema: type: string description: Redirect URL - example: http://schiller.name/kayli format: uri - example: http://hahnbergstrom.info/jacklyn_brown /resource/{id}/rating: get: tags: @@ -505,8 +433,6 @@ paths: schema: type: integer description: ID of a resource - example: 6138028468518471795 - example: 8114659548213764512 responses: "200": description: OK response. @@ -514,8 +440,6 @@ paths: application/json: schema: $ref: '#/components/schemas/GetResponseBody' - example: - rating: 4 "401": description: 'invalid-token: Invalid User token' content: @@ -562,16 +486,12 @@ paths: schema: type: integer description: ID of a resource - example: 9890802013909619962 - example: 14770215756158772569 requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/UpdateRequestBody' - example: - rating: 0 responses: "200": description: OK response. @@ -634,9 +554,7 @@ paths: schema: type: string description: Redirect URL - example: http://muller.org/kraig format: uri - example: http://kreigeryost.org/emmanuel.rath /resource/version/{versionID}: get: tags: @@ -664,9 +582,7 @@ paths: schema: type: string description: Redirect URL - example: http://senger.info/johnathan format: uri - example: http://kovacekcassin.name/baron_rutherford /resources: get: tags: @@ -681,82 +597,6 @@ paths: application/json: schema: $ref: '#/components/schemas/Resources' - example: - data: - - catalog: - id: 1 - name: tekton - type: community - categories: - - id: 1 - name: image-build - hubRawURLPath: /tekton/task/buildah/raw - hubURLPath: tekton/task/buildah - id: 1 - kind: task - latestVersion: - description: Buildah task builds source into a container image and then pushes it to a container registry. - displayName: Buildah - hubRawURLPath: /tekton/task/buildah/latest/raw - id: 1 - minPipelinesVersion: 0.12.1 - platforms: - - id: 1 - name: linux/amd64 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml - updatedAt: 2020-01-01 12:00:00 +0000 UTC - version: "0.1" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml - name: buildah - platforms: - - id: 1 - name: linux/amd64 - rating: 4.3 - tags: - - id: 1 - name: image-build - versions: - - id: 1 - version: "0.1" - - id: 2 - version: "0.2" - - catalog: - id: 1 - name: tekton - type: community - categories: - - id: 1 - name: image-build - hubRawURLPath: /tekton/task/buildah/raw - hubURLPath: tekton/task/buildah - id: 1 - kind: task - latestVersion: - description: Buildah task builds source into a container image and then pushes it to a container registry. - displayName: Buildah - hubRawURLPath: /tekton/task/buildah/latest/raw - id: 1 - minPipelinesVersion: 0.12.1 - platforms: - - id: 1 - name: linux/amd64 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml - updatedAt: 2020-01-01 12:00:00 +0000 UTC - version: "0.1" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml - name: buildah - platforms: - - id: 1 - name: linux/amd64 - rating: 4.3 - tags: - - id: 1 - name: image-build - versions: - - id: 1 - version: "0.1" - - id: 2 - version: "0.2" /schema/swagger.json: get: tags: @@ -781,8 +621,6 @@ paths: application/json: schema: $ref: '#/components/schemas/RefreshConfigResponseBody' - example: - checksum: 41ba391c8baf1fcd3c62c11272b913dc6613f4cf3b1833cfbb32431dc4384c93 "401": description: 'invalid-token: Invalid User token' content: @@ -822,11 +660,6 @@ paths: application/json: schema: $ref: '#/components/schemas/UpdateAgentRequestBody' - example: - name: abc - scopes: - - catalog-refresh - - agent:create responses: "200": description: OK response. @@ -834,8 +667,6 @@ paths: application/json: schema: $ref: '#/components/schemas/UpdateAgentResponseBody' - example: - token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1Nzc4ODAzMDAsImlhdCI6MTU3Nzg4MDAwMCwiaWQiOjExLCJpc3MiOiJUZWt0b24gSHViIiwic2NvcGVzIjpbInJhdGluZzpyZWFkIiwicmF0aW5nOndyaXRlIiwiYWdlbnQ6Y3JlYXRlIl0sInR5cGUiOiJhY2Nlc3MtdG9rZW4ifQ.6pDmziSKkoSqI1f0rc4-AqVdcfY0Q8wA-tSLzdTCLgM "400": description: 'invalid-payload: Invalid request body' content: @@ -882,14 +713,6 @@ paths: application/json: schema: $ref: '#/components/schemas/StatusResponseBody' - example: - services: - - error: unable to reach db - name: api - status: ok - - error: unable to reach db - name: api - status: ok /v1/categories: get: tags: @@ -904,12 +727,6 @@ paths: application/json: schema: $ref: '#/components/schemas/ListResponseBody' - example: - data: - - id: 1 - name: Image Builder - - id: 1 - name: Image Builder "500": description: 'internal-error: Internal Server Error' content: @@ -944,12 +761,6 @@ components: type: string description: URL of catalog example: https://github.com/tektoncd/hub - example: - id: 1 - name: Tekton - provider: github - type: community - url: https://github.com/tektoncd/hub required: - id - name @@ -964,33 +775,6 @@ components: items: $ref: '#/components/schemas/CatalogErrors' description: Catalog errors - example: - - errors: - - Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name - - Resource tekton.dev/v1beta1, Kind=task - curl has no display name - type: warning - - errors: - - Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name - - Resource tekton.dev/v1beta1, Kind=task - curl has no display name - type: warning - - errors: - - Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name - - Resource tekton.dev/v1beta1, Kind=task - curl has no display name - type: warning - - errors: - - Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name - - Resource tekton.dev/v1beta1, Kind=task - curl has no display name - type: warning - example: - data: - - errors: - - Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name - - Resource tekton.dev/v1beta1, Kind=task - curl has no display name - type: warning - - errors: - - Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name - - Resource tekton.dev/v1beta1, Kind=task - curl has no display name - type: warning required: - data CatalogErrors: @@ -1000,7 +784,6 @@ components: type: array items: type: string - example: Nesciunt delectus sunt quidem asperiores quis. description: Catalog Error message example: - Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name @@ -1010,11 +793,6 @@ components: description: Catalog Errror type example: warning description: CatalogErrors define the errors that occurred during catalog refresh - example: - errors: - - Resource tekton.dev/v1beta1, Kind=Task - buildah has no display name - - Resource tekton.dev/v1beta1, Kind=task - curl has no display name - type: warning required: - type - errors @@ -1029,9 +807,6 @@ components: type: string description: Name of category example: Image Builder - example: - id: 1 - name: Image Builder required: - id - name @@ -1041,7 +816,6 @@ components: fault: type: boolean description: Is the error a server-side fault? - example: false id: type: string description: ID is a unique identifier for this particular occurrence of the problem. @@ -1057,19 +831,10 @@ components: temporary: type: boolean description: Is the error temporary? - example: true timeout: type: boolean description: Is the error a timeout? - example: false description: Invalid request body - example: - fault: false - id: 123abc - message: parameter 'p' must be an integer - name: bad_request - temporary: false - timeout: true required: - name - id @@ -1085,8 +850,6 @@ components: description: User rating for resource example: 4 format: int64 - example: - rating: 4 required: - rating HubService: @@ -1108,10 +871,6 @@ components: - ok - error description: Describes the services and their status - example: - error: unable to reach db - name: api - status: ok required: - name - status @@ -1130,10 +889,6 @@ components: type: string description: status of the job example: queued - example: - catalogName: tekton - id: 1 - status: queued required: - id - catalogName @@ -1145,21 +900,6 @@ components: type: array items: $ref: '#/components/schemas/Category' - example: - - id: 1 - name: Image Builder - - id: 1 - name: Image Builder - example: - data: - - id: 1 - name: Image Builder - - id: 1 - name: Image Builder - - id: 1 - name: Image Builder - - id: 1 - name: Image Builder RefreshConfigResponseBody: type: object properties: @@ -1167,8 +907,6 @@ components: type: string description: Config file checksum example: 41ba391c8baf1fcd3c62c11272b913dc6613f4cf3b1833cfbb32431dc4384c93 - example: - checksum: 41ba391c8baf1fcd3c62c11272b913dc6613f4cf3b1833cfbb32431dc4384c93 required: - checksum ResourceData: @@ -1238,44 +976,6 @@ components: - id: 2 version: "0.2" description: The resource type describes resource information. - example: - catalog: - id: 1 - name: tekton - type: community - categories: - - id: 1 - name: image-build - hubRawURLPath: /tekton/task/buildah/raw - hubURLPath: tekton/task/buildah - id: 1 - kind: task - latestVersion: - description: Buildah task builds source into a container image and then pushes it to a container registry. - displayName: Buildah - hubRawURLPath: /tekton/task/buildah/latest/raw - id: 1 - minPipelinesVersion: 0.12.1 - platforms: - - id: 1 - name: linux/amd64 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml - updatedAt: 2020-01-01 12:00:00 +0000 UTC - version: "0.1" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml - name: buildah - platforms: - - id: 1 - name: linux/amd64 - rating: 4.3 - tags: - - id: 1 - name: image-build - versions: - - id: 1 - version: "0.1" - - id: 2 - version: "0.2" required: - id - name @@ -1293,155 +993,6 @@ components: type: array items: $ref: '#/components/schemas/ResourceData' - example: - - catalog: - id: 1 - name: tekton - type: community - categories: - - id: 1 - name: image-build - hubRawURLPath: /tekton/task/buildah/raw - hubURLPath: tekton/task/buildah - id: 1 - kind: task - latestVersion: - description: Buildah task builds source into a container image and then pushes it to a container registry. - displayName: Buildah - hubRawURLPath: /tekton/task/buildah/latest/raw - id: 1 - minPipelinesVersion: 0.12.1 - platforms: - - id: 1 - name: linux/amd64 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml - updatedAt: 2020-01-01 12:00:00 +0000 UTC - version: "0.1" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml - name: buildah - platforms: - - id: 1 - name: linux/amd64 - rating: 4.3 - tags: - - id: 1 - name: image-build - versions: - - id: 1 - version: "0.1" - - id: 2 - version: "0.2" - - catalog: - id: 1 - name: tekton - type: community - categories: - - id: 1 - name: image-build - hubRawURLPath: /tekton/task/buildah/raw - hubURLPath: tekton/task/buildah - id: 1 - kind: task - latestVersion: - description: Buildah task builds source into a container image and then pushes it to a container registry. - displayName: Buildah - hubRawURLPath: /tekton/task/buildah/latest/raw - id: 1 - minPipelinesVersion: 0.12.1 - platforms: - - id: 1 - name: linux/amd64 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml - updatedAt: 2020-01-01 12:00:00 +0000 UTC - version: "0.1" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml - name: buildah - platforms: - - id: 1 - name: linux/amd64 - rating: 4.3 - tags: - - id: 1 - name: image-build - versions: - - id: 1 - version: "0.1" - - id: 2 - version: "0.2" - - catalog: - id: 1 - name: tekton - type: community - categories: - - id: 1 - name: image-build - hubRawURLPath: /tekton/task/buildah/raw - hubURLPath: tekton/task/buildah - id: 1 - kind: task - latestVersion: - description: Buildah task builds source into a container image and then pushes it to a container registry. - displayName: Buildah - hubRawURLPath: /tekton/task/buildah/latest/raw - id: 1 - minPipelinesVersion: 0.12.1 - platforms: - - id: 1 - name: linux/amd64 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml - updatedAt: 2020-01-01 12:00:00 +0000 UTC - version: "0.1" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml - name: buildah - platforms: - - id: 1 - name: linux/amd64 - rating: 4.3 - tags: - - id: 1 - name: image-build - versions: - - id: 1 - version: "0.1" - - id: 2 - version: "0.2" - - catalog: - id: 1 - name: tekton - type: community - categories: - - id: 1 - name: image-build - hubRawURLPath: /tekton/task/buildah/raw - hubURLPath: tekton/task/buildah - id: 1 - kind: task - latestVersion: - description: Buildah task builds source into a container image and then pushes it to a container registry. - displayName: Buildah - hubRawURLPath: /tekton/task/buildah/latest/raw - id: 1 - minPipelinesVersion: 0.12.1 - platforms: - - id: 1 - name: linux/amd64 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml - updatedAt: 2020-01-01 12:00:00 +0000 UTC - version: "0.1" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml - name: buildah - platforms: - - id: 1 - name: linux/amd64 - rating: 4.3 - tags: - - id: 1 - name: image-build - versions: - - id: 1 - version: "0.1" - - id: 2 - version: "0.2" ResourceVersionData: type: object properties: @@ -1503,38 +1054,6 @@ components: example: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml format: uri description: The Version result type describes resource's version information. - example: - deprecated: true - description: Buildah task builds source into a container image and then pushes it to a container registry. - displayName: Buildah - hubRawURLPath: /tekton/task/buildah/raw - hubURLPath: tekton/task/buildah - id: 1 - minPipelinesVersion: 0.12.1 - platforms: - - id: 1 - name: linux/s390x - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml - resource: - catalog: - id: 1 - type: community - categories: - - id: 1 - name: Build Tools - id: 1 - kind: task - name: buildah - platforms: - - id: 1 - name: linux/amd64 - rating: 4.3 - tags: - - id: 1 - name: image-build - updatedAt: 2020-01-01 12:00:00 +0000 UTC - version: "0.1" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml required: - id - version @@ -1553,82 +1072,6 @@ components: properties: data: $ref: '#/components/schemas/ResourceDataCollection' - example: - data: - - catalog: - id: 1 - name: tekton - type: community - categories: - - id: 1 - name: image-build - hubRawURLPath: /tekton/task/buildah/raw - hubURLPath: tekton/task/buildah - id: 1 - kind: task - latestVersion: - description: Buildah task builds source into a container image and then pushes it to a container registry. - displayName: Buildah - hubRawURLPath: /tekton/task/buildah/latest/raw - id: 1 - minPipelinesVersion: 0.12.1 - platforms: - - id: 1 - name: linux/amd64 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml - updatedAt: 2020-01-01 12:00:00 +0000 UTC - version: "0.1" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml - name: buildah - platforms: - - id: 1 - name: linux/amd64 - rating: 4.3 - tags: - - id: 1 - name: image-build - versions: - - id: 1 - version: "0.1" - - id: 2 - version: "0.2" - - catalog: - id: 1 - name: tekton - type: community - categories: - - id: 1 - name: image-build - hubRawURLPath: /tekton/task/buildah/raw - hubURLPath: tekton/task/buildah - id: 1 - kind: task - latestVersion: - description: Buildah task builds source into a container image and then pushes it to a container registry. - displayName: Buildah - hubRawURLPath: /tekton/task/buildah/latest/raw - id: 1 - minPipelinesVersion: 0.12.1 - platforms: - - id: 1 - name: linux/amd64 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml - updatedAt: 2020-01-01 12:00:00 +0000 UTC - version: "0.1" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml - name: buildah - platforms: - - id: 1 - name: linux/amd64 - rating: 4.3 - tags: - - id: 1 - name: image-build - versions: - - id: 1 - version: "0.1" - - id: 2 - version: "0.2" required: - data StatusResponseBody: @@ -1639,27 +1082,6 @@ components: items: $ref: '#/components/schemas/HubService' description: List of services and their status - example: - - error: unable to reach db - name: api - status: ok - - error: unable to reach db - name: api - status: ok - - error: unable to reach db - name: api - status: ok - - error: unable to reach db - name: api - status: ok - example: - services: - - error: unable to reach db - name: api - status: ok - - error: unable to reach db - name: api - status: ok UpdateAgentRequestBody: type: object properties: @@ -1671,16 +1093,10 @@ components: type: array items: type: string - example: Est voluptatem id. description: Scopes required for Agent example: - catalog-refresh - agent:create - example: - name: abc - scopes: - - catalog-refresh - - agent:create required: - name - scopes @@ -1691,8 +1107,6 @@ components: type: string description: Agent JWT example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1Nzc4ODAzMDAsImlhdCI6MTU3Nzg4MDAwMCwiaWQiOjExLCJpc3MiOiJUZWt0b24gSHViIiwic2NvcGVzIjpbInJhdGluZzpyZWFkIiwicmF0aW5nOndyaXRlIiwiYWdlbnQ6Y3JlYXRlIl0sInR5cGUiOiJhY2Nlc3MtdG9rZW4ifQ.6pDmziSKkoSqI1f0rc4-AqVdcfY0Q8wA-tSLzdTCLgM - example: - token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1Nzc4ODAzMDAsImlhdCI6MTU3Nzg4MDAwMCwiaWQiOjExLCJpc3MiOiJUZWt0b24gSHViIiwic2NvcGVzIjpbInJhdGluZzpyZWFkIiwicmF0aW5nOndyaXRlIiwiYWdlbnQ6Y3JlYXRlIl0sInR5cGUiOiJhY2Nlc3MtdG9rZW4ifQ.6pDmziSKkoSqI1f0rc4-AqVdcfY0Q8wA-tSLzdTCLgM required: - token UpdateRequestBody: @@ -1701,11 +1115,8 @@ components: rating: type: integer description: User rating for resource - example: 2 minimum: 0 maximum: 5 - example: - rating: 3 required: - rating securitySchemes: diff --git a/api/gen/http/rating/client/cli.go b/api/gen/http/rating/client/cli.go index 9dc72518b2..f2003e981e 100644 --- a/api/gen/http/rating/client/cli.go +++ b/api/gen/http/rating/client/cli.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // rating HTTP client CLI support package // diff --git a/api/gen/http/rating/client/client.go b/api/gen/http/rating/client/client.go index 5fb512fd80..65b554bd3d 100644 --- a/api/gen/http/rating/client/client.go +++ b/api/gen/http/rating/client/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // rating client HTTP transport // diff --git a/api/gen/http/rating/client/encode_decode.go b/api/gen/http/rating/client/encode_decode.go index 2595de4126..33471bb4db 100644 --- a/api/gen/http/rating/client/encode_decode.go +++ b/api/gen/http/rating/client/encode_decode.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // rating HTTP client encoders and decoders // diff --git a/api/gen/http/rating/client/paths.go b/api/gen/http/rating/client/paths.go index 71213caea3..611bc16a80 100644 --- a/api/gen/http/rating/client/paths.go +++ b/api/gen/http/rating/client/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // HTTP request path constructors for the rating service. // diff --git a/api/gen/http/rating/client/types.go b/api/gen/http/rating/client/types.go index c1dd218fd9..3a0223fe24 100644 --- a/api/gen/http/rating/client/types.go +++ b/api/gen/http/rating/client/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // rating HTTP client types // diff --git a/api/gen/http/rating/server/encode_decode.go b/api/gen/http/rating/server/encode_decode.go index e59ada1f43..f9157250e9 100644 --- a/api/gen/http/rating/server/encode_decode.go +++ b/api/gen/http/rating/server/encode_decode.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // rating HTTP server encoders and decoders // diff --git a/api/gen/http/rating/server/paths.go b/api/gen/http/rating/server/paths.go index 6083178465..0975345f98 100644 --- a/api/gen/http/rating/server/paths.go +++ b/api/gen/http/rating/server/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // HTTP request path constructors for the rating service. // diff --git a/api/gen/http/rating/server/server.go b/api/gen/http/rating/server/server.go index e91692c065..c8afc29b84 100644 --- a/api/gen/http/rating/server/server.go +++ b/api/gen/http/rating/server/server.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // rating HTTP server // diff --git a/api/gen/http/rating/server/types.go b/api/gen/http/rating/server/types.go index bf936ebe78..c10c42679e 100644 --- a/api/gen/http/rating/server/types.go +++ b/api/gen/http/rating/server/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // rating HTTP server types // diff --git a/api/gen/http/resource/client/cli.go b/api/gen/http/resource/client/cli.go index 53d68bded5..f9e2a3f9a1 100644 --- a/api/gen/http/resource/client/cli.go +++ b/api/gen/http/resource/client/cli.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // resource HTTP client CLI support package // diff --git a/api/gen/http/resource/client/client.go b/api/gen/http/resource/client/client.go index 9233cc2448..52657de3f3 100644 --- a/api/gen/http/resource/client/client.go +++ b/api/gen/http/resource/client/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // resource client HTTP transport // diff --git a/api/gen/http/resource/client/encode_decode.go b/api/gen/http/resource/client/encode_decode.go index 3814e61dfd..5bf987a2b7 100644 --- a/api/gen/http/resource/client/encode_decode.go +++ b/api/gen/http/resource/client/encode_decode.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // resource HTTP client encoders and decoders // diff --git a/api/gen/http/resource/client/paths.go b/api/gen/http/resource/client/paths.go index 4c16ebcea5..8700bcdd4b 100644 --- a/api/gen/http/resource/client/paths.go +++ b/api/gen/http/resource/client/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // HTTP request path constructors for the resource service. // diff --git a/api/gen/http/resource/client/types.go b/api/gen/http/resource/client/types.go index 8afc4238ee..5203c8c640 100644 --- a/api/gen/http/resource/client/types.go +++ b/api/gen/http/resource/client/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // resource HTTP client types // diff --git a/api/gen/http/resource/server/encode_decode.go b/api/gen/http/resource/server/encode_decode.go index b01361045c..6690b38a77 100644 --- a/api/gen/http/resource/server/encode_decode.go +++ b/api/gen/http/resource/server/encode_decode.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // resource HTTP server encoders and decoders // diff --git a/api/gen/http/resource/server/paths.go b/api/gen/http/resource/server/paths.go index 1d56ad107c..2cdf62cbe0 100644 --- a/api/gen/http/resource/server/paths.go +++ b/api/gen/http/resource/server/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // HTTP request path constructors for the resource service. // diff --git a/api/gen/http/resource/server/server.go b/api/gen/http/resource/server/server.go index 9ee0d99582..42ec605a9c 100644 --- a/api/gen/http/resource/server/server.go +++ b/api/gen/http/resource/server/server.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // resource HTTP server // diff --git a/api/gen/http/resource/server/types.go b/api/gen/http/resource/server/types.go index 0891160802..d7e818a82f 100644 --- a/api/gen/http/resource/server/types.go +++ b/api/gen/http/resource/server/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // resource HTTP server types // diff --git a/api/gen/http/status/client/cli.go b/api/gen/http/status/client/cli.go index 72d76e8c62..f416ca92df 100644 --- a/api/gen/http/status/client/cli.go +++ b/api/gen/http/status/client/cli.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // status HTTP client CLI support package // diff --git a/api/gen/http/status/client/client.go b/api/gen/http/status/client/client.go index ce97f384e6..8e096102b5 100644 --- a/api/gen/http/status/client/client.go +++ b/api/gen/http/status/client/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // status client HTTP transport // diff --git a/api/gen/http/status/client/encode_decode.go b/api/gen/http/status/client/encode_decode.go index 91135f1e34..1fef575722 100644 --- a/api/gen/http/status/client/encode_decode.go +++ b/api/gen/http/status/client/encode_decode.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // status HTTP client encoders and decoders // diff --git a/api/gen/http/status/client/paths.go b/api/gen/http/status/client/paths.go index fb6e251a55..99e007fc6a 100644 --- a/api/gen/http/status/client/paths.go +++ b/api/gen/http/status/client/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // HTTP request path constructors for the status service. // diff --git a/api/gen/http/status/client/types.go b/api/gen/http/status/client/types.go index ee7db49e8b..3d956452e1 100644 --- a/api/gen/http/status/client/types.go +++ b/api/gen/http/status/client/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // status HTTP client types // diff --git a/api/gen/http/status/server/encode_decode.go b/api/gen/http/status/server/encode_decode.go index 8a82123c73..1b681e1b92 100644 --- a/api/gen/http/status/server/encode_decode.go +++ b/api/gen/http/status/server/encode_decode.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // status HTTP server encoders and decoders // diff --git a/api/gen/http/status/server/paths.go b/api/gen/http/status/server/paths.go index 5e1ba27056..dabe9003f6 100644 --- a/api/gen/http/status/server/paths.go +++ b/api/gen/http/status/server/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // HTTP request path constructors for the status service. // diff --git a/api/gen/http/status/server/server.go b/api/gen/http/status/server/server.go index b33229e074..5261580a1b 100644 --- a/api/gen/http/status/server/server.go +++ b/api/gen/http/status/server/server.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // status HTTP server // diff --git a/api/gen/http/status/server/types.go b/api/gen/http/status/server/types.go index ce958c74a2..a798d32f9f 100644 --- a/api/gen/http/status/server/types.go +++ b/api/gen/http/status/server/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // status HTTP server types // diff --git a/api/gen/http/swagger/client/client.go b/api/gen/http/swagger/client/client.go index 218de89408..ac21f72f72 100644 --- a/api/gen/http/swagger/client/client.go +++ b/api/gen/http/swagger/client/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // swagger client HTTP transport // diff --git a/api/gen/http/swagger/client/encode_decode.go b/api/gen/http/swagger/client/encode_decode.go index 7ce7f68a6b..5197fb2f42 100644 --- a/api/gen/http/swagger/client/encode_decode.go +++ b/api/gen/http/swagger/client/encode_decode.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // swagger HTTP client encoders and decoders // diff --git a/api/gen/http/swagger/client/paths.go b/api/gen/http/swagger/client/paths.go index 24a0b693f5..ce13254c74 100644 --- a/api/gen/http/swagger/client/paths.go +++ b/api/gen/http/swagger/client/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // HTTP request path constructors for the swagger service. // diff --git a/api/gen/http/swagger/client/types.go b/api/gen/http/swagger/client/types.go index 50638f2820..f5ce90565f 100644 --- a/api/gen/http/swagger/client/types.go +++ b/api/gen/http/swagger/client/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // swagger HTTP client types // diff --git a/api/gen/http/swagger/server/paths.go b/api/gen/http/swagger/server/paths.go index 88c2965a42..0360f326ad 100644 --- a/api/gen/http/swagger/server/paths.go +++ b/api/gen/http/swagger/server/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // HTTP request path constructors for the swagger service. // diff --git a/api/gen/http/swagger/server/server.go b/api/gen/http/swagger/server/server.go index db1fd37812..4ed4d11400 100644 --- a/api/gen/http/swagger/server/server.go +++ b/api/gen/http/swagger/server/server.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // swagger HTTP server // diff --git a/api/gen/http/swagger/server/types.go b/api/gen/http/swagger/server/types.go index 10ad94fb6d..b9939f6cab 100644 --- a/api/gen/http/swagger/server/types.go +++ b/api/gen/http/swagger/server/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // swagger HTTP server types // diff --git a/api/gen/log/logger.go b/api/gen/log/logger.go index 1bf284153d..a12696716f 100644 --- a/api/gen/log/logger.go +++ b/api/gen/log/logger.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // Zap logger implementation // diff --git a/api/gen/rating/client.go b/api/gen/rating/client.go index 7b099f6750..410ecbc4ea 100644 --- a/api/gen/rating/client.go +++ b/api/gen/rating/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // rating client // diff --git a/api/gen/rating/endpoints.go b/api/gen/rating/endpoints.go index 669c757f71..b14ae67d44 100644 --- a/api/gen/rating/endpoints.go +++ b/api/gen/rating/endpoints.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // rating endpoints // diff --git a/api/gen/rating/service.go b/api/gen/rating/service.go index aa2c1b4693..6aefe14f32 100644 --- a/api/gen/rating/service.go +++ b/api/gen/rating/service.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // rating service // diff --git a/api/gen/resource/client.go b/api/gen/resource/client.go index b7a825bdda..9e99f77ed0 100644 --- a/api/gen/resource/client.go +++ b/api/gen/resource/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // resource client // diff --git a/api/gen/resource/endpoints.go b/api/gen/resource/endpoints.go index faaa1a2122..2db805b837 100644 --- a/api/gen/resource/endpoints.go +++ b/api/gen/resource/endpoints.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // resource endpoints // diff --git a/api/gen/resource/service.go b/api/gen/resource/service.go index 131d1997da..c679a8b82a 100644 --- a/api/gen/resource/service.go +++ b/api/gen/resource/service.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // resource service // diff --git a/api/gen/resource/views/view.go b/api/gen/resource/views/view.go index d5c0de4d38..bee8710eba 100644 --- a/api/gen/resource/views/view.go +++ b/api/gen/resource/views/view.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // resource views // diff --git a/api/gen/status/client.go b/api/gen/status/client.go index 1c838ca93b..cf645a7b79 100644 --- a/api/gen/status/client.go +++ b/api/gen/status/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // status client // diff --git a/api/gen/status/endpoints.go b/api/gen/status/endpoints.go index c25504e275..7c11fef40f 100644 --- a/api/gen/status/endpoints.go +++ b/api/gen/status/endpoints.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // status endpoints // diff --git a/api/gen/status/service.go b/api/gen/status/service.go index 724d84f290..a6ad77816d 100644 --- a/api/gen/status/service.go +++ b/api/gen/status/service.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // status service // diff --git a/api/gen/swagger/client.go b/api/gen/swagger/client.go index 2305330526..e770b78ae4 100644 --- a/api/gen/swagger/client.go +++ b/api/gen/swagger/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // swagger client // diff --git a/api/gen/swagger/endpoints.go b/api/gen/swagger/endpoints.go index 0342b8d5af..7115a50d02 100644 --- a/api/gen/swagger/endpoints.go +++ b/api/gen/swagger/endpoints.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // swagger endpoints // diff --git a/api/gen/swagger/service.go b/api/gen/swagger/service.go index 46d1f36fb2..55792ce17b 100644 --- a/api/gen/swagger/service.go +++ b/api/gen/swagger/service.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // swagger service // diff --git a/api/v1/gen/catalog/client.go b/api/v1/gen/catalog/client.go index 115abebd22..53069fe91b 100644 --- a/api/v1/gen/catalog/client.go +++ b/api/v1/gen/catalog/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // catalog client // diff --git a/api/v1/gen/catalog/endpoints.go b/api/v1/gen/catalog/endpoints.go index 6cbc0b8f42..fe76adc9c2 100644 --- a/api/v1/gen/catalog/endpoints.go +++ b/api/v1/gen/catalog/endpoints.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // catalog endpoints // diff --git a/api/v1/gen/catalog/service.go b/api/v1/gen/catalog/service.go index 5c44927b1f..7de49ba7fe 100644 --- a/api/v1/gen/catalog/service.go +++ b/api/v1/gen/catalog/service.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // catalog service // diff --git a/api/v1/gen/http/catalog/client/cli.go b/api/v1/gen/http/catalog/client/cli.go index c5f8ab7c7b..b55c4053a6 100644 --- a/api/v1/gen/http/catalog/client/cli.go +++ b/api/v1/gen/http/catalog/client/cli.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // catalog HTTP client CLI support package // diff --git a/api/v1/gen/http/catalog/client/client.go b/api/v1/gen/http/catalog/client/client.go index 5645e3cbaf..34614bd2a3 100644 --- a/api/v1/gen/http/catalog/client/client.go +++ b/api/v1/gen/http/catalog/client/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // catalog client HTTP transport // diff --git a/api/v1/gen/http/catalog/client/encode_decode.go b/api/v1/gen/http/catalog/client/encode_decode.go index f1273f0b9c..1bdd8b31d5 100644 --- a/api/v1/gen/http/catalog/client/encode_decode.go +++ b/api/v1/gen/http/catalog/client/encode_decode.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // catalog HTTP client encoders and decoders // diff --git a/api/v1/gen/http/catalog/client/paths.go b/api/v1/gen/http/catalog/client/paths.go index 8163dd5e19..8de844211a 100644 --- a/api/v1/gen/http/catalog/client/paths.go +++ b/api/v1/gen/http/catalog/client/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // HTTP request path constructors for the catalog service. // diff --git a/api/v1/gen/http/catalog/client/types.go b/api/v1/gen/http/catalog/client/types.go index 2d07622a7d..71327a7760 100644 --- a/api/v1/gen/http/catalog/client/types.go +++ b/api/v1/gen/http/catalog/client/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // catalog HTTP client types // diff --git a/api/v1/gen/http/catalog/server/encode_decode.go b/api/v1/gen/http/catalog/server/encode_decode.go index 0138dea18b..fd68e7f087 100644 --- a/api/v1/gen/http/catalog/server/encode_decode.go +++ b/api/v1/gen/http/catalog/server/encode_decode.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // catalog HTTP server encoders and decoders // diff --git a/api/v1/gen/http/catalog/server/paths.go b/api/v1/gen/http/catalog/server/paths.go index 037b0aeea9..b273ac3973 100644 --- a/api/v1/gen/http/catalog/server/paths.go +++ b/api/v1/gen/http/catalog/server/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // HTTP request path constructors for the catalog service. // diff --git a/api/v1/gen/http/catalog/server/server.go b/api/v1/gen/http/catalog/server/server.go index c6455ab78a..85db1c052f 100644 --- a/api/v1/gen/http/catalog/server/server.go +++ b/api/v1/gen/http/catalog/server/server.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // catalog HTTP server // diff --git a/api/v1/gen/http/catalog/server/types.go b/api/v1/gen/http/catalog/server/types.go index f50e13722f..9f36fef50b 100644 --- a/api/v1/gen/http/catalog/server/types.go +++ b/api/v1/gen/http/catalog/server/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // catalog HTTP server types // diff --git a/api/v1/gen/http/cli/hub/cli.go b/api/v1/gen/http/cli/hub/cli.go index 1561de637e..41d7a4b5c7 100644 --- a/api/v1/gen/http/cli/hub/cli.go +++ b/api/v1/gen/http/cli/hub/cli.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // hub HTTP client CLI support package // diff --git a/api/v1/gen/http/openapi3.json b/api/v1/gen/http/openapi3.json index 93383148a2..929845c433 100644 --- a/api/v1/gen/http/openapi3.json +++ b/api/v1/gen/http/openapi3.json @@ -1 +1 @@ -{"openapi":"3.0.3","info":{"title":"Tekton Hub","description":"HTTP services for managing Tekton Hub","version":"1.0"},"servers":[{"url":"https://api.hub.tekton.dev"}],"paths":{"/v1/catalogs":{"get":{"tags":["catalog"],"summary":"List catalog","description":"List all Catalogs","operationId":"catalog#List","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResponseBody"},"example":{"data":[{"id":1,"name":"Tekton","provider":"github","type":"community","url":"https://github.com/tektoncd/hub"},{"id":1,"name":"Tekton","provider":"github","type":"community","url":"https://github.com/tektoncd/hub"},{"id":1,"name":"Tekton","provider":"github","type":"community","url":"https://github.com/tektoncd/hub"}]}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/query":{"get":{"tags":["resource"],"summary":"Query resource","description":"Find resources by a combination of name, kind, catalog, categories, platforms and tags","operationId":"resource#Query","parameters":[{"name":"name","in":"query","description":"Name of resource","allowEmptyValue":true,"schema":{"type":"string","description":"Name of resource","default":"","example":"buildah"},"example":"buildah"},{"name":"catalogs","in":"query","description":"Catalogs of resource to filter by","allowEmptyValue":true,"schema":{"type":"array","items":{"type":"string","example":"Ut accusantium ea."},"description":"Catalogs of resource to filter by","example":["tekton","openshift"]},"example":["tekton","openshift"]},{"name":"categories","in":"query","description":"Category associated with a resource to filter by","allowEmptyValue":true,"schema":{"type":"array","items":{"type":"string","example":"Mollitia qui est deleniti aperiam."},"description":"Category associated with a resource to filter by","example":["build","tools"]},"example":["build","tools"]},{"name":"kinds","in":"query","description":"Kinds of resource to filter by","allowEmptyValue":true,"schema":{"type":"array","items":{"type":"string","example":"Possimus enim rem facere."},"description":"Kinds of resource to filter by","example":["task","pipelines"]},"example":["task","pipelines"]},{"name":"tags","in":"query","description":"Tags associated with a resource to filter by","allowEmptyValue":true,"schema":{"type":"array","items":{"type":"string","example":"Natus magnam ea voluptas ipsam molestias assumenda."},"description":"Tags associated with a resource to filter by","example":["image","build"]},"example":["image","build"]},{"name":"platforms","in":"query","description":"Platforms associated with a resource to filter by","allowEmptyValue":true,"schema":{"type":"array","items":{"type":"string","example":"Dolores dolorem sint nihil in."},"description":"Platforms associated with a resource to filter by","example":["linux/s390x","linux/amd64"]},"example":["linux/s390x","linux/amd64"]},{"name":"limit","in":"query","description":"Maximum number of resources to be returned","allowEmptyValue":true,"schema":{"type":"integer","description":"Maximum number of resources to be returned","default":1000,"example":100},"example":100},{"name":"match","in":"query","description":"Strategy used to find matching resources","allowEmptyValue":true,"schema":{"type":"string","description":"Strategy used to find matching resources","default":"contains","example":"contains","enum":["exact","contains"]},"example":"contains"}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Resources"},"example":{"data":[{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubRawURLPath":"/tekton/task/buildah/raw","hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","hubRawURLPath":"/tekton/task/buildah/latest/raw","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]},{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubRawURLPath":"/tekton/task/buildah/raw","hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","hubRawURLPath":"/tekton/task/buildah/latest/raw","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]}]}}}},"400":{"description":"invalid-kind: Invalid Resource Kind","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not-found: Resource Not Found Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/resource/version/{versionID}":{"get":{"tags":["resource"],"summary":"ByVersionId resource","description":"Find a resource using its version's id","operationId":"resource#ByVersionId","parameters":[{"name":"versionID","in":"path","description":"Version ID of a resource's version","required":true,"schema":{"type":"integer","description":"Version ID of a resource's version","example":1},"example":1}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceVersion"},"example":{"data":{"deprecated":true,"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","hubRawURLPath":"/tekton/task/buildah/raw","hubURLPath":"tekton/task/buildah","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/s390x"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","resource":{"catalog":{"id":1,"type":"community"},"categories":[{"id":1,"name":"Build Tools"}],"id":1,"kind":"task","name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}]},"updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"}}}}},"404":{"description":"not-found: Resource Not Found Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/resource/{catalog}/{kind}/{name}":{"get":{"tags":["resource"],"summary":"ByCatalogKindName resource","description":"Find resources using name of catalog, resource name and kind of resource","operationId":"resource#ByCatalogKindName","parameters":[{"name":"pipelinesversion","in":"query","description":"To find resource compatible with a Tekton pipelines version, use this param","allowEmptyValue":true,"schema":{"type":"string","description":"To find resource compatible with a Tekton pipelines version, use this param","example":"0.21.0","pattern":"^\\d+(?:\\.\\d+){0,2}$"},"example":"0.21.0"},{"name":"catalog","in":"path","description":"name of catalog","required":true,"schema":{"type":"string","description":"name of catalog","example":"tekton"},"example":"tekton"},{"name":"kind","in":"path","description":"kind of resource","required":true,"schema":{"type":"string","description":"kind of resource","example":"pipeline","enum":["task","pipeline"]},"example":"pipeline"},{"name":"name","in":"path","description":"Name of resource","required":true,"schema":{"type":"string","description":"Name of resource","example":"buildah"},"example":"buildah"}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Resource"},"example":{"data":{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubRawURLPath":"/tekton/task/buildah/raw","hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","hubRawURLPath":"/tekton/task/buildah/latest/raw","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]}}}}},"404":{"description":"not-found: Resource Not Found Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/resource/{catalog}/{kind}/{name}/raw":{"get":{"tags":["resource"],"summary":"GetLatestRawYamlByCatalogKindName resource","description":"Fetch a raw latest resource yaml file using the name of catalog, resource name, and kind","operationId":"resource#GetLatestRawYamlByCatalogKindName","parameters":[{"name":"catalog","in":"path","description":"name of catalog","required":true,"schema":{"type":"string","description":"name of catalog","example":"tekton"},"example":"tekton"},{"name":"kind","in":"path","description":"kind of resource","required":true,"schema":{"type":"string","description":"kind of resource","example":"pipeline","enum":["task","pipeline"]},"example":"task"},{"name":"name","in":"path","description":"name of resource","required":true,"schema":{"type":"string","description":"name of resource","example":"buildah"},"example":"buildah"}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"type":"string","format":"binary"}}}},"404":{"description":"not-found: Resource Not Found Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/resource/{catalog}/{kind}/{name}/{version}":{"get":{"tags":["resource"],"summary":"ByCatalogKindNameVersion resource","description":"Find resource using name of catalog \u0026 name, kind and version of resource","operationId":"resource#ByCatalogKindNameVersion","parameters":[{"name":"catalog","in":"path","description":"name of catalog","required":true,"schema":{"type":"string","description":"name of catalog","example":"tekton"},"example":"tekton"},{"name":"kind","in":"path","description":"kind of resource","required":true,"schema":{"type":"string","description":"kind of resource","example":"pipeline","enum":["task","pipeline"]},"example":"pipeline"},{"name":"name","in":"path","description":"name of resource","required":true,"schema":{"type":"string","description":"name of resource","example":"buildah"},"example":"buildah"},{"name":"version","in":"path","description":"version of resource","required":true,"schema":{"type":"string","description":"version of resource","example":"0.1"},"example":"0.1"}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceVersion"},"example":{"data":{"deprecated":true,"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","hubRawURLPath":"/tekton/task/buildah/raw","hubURLPath":"tekton/task/buildah","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/s390x"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","resource":{"catalog":{"id":1,"type":"community"},"categories":[{"id":1,"name":"Build Tools"}],"id":1,"kind":"task","name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}]},"updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"}}}}},"404":{"description":"not-found: Resource Not Found Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/resource/{catalog}/{kind}/{name}/{version}/raw":{"get":{"tags":["resource"],"summary":"GetRawYamlByCatalogKindNameVersion resource","description":"Fetch a raw resource yaml file using the name of catalog, resource name, kind, and version","operationId":"resource#GetRawYamlByCatalogKindNameVersion","parameters":[{"name":"catalog","in":"path","description":"name of catalog","required":true,"schema":{"type":"string","description":"name of catalog","example":"tekton"},"example":"tekton"},{"name":"kind","in":"path","description":"kind of resource","required":true,"schema":{"type":"string","description":"kind of resource","example":"pipeline","enum":["task","pipeline"]},"example":"pipeline"},{"name":"name","in":"path","description":"name of resource","required":true,"schema":{"type":"string","description":"name of resource","example":"buildah"},"example":"buildah"},{"name":"version","in":"path","description":"version of resource","required":true,"schema":{"type":"string","description":"version of resource","example":"0.1"},"example":"0.1"}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"type":"string","format":"binary"}}}},"404":{"description":"not-found: Resource Not Found Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/resource/{catalog}/{kind}/{name}/{version}/readme":{"get":{"tags":["resource"],"summary":"ByCatalogKindNameVersionReadme resource","description":"Find resource README using name of catalog \u0026 name, kind and version of resource","operationId":"resource#ByCatalogKindNameVersionReadme","parameters":[{"name":"catalog","in":"path","description":"name of catalog","required":true,"schema":{"type":"string","description":"name of catalog","example":"tekton"},"example":"tekton"},{"name":"kind","in":"path","description":"kind of resource","required":true,"schema":{"type":"string","description":"kind of resource","example":"pipeline","enum":["task","pipeline"]},"example":"task"},{"name":"name","in":"path","description":"name of resource","required":true,"schema":{"type":"string","description":"name of resource","example":"buildah"},"example":"buildah"},{"name":"version","in":"path","description":"version of resource","required":true,"schema":{"type":"string","description":"version of resource","example":"0.1"},"example":"0.1"}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceVersionReadme"},"example":{"data":{"readme":"#Readme\n Sample readme content","yaml":"#YAML\n Sample yaml content"}}}}},"404":{"description":"not-found: Resource Not Found Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/resource/{catalog}/{kind}/{name}/{version}/yaml":{"get":{"tags":["resource"],"summary":"ByCatalogKindNameVersionYaml resource","description":"Find resource YAML using name of catalog \u0026 name, kind and version of resource","operationId":"resource#ByCatalogKindNameVersionYaml","parameters":[{"name":"catalog","in":"path","description":"name of catalog","required":true,"schema":{"type":"string","description":"name of catalog","example":"tekton"},"example":"tekton"},{"name":"kind","in":"path","description":"kind of resource","required":true,"schema":{"type":"string","description":"kind of resource","example":"pipeline","enum":["task","pipeline"]},"example":"task"},{"name":"name","in":"path","description":"name of resource","required":true,"schema":{"type":"string","description":"name of resource","example":"buildah"},"example":"buildah"},{"name":"version","in":"path","description":"version of resource","required":true,"schema":{"type":"string","description":"version of resource","example":"0.1"},"example":"0.1"}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceVersionYaml"},"example":{"data":{"readme":"#Readme\n Sample readme content","yaml":"#YAML\n Sample yaml content"}}}}},"404":{"description":"not-found: Resource Not Found Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/resource/{id}":{"get":{"tags":["resource"],"summary":"ById resource","description":"Find a resource using it's id","operationId":"resource#ById","parameters":[{"name":"id","in":"path","description":"ID of a resource","required":true,"schema":{"type":"integer","description":"ID of a resource","example":1},"example":1}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Resource"},"example":{"data":{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubRawURLPath":"/tekton/task/buildah/raw","hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","hubRawURLPath":"/tekton/task/buildah/latest/raw","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]}}}}},"404":{"description":"not-found: Resource Not Found Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/resource/{id}/versions":{"get":{"tags":["resource"],"summary":"VersionsByID resource","description":"Find all versions of a resource by its id","operationId":"resource#VersionsByID","parameters":[{"name":"id","in":"path","description":"ID of a resource","required":true,"schema":{"type":"integer","description":"ID of a resource","example":1},"example":1}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceVersions"},"example":{"data":{"latest":{"hubRawURLPath":"/resource/tektoncd/task/buildah/raw","id":2,"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.2/buildah.yaml","version":"0.2","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.2/buildah.yaml"},"versions":[{"hubRawURLPath":"/resource/tektoncd/task/buildah/0.1/raw","id":1,"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},{"hubRawURLPath":"/resource/tektoncd/task/buildah/0.2/raw","id":2,"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.2/buildah.yaml","version":"0.2","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.2/buildah.yaml"}]}}}}},"404":{"description":"not-found: Resource Not Found Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/resources":{"get":{"tags":["resource"],"summary":"List resource","description":"List all resources sorted by rating and name","operationId":"resource#List","parameters":[{"name":"limit","in":"query","description":"Maximum number of resources to be returned","allowEmptyValue":true,"schema":{"type":"integer","description":"Maximum number of resources to be returned","default":1000,"example":100},"example":100}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Resources"},"example":{"data":[{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubRawURLPath":"/tekton/task/buildah/raw","hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","hubRawURLPath":"/tekton/task/buildah/latest/raw","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]},{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubRawURLPath":"/tekton/task/buildah/raw","hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","hubRawURLPath":"/tekton/task/buildah/latest/raw","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]}]}}}},"404":{"description":"not-found: Resource Not Found Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/schema/swagger.json":{"get":{"tags":["swagger"],"summary":"Download docs/v1/openapi3.json","description":"JSON document containing the API swagger definition","operationId":"swagger#/v1/schema/swagger.json","responses":{"200":{"description":"File downloaded"}}}}},"components":{"schemas":{"Catalog":{"type":"object","properties":{"id":{"type":"integer","description":"ID is the unique id of the catalog","example":1},"name":{"type":"string","description":"Name of catalog","example":"Tekton"},"provider":{"type":"string","description":"Provider of catalog","example":"github"},"type":{"type":"string","description":"Type of catalog","example":"community","enum":["official","community"]},"url":{"type":"string","description":"URL of catalog","example":"https://github.com/tektoncd/hub"}},"example":{"id":1,"name":"Tekton","provider":"github","type":"community","url":"https://github.com/tektoncd/hub"},"required":["id","name","type","url","provider"]},"Category":{"type":"object","properties":{"id":{"type":"integer","description":"ID is the unique id of the category","example":1},"name":{"type":"string","description":"Name of category","example":"Image Builder"}},"example":{"id":1,"name":"Image Builder"},"required":["id","name"]},"Error":{"type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?","example":true},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?","example":true},"timeout":{"type":"boolean","description":"Is the error a timeout?","example":true}},"description":"Internal Server Error","example":{"fault":true,"id":"123abc","message":"parameter 'p' must be an integer","name":"bad_request","temporary":true,"timeout":false},"required":["name","id","message","temporary","timeout","fault"]},"ListResponseBody":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Catalog"},"example":[{"id":1,"name":"Tekton","provider":"github","type":"community","url":"https://github.com/tektoncd/hub"},{"id":1,"name":"Tekton","provider":"github","type":"community","url":"https://github.com/tektoncd/hub"}]}},"example":{"data":[{"id":1,"name":"Tekton","provider":"github","type":"community","url":"https://github.com/tektoncd/hub"},{"id":1,"name":"Tekton","provider":"github","type":"community","url":"https://github.com/tektoncd/hub"},{"id":1,"name":"Tekton","provider":"github","type":"community","url":"https://github.com/tektoncd/hub"}]}},"Resource":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ResourceData"}},"example":{"data":{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubRawURLPath":"/tekton/task/buildah/raw","hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","hubRawURLPath":"/tekton/task/buildah/latest/raw","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]}},"required":["data"]},"ResourceContent":{"type":"object","properties":{"readme":{"type":"string","description":"Readme","example":"#Readme\n Sample readme content"},"yaml":{"type":"string","description":"Yaml","example":"#YAML\n Sample yaml content"}},"example":{"readme":"#Readme\n Sample readme content","yaml":"#YAML\n Sample yaml content"}},"ResourceData":{"type":"object","properties":{"catalog":{"$ref":"#/components/schemas/Catalog"},"categories":{"type":"array","items":{"$ref":"#/components/schemas/Category"},"description":"Categories related to resource","example":[{"id":1,"name":"image-build"}]},"hubRawURLPath":{"type":"string","description":"Path of the api to get the raw yaml of resource from hub apiserver","example":"/tekton/task/buildah/raw"},"hubURLPath":{"type":"string","description":"Url path of the resource in hub","example":"tekton/task/buildah"},"id":{"type":"integer","description":"ID is the unique id of the resource","example":1},"kind":{"type":"string","description":"Kind of resource","example":"task"},"latestVersion":{"$ref":"#/components/schemas/ResourceVersionData"},"name":{"type":"string","description":"Name of resource","example":"buildah"},"platforms":{"type":"array","items":{"$ref":"#/components/schemas/Category"},"description":"Platforms related to resource","example":[{"id":1,"name":"linux/amd64"}]},"rating":{"type":"number","description":"Rating of resource","example":4.3,"format":"double"},"tags":{"type":"array","items":{"$ref":"#/components/schemas/Category"},"description":"Tags related to resource","example":[{"id":1,"name":"image-build"}]},"versions":{"type":"array","items":{"$ref":"#/components/schemas/ResourceVersionData"},"description":"List of all versions of a resource","example":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]}},"description":"The resource type describes resource information.","example":{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubRawURLPath":"/tekton/task/buildah/raw","hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","hubRawURLPath":"/tekton/task/buildah/latest/raw","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]},"required":["id","name","catalog","categories","kind","hubURLPath","latestVersion","tags","platforms","rating","versions","hubRawURLPath"]},"ResourceDataCollection":{"type":"array","items":{"$ref":"#/components/schemas/ResourceData"},"example":[{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubRawURLPath":"/tekton/task/buildah/raw","hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","hubRawURLPath":"/tekton/task/buildah/latest/raw","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]},{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubRawURLPath":"/tekton/task/buildah/raw","hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","hubRawURLPath":"/tekton/task/buildah/latest/raw","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]},{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubRawURLPath":"/tekton/task/buildah/raw","hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","hubRawURLPath":"/tekton/task/buildah/latest/raw","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]},{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubRawURLPath":"/tekton/task/buildah/raw","hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","hubRawURLPath":"/tekton/task/buildah/latest/raw","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]}]},"ResourceVersion":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ResourceVersionData"}},"example":{"data":{"deprecated":true,"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","hubRawURLPath":"/tekton/task/buildah/raw","hubURLPath":"tekton/task/buildah","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/s390x"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","resource":{"catalog":{"id":1,"type":"community"},"categories":[{"id":1,"name":"Build Tools"}],"id":1,"kind":"task","name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}]},"updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"}},"required":["data"]},"ResourceVersionData":{"type":"object","properties":{"deprecated":{"type":"boolean","description":"Deprecation status of a version","example":true},"description":{"type":"string","description":"Description of version","example":"Buildah task builds source into a container image and then pushes it to a container registry."},"displayName":{"type":"string","description":"Display name of version","example":"Buildah"},"hubRawURLPath":{"type":"string","description":"Path of the api to get the raw yaml of resource from hub apiserver","example":"/tekton/task/buildah/raw"},"hubURLPath":{"type":"string","description":"Url path of the resource in hub","example":"tekton/task/buildah"},"id":{"type":"integer","description":"ID is the unique id of resource's version","example":1},"minPipelinesVersion":{"type":"string","description":"Minimum pipelines version the resource's version is compatible with","example":"0.12.1"},"platforms":{"type":"array","items":{"$ref":"#/components/schemas/Category"},"description":"Platforms related to resource version","example":[{"id":1,"name":"linux/s390x"}]},"rawURL":{"type":"string","description":"Raw URL of resource's yaml file of the version","example":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","format":"uri"},"resource":{"$ref":"#/components/schemas/ResourceData"},"updatedAt":{"type":"string","description":"Timestamp when version was last updated","example":"2020-01-01 12:00:00 +0000 UTC","format":"date-time"},"version":{"type":"string","description":"Version of resource","example":"0.1"},"webURL":{"type":"string","description":"Web URL of resource's yaml file of the version","example":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml","format":"uri"}},"description":"The Version result type describes resource's version information.","example":{"deprecated":true,"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","hubRawURLPath":"/tekton/task/buildah/raw","hubURLPath":"tekton/task/buildah","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/s390x"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","resource":{"catalog":{"id":1,"type":"community"},"categories":[{"id":1,"name":"Build Tools"}],"id":1,"kind":"task","name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}]},"updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"required":["id","version","displayName","description","minPipelinesVersion","rawURL","webURL","updatedAt","platforms","resource","hubURLPath","hubRawURLPath"]},"ResourceVersionReadme":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ResourceContent"}},"example":{"data":{"readme":"#Readme\n Sample readme content","yaml":"#YAML\n Sample yaml content"}},"required":["data"]},"ResourceVersionYaml":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ResourceContent"}},"example":{"data":{"readme":"#Readme\n Sample readme content","yaml":"#YAML\n Sample yaml content"}},"required":["data"]},"ResourceVersions":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Versions"}},"example":{"data":{"latest":{"hubRawURLPath":"/resource/tektoncd/task/buildah/raw","id":2,"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.2/buildah.yaml","version":"0.2","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.2/buildah.yaml"},"versions":[{"hubRawURLPath":"/resource/tektoncd/task/buildah/0.1/raw","id":1,"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},{"hubRawURLPath":"/resource/tektoncd/task/buildah/0.2/raw","id":2,"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.2/buildah.yaml","version":"0.2","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.2/buildah.yaml"}]}},"required":["data"]},"Resources":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ResourceDataCollection"}},"example":{"data":[{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubRawURLPath":"/tekton/task/buildah/raw","hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","hubRawURLPath":"/tekton/task/buildah/latest/raw","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]},{"catalog":{"id":1,"name":"tekton","type":"community"},"categories":[{"id":1,"name":"image-build"}],"hubRawURLPath":"/tekton/task/buildah/raw","hubURLPath":"tekton/task/buildah","id":1,"kind":"task","latestVersion":{"description":"Buildah task builds source into a container image and then pushes it to a container registry.","displayName":"Buildah","hubRawURLPath":"/tekton/task/buildah/latest/raw","id":1,"minPipelinesVersion":"0.12.1","platforms":[{"id":1,"name":"linux/amd64"}],"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","updatedAt":"2020-01-01 12:00:00 +0000 UTC","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},"name":"buildah","platforms":[{"id":1,"name":"linux/amd64"}],"rating":4.3,"tags":[{"id":1,"name":"image-build"}],"versions":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]}]},"required":["data"]},"Versions":{"type":"object","properties":{"latest":{"$ref":"#/components/schemas/ResourceVersionData"},"versions":{"type":"array","items":{"$ref":"#/components/schemas/ResourceVersionData"},"description":"List of all versions of resource","example":[{"hubRawURLPath":"/resource/tektoncd/task/buildah/0.1/raw","id":1,"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},{"hubRawURLPath":"/resource/tektoncd/task/buildah/0.2/raw","id":2,"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.2/buildah.yaml","version":"0.2","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.2/buildah.yaml"}]}},"description":"The Versions type describes response for versions by resource id API.","example":{"latest":{"hubRawURLPath":"/resource/tektoncd/task/buildah/raw","id":2,"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.2/buildah.yaml","version":"0.2","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.2/buildah.yaml"},"versions":[{"hubRawURLPath":"/resource/tektoncd/task/buildah/0.1/raw","id":1,"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},{"hubRawURLPath":"/resource/tektoncd/task/buildah/0.2/raw","id":2,"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.2/buildah.yaml","version":"0.2","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.2/buildah.yaml"}]},"required":["latest","versions"]}}},"tags":[{"name":"catalog","description":"The catalog service provides details about catalogs."},{"name":"resource","description":"The resource service provides details about all kind of resources"},{"name":"swagger","description":"The swagger service serves the API swagger definition."}]} \ No newline at end of file +{"openapi":"3.0.3","info":{"title":"Tekton Hub","description":"HTTP services for managing Tekton Hub","version":"1.0"},"servers":[{"url":"https://api.hub.tekton.dev"}],"paths":{"/v1/catalogs":{"get":{"tags":["catalog"],"summary":"List catalog","description":"List all Catalogs","operationId":"catalog#List","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResponseBody"}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/query":{"get":{"tags":["resource"],"summary":"Query resource","description":"Find resources by a combination of name, kind, catalog, categories, platforms and tags","operationId":"resource#Query","parameters":[{"name":"name","in":"query","description":"Name of resource","allowEmptyValue":true,"schema":{"type":"string","description":"Name of resource","default":"","example":"buildah"},"example":"buildah"},{"name":"catalogs","in":"query","description":"Catalogs of resource to filter by","allowEmptyValue":true,"schema":{"type":"array","items":{"type":"string"},"description":"Catalogs of resource to filter by","example":["tekton","openshift"]},"example":["tekton","openshift"]},{"name":"categories","in":"query","description":"Category associated with a resource to filter by","allowEmptyValue":true,"schema":{"type":"array","items":{"type":"string"},"description":"Category associated with a resource to filter by","example":["build","tools"]},"example":["build","tools"]},{"name":"kinds","in":"query","description":"Kinds of resource to filter by","allowEmptyValue":true,"schema":{"type":"array","items":{"type":"string"},"description":"Kinds of resource to filter by","example":["task","pipelines"]},"example":["task","pipelines"]},{"name":"tags","in":"query","description":"Tags associated with a resource to filter by","allowEmptyValue":true,"schema":{"type":"array","items":{"type":"string"},"description":"Tags associated with a resource to filter by","example":["image","build"]},"example":["image","build"]},{"name":"platforms","in":"query","description":"Platforms associated with a resource to filter by","allowEmptyValue":true,"schema":{"type":"array","items":{"type":"string"},"description":"Platforms associated with a resource to filter by","example":["linux/s390x","linux/amd64"]},"example":["linux/s390x","linux/amd64"]},{"name":"limit","in":"query","description":"Maximum number of resources to be returned","allowEmptyValue":true,"schema":{"type":"integer","description":"Maximum number of resources to be returned","default":1000,"example":100},"example":100},{"name":"match","in":"query","description":"Strategy used to find matching resources","allowEmptyValue":true,"schema":{"type":"string","description":"Strategy used to find matching resources","default":"contains","enum":["exact","contains"]}}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Resources"}}}},"400":{"description":"invalid-kind: Invalid Resource Kind","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not-found: Resource Not Found Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/resource/version/{versionID}":{"get":{"tags":["resource"],"summary":"ByVersionId resource","description":"Find a resource using its version's id","operationId":"resource#ByVersionId","parameters":[{"name":"versionID","in":"path","description":"Version ID of a resource's version","required":true,"schema":{"type":"integer","description":"Version ID of a resource's version","example":1},"example":1}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceVersion"}}}},"404":{"description":"not-found: Resource Not Found Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/resource/{catalog}/{kind}/{name}":{"get":{"tags":["resource"],"summary":"ByCatalogKindName resource","description":"Find resources using name of catalog, resource name and kind of resource","operationId":"resource#ByCatalogKindName","parameters":[{"name":"pipelinesversion","in":"query","description":"To find resource compatible with a Tekton pipelines version, use this param","allowEmptyValue":true,"schema":{"type":"string","description":"To find resource compatible with a Tekton pipelines version, use this param","example":"0.21.0","pattern":"^\\d+(?:\\.\\d+){0,2}$"},"example":"0.21.0"},{"name":"catalog","in":"path","description":"name of catalog","required":true,"schema":{"type":"string","description":"name of catalog","example":"tekton"},"example":"tekton"},{"name":"kind","in":"path","description":"kind of resource","required":true,"schema":{"type":"string","description":"kind of resource","enum":["task","pipeline"]}},{"name":"name","in":"path","description":"Name of resource","required":true,"schema":{"type":"string","description":"Name of resource","example":"buildah"},"example":"buildah"}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Resource"}}}},"404":{"description":"not-found: Resource Not Found Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/resource/{catalog}/{kind}/{name}/raw":{"get":{"tags":["resource"],"summary":"GetLatestRawYamlByCatalogKindName resource","description":"Fetch a raw latest resource yaml file using the name of catalog, resource name, and kind","operationId":"resource#GetLatestRawYamlByCatalogKindName","parameters":[{"name":"catalog","in":"path","description":"name of catalog","required":true,"schema":{"type":"string","description":"name of catalog","example":"tekton"},"example":"tekton"},{"name":"kind","in":"path","description":"kind of resource","required":true,"schema":{"type":"string","description":"kind of resource","enum":["task","pipeline"]}},{"name":"name","in":"path","description":"name of resource","required":true,"schema":{"type":"string","description":"name of resource","example":"buildah"},"example":"buildah"}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"type":"string","format":"binary"}}}},"404":{"description":"not-found: Resource Not Found Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/resource/{catalog}/{kind}/{name}/{version}":{"get":{"tags":["resource"],"summary":"ByCatalogKindNameVersion resource","description":"Find resource using name of catalog \u0026 name, kind and version of resource","operationId":"resource#ByCatalogKindNameVersion","parameters":[{"name":"catalog","in":"path","description":"name of catalog","required":true,"schema":{"type":"string","description":"name of catalog","example":"tekton"},"example":"tekton"},{"name":"kind","in":"path","description":"kind of resource","required":true,"schema":{"type":"string","description":"kind of resource","enum":["task","pipeline"]}},{"name":"name","in":"path","description":"name of resource","required":true,"schema":{"type":"string","description":"name of resource","example":"buildah"},"example":"buildah"},{"name":"version","in":"path","description":"version of resource","required":true,"schema":{"type":"string","description":"version of resource","example":"0.1"},"example":"0.1"}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceVersion"}}}},"404":{"description":"not-found: Resource Not Found Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/resource/{catalog}/{kind}/{name}/{version}/raw":{"get":{"tags":["resource"],"summary":"GetRawYamlByCatalogKindNameVersion resource","description":"Fetch a raw resource yaml file using the name of catalog, resource name, kind, and version","operationId":"resource#GetRawYamlByCatalogKindNameVersion","parameters":[{"name":"catalog","in":"path","description":"name of catalog","required":true,"schema":{"type":"string","description":"name of catalog","example":"tekton"},"example":"tekton"},{"name":"kind","in":"path","description":"kind of resource","required":true,"schema":{"type":"string","description":"kind of resource","enum":["task","pipeline"]}},{"name":"name","in":"path","description":"name of resource","required":true,"schema":{"type":"string","description":"name of resource","example":"buildah"},"example":"buildah"},{"name":"version","in":"path","description":"version of resource","required":true,"schema":{"type":"string","description":"version of resource","example":"0.1"},"example":"0.1"}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"type":"string","format":"binary"}}}},"404":{"description":"not-found: Resource Not Found Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/resource/{catalog}/{kind}/{name}/{version}/readme":{"get":{"tags":["resource"],"summary":"ByCatalogKindNameVersionReadme resource","description":"Find resource README using name of catalog \u0026 name, kind and version of resource","operationId":"resource#ByCatalogKindNameVersionReadme","parameters":[{"name":"catalog","in":"path","description":"name of catalog","required":true,"schema":{"type":"string","description":"name of catalog","example":"tekton"},"example":"tekton"},{"name":"kind","in":"path","description":"kind of resource","required":true,"schema":{"type":"string","description":"kind of resource","enum":["task","pipeline"]}},{"name":"name","in":"path","description":"name of resource","required":true,"schema":{"type":"string","description":"name of resource","example":"buildah"},"example":"buildah"},{"name":"version","in":"path","description":"version of resource","required":true,"schema":{"type":"string","description":"version of resource","example":"0.1"},"example":"0.1"}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceVersionReadme"}}}},"404":{"description":"not-found: Resource Not Found Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/resource/{catalog}/{kind}/{name}/{version}/yaml":{"get":{"tags":["resource"],"summary":"ByCatalogKindNameVersionYaml resource","description":"Find resource YAML using name of catalog \u0026 name, kind and version of resource","operationId":"resource#ByCatalogKindNameVersionYaml","parameters":[{"name":"catalog","in":"path","description":"name of catalog","required":true,"schema":{"type":"string","description":"name of catalog","example":"tekton"},"example":"tekton"},{"name":"kind","in":"path","description":"kind of resource","required":true,"schema":{"type":"string","description":"kind of resource","enum":["task","pipeline"]}},{"name":"name","in":"path","description":"name of resource","required":true,"schema":{"type":"string","description":"name of resource","example":"buildah"},"example":"buildah"},{"name":"version","in":"path","description":"version of resource","required":true,"schema":{"type":"string","description":"version of resource","example":"0.1"},"example":"0.1"}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceVersionYaml"}}}},"404":{"description":"not-found: Resource Not Found Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/resource/{id}":{"get":{"tags":["resource"],"summary":"ById resource","description":"Find a resource using it's id","operationId":"resource#ById","parameters":[{"name":"id","in":"path","description":"ID of a resource","required":true,"schema":{"type":"integer","description":"ID of a resource","example":1},"example":1}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Resource"}}}},"404":{"description":"not-found: Resource Not Found Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/resource/{id}/versions":{"get":{"tags":["resource"],"summary":"VersionsByID resource","description":"Find all versions of a resource by its id","operationId":"resource#VersionsByID","parameters":[{"name":"id","in":"path","description":"ID of a resource","required":true,"schema":{"type":"integer","description":"ID of a resource","example":1},"example":1}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceVersions"}}}},"404":{"description":"not-found: Resource Not Found Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/resources":{"get":{"tags":["resource"],"summary":"List resource","description":"List all resources sorted by rating and name","operationId":"resource#List","parameters":[{"name":"limit","in":"query","description":"Maximum number of resources to be returned","allowEmptyValue":true,"schema":{"type":"integer","description":"Maximum number of resources to be returned","default":1000,"example":100},"example":100}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Resources"}}}},"404":{"description":"not-found: Resource Not Found Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal-error: Internal Server Error","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/schema/swagger.json":{"get":{"tags":["swagger"],"summary":"Download docs/v1/openapi3.json","description":"JSON document containing the API swagger definition","operationId":"swagger#/v1/schema/swagger.json","responses":{"200":{"description":"File downloaded"}}}}},"components":{"schemas":{"Catalog":{"type":"object","properties":{"id":{"type":"integer","description":"ID is the unique id of the catalog","example":1},"name":{"type":"string","description":"Name of catalog","example":"Tekton"},"provider":{"type":"string","description":"Provider of catalog","example":"github"},"type":{"type":"string","description":"Type of catalog","example":"community","enum":["official","community"]},"url":{"type":"string","description":"URL of catalog","example":"https://github.com/tektoncd/hub"}},"required":["id","name","type","url","provider"]},"Category":{"type":"object","properties":{"id":{"type":"integer","description":"ID is the unique id of the category","example":1},"name":{"type":"string","description":"Name of category","example":"Image Builder"}},"required":["id","name"]},"Error":{"type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?"},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem.","example":"123abc"},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem.","example":"parameter 'p' must be an integer"},"name":{"type":"string","description":"Name is the name of this class of errors.","example":"bad_request"},"temporary":{"type":"boolean","description":"Is the error temporary?"},"timeout":{"type":"boolean","description":"Is the error a timeout?"}},"description":"Internal Server Error","required":["name","id","message","temporary","timeout","fault"]},"ListResponseBody":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Catalog"}}}},"Resource":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ResourceData"}},"required":["data"]},"ResourceContent":{"type":"object","properties":{"readme":{"type":"string","description":"Readme","example":"#Readme\n Sample readme content"},"yaml":{"type":"string","description":"Yaml","example":"#YAML\n Sample yaml content"}}},"ResourceData":{"type":"object","properties":{"catalog":{"$ref":"#/components/schemas/Catalog"},"categories":{"type":"array","items":{"$ref":"#/components/schemas/Category"},"description":"Categories related to resource","example":[{"id":1,"name":"image-build"}]},"hubRawURLPath":{"type":"string","description":"Path of the api to get the raw yaml of resource from hub apiserver","example":"/tekton/task/buildah/raw"},"hubURLPath":{"type":"string","description":"Url path of the resource in hub","example":"tekton/task/buildah"},"id":{"type":"integer","description":"ID is the unique id of the resource","example":1},"kind":{"type":"string","description":"Kind of resource","example":"task"},"latestVersion":{"$ref":"#/components/schemas/ResourceVersionData"},"name":{"type":"string","description":"Name of resource","example":"buildah"},"platforms":{"type":"array","items":{"$ref":"#/components/schemas/Category"},"description":"Platforms related to resource","example":[{"id":1,"name":"linux/amd64"}]},"rating":{"type":"number","description":"Rating of resource","example":4.3,"format":"double"},"tags":{"type":"array","items":{"$ref":"#/components/schemas/Category"},"description":"Tags related to resource","example":[{"id":1,"name":"image-build"}]},"versions":{"type":"array","items":{"$ref":"#/components/schemas/ResourceVersionData"},"description":"List of all versions of a resource","example":[{"id":1,"version":"0.1"},{"id":2,"version":"0.2"}]}},"description":"The resource type describes resource information.","required":["id","name","catalog","categories","kind","hubURLPath","latestVersion","tags","platforms","rating","versions","hubRawURLPath"]},"ResourceDataCollection":{"type":"array","items":{"$ref":"#/components/schemas/ResourceData"}},"ResourceVersion":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ResourceVersionData"}},"required":["data"]},"ResourceVersionData":{"type":"object","properties":{"deprecated":{"type":"boolean","description":"Deprecation status of a version","example":true},"description":{"type":"string","description":"Description of version","example":"Buildah task builds source into a container image and then pushes it to a container registry."},"displayName":{"type":"string","description":"Display name of version","example":"Buildah"},"hubRawURLPath":{"type":"string","description":"Path of the api to get the raw yaml of resource from hub apiserver","example":"/tekton/task/buildah/raw"},"hubURLPath":{"type":"string","description":"Url path of the resource in hub","example":"tekton/task/buildah"},"id":{"type":"integer","description":"ID is the unique id of resource's version","example":1},"minPipelinesVersion":{"type":"string","description":"Minimum pipelines version the resource's version is compatible with","example":"0.12.1"},"platforms":{"type":"array","items":{"$ref":"#/components/schemas/Category"},"description":"Platforms related to resource version","example":[{"id":1,"name":"linux/s390x"}]},"rawURL":{"type":"string","description":"Raw URL of resource's yaml file of the version","example":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","format":"uri"},"resource":{"$ref":"#/components/schemas/ResourceData"},"updatedAt":{"type":"string","description":"Timestamp when version was last updated","example":"2020-01-01 12:00:00 +0000 UTC","format":"date-time"},"version":{"type":"string","description":"Version of resource","example":"0.1"},"webURL":{"type":"string","description":"Web URL of resource's yaml file of the version","example":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml","format":"uri"}},"description":"The Version result type describes resource's version information.","required":["id","version","displayName","description","minPipelinesVersion","rawURL","webURL","updatedAt","platforms","resource","hubURLPath","hubRawURLPath"]},"ResourceVersionReadme":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ResourceContent"}},"required":["data"]},"ResourceVersionYaml":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ResourceContent"}},"required":["data"]},"ResourceVersions":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Versions"}},"required":["data"]},"Resources":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ResourceDataCollection"}},"required":["data"]},"Versions":{"type":"object","properties":{"latest":{"$ref":"#/components/schemas/ResourceVersionData"},"versions":{"type":"array","items":{"$ref":"#/components/schemas/ResourceVersionData"},"description":"List of all versions of resource","example":[{"hubRawURLPath":"/resource/tektoncd/task/buildah/0.1/raw","id":1,"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml","version":"0.1","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml"},{"hubRawURLPath":"/resource/tektoncd/task/buildah/0.2/raw","id":2,"rawURL":"https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.2/buildah.yaml","version":"0.2","webURL":"https://github.com/tektoncd/catalog/blob/main/task/buildah/0.2/buildah.yaml"}]}},"description":"The Versions type describes response for versions by resource id API.","required":["latest","versions"]}}},"tags":[{"name":"catalog","description":"The catalog service provides details about catalogs."},{"name":"resource","description":"The resource service provides details about all kind of resources"},{"name":"swagger","description":"The swagger service serves the API swagger definition."}]} \ No newline at end of file diff --git a/api/v1/gen/http/openapi3.yaml b/api/v1/gen/http/openapi3.yaml index 8d08197623..7f1b8ae038 100644 --- a/api/v1/gen/http/openapi3.yaml +++ b/api/v1/gen/http/openapi3.yaml @@ -20,23 +20,6 @@ paths: application/json: schema: $ref: '#/components/schemas/ListResponseBody' - example: - data: - - id: 1 - name: Tekton - provider: github - type: community - url: https://github.com/tektoncd/hub - - id: 1 - name: Tekton - provider: github - type: community - url: https://github.com/tektoncd/hub - - id: 1 - name: Tekton - provider: github - type: community - url: https://github.com/tektoncd/hub "500": description: 'internal-error: Internal Server Error' content: @@ -69,7 +52,6 @@ paths: type: array items: type: string - example: Ut accusantium ea. description: Catalogs of resource to filter by example: - tekton @@ -85,7 +67,6 @@ paths: type: array items: type: string - example: Mollitia qui est deleniti aperiam. description: Category associated with a resource to filter by example: - build @@ -101,7 +82,6 @@ paths: type: array items: type: string - example: Possimus enim rem facere. description: Kinds of resource to filter by example: - task @@ -117,7 +97,6 @@ paths: type: array items: type: string - example: Natus magnam ea voluptas ipsam molestias assumenda. description: Tags associated with a resource to filter by example: - image @@ -133,7 +112,6 @@ paths: type: array items: type: string - example: Dolores dolorem sint nihil in. description: Platforms associated with a resource to filter by example: - linux/s390x @@ -159,11 +137,9 @@ paths: type: string description: Strategy used to find matching resources default: contains - example: contains enum: - exact - contains - example: contains responses: "200": description: OK response. @@ -171,82 +147,6 @@ paths: application/json: schema: $ref: '#/components/schemas/Resources' - example: - data: - - catalog: - id: 1 - name: tekton - type: community - categories: - - id: 1 - name: image-build - hubRawURLPath: /tekton/task/buildah/raw - hubURLPath: tekton/task/buildah - id: 1 - kind: task - latestVersion: - description: Buildah task builds source into a container image and then pushes it to a container registry. - displayName: Buildah - hubRawURLPath: /tekton/task/buildah/latest/raw - id: 1 - minPipelinesVersion: 0.12.1 - platforms: - - id: 1 - name: linux/amd64 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml - updatedAt: 2020-01-01 12:00:00 +0000 UTC - version: "0.1" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml - name: buildah - platforms: - - id: 1 - name: linux/amd64 - rating: 4.3 - tags: - - id: 1 - name: image-build - versions: - - id: 1 - version: "0.1" - - id: 2 - version: "0.2" - - catalog: - id: 1 - name: tekton - type: community - categories: - - id: 1 - name: image-build - hubRawURLPath: /tekton/task/buildah/raw - hubURLPath: tekton/task/buildah - id: 1 - kind: task - latestVersion: - description: Buildah task builds source into a container image and then pushes it to a container registry. - displayName: Buildah - hubRawURLPath: /tekton/task/buildah/latest/raw - id: 1 - minPipelinesVersion: 0.12.1 - platforms: - - id: 1 - name: linux/amd64 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml - updatedAt: 2020-01-01 12:00:00 +0000 UTC - version: "0.1" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml - name: buildah - platforms: - - id: 1 - name: linux/amd64 - rating: 4.3 - tags: - - id: 1 - name: image-build - versions: - - id: 1 - version: "0.1" - - id: 2 - version: "0.2" "400": description: 'invalid-kind: Invalid Resource Kind' content: @@ -299,11 +199,9 @@ paths: schema: type: string description: kind of resource - example: pipeline enum: - task - pipeline - example: pipeline - name: name in: path description: Name of resource @@ -320,45 +218,6 @@ paths: application/json: schema: $ref: '#/components/schemas/Resource' - example: - data: - catalog: - id: 1 - name: tekton - type: community - categories: - - id: 1 - name: image-build - hubRawURLPath: /tekton/task/buildah/raw - hubURLPath: tekton/task/buildah - id: 1 - kind: task - latestVersion: - description: Buildah task builds source into a container image and then pushes it to a container registry. - displayName: Buildah - hubRawURLPath: /tekton/task/buildah/latest/raw - id: 1 - minPipelinesVersion: 0.12.1 - platforms: - - id: 1 - name: linux/amd64 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml - updatedAt: 2020-01-01 12:00:00 +0000 UTC - version: "0.1" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml - name: buildah - platforms: - - id: 1 - name: linux/amd64 - rating: 4.3 - tags: - - id: 1 - name: image-build - versions: - - id: 1 - version: "0.1" - - id: 2 - version: "0.2" "404": description: 'not-found: Resource Not Found Error' content: @@ -395,11 +254,9 @@ paths: schema: type: string description: kind of resource - example: pipeline enum: - task - pipeline - example: pipeline - name: name in: path description: name of resource @@ -425,39 +282,6 @@ paths: application/json: schema: $ref: '#/components/schemas/ResourceVersion' - example: - data: - deprecated: true - description: Buildah task builds source into a container image and then pushes it to a container registry. - displayName: Buildah - hubRawURLPath: /tekton/task/buildah/raw - hubURLPath: tekton/task/buildah - id: 1 - minPipelinesVersion: 0.12.1 - platforms: - - id: 1 - name: linux/s390x - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml - resource: - catalog: - id: 1 - type: community - categories: - - id: 1 - name: Build Tools - id: 1 - kind: task - name: buildah - platforms: - - id: 1 - name: linux/amd64 - rating: 4.3 - tags: - - id: 1 - name: image-build - updatedAt: 2020-01-01 12:00:00 +0000 UTC - version: "0.1" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml "404": description: 'not-found: Resource Not Found Error' content: @@ -494,11 +318,9 @@ paths: schema: type: string description: kind of resource - example: pipeline enum: - task - pipeline - example: pipeline - name: name in: path description: name of resource @@ -561,11 +383,9 @@ paths: schema: type: string description: kind of resource - example: pipeline enum: - task - pipeline - example: task - name: name in: path description: name of resource @@ -591,14 +411,6 @@ paths: application/json: schema: $ref: '#/components/schemas/ResourceVersionReadme' - example: - data: - readme: |- - #Readme - Sample readme content - yaml: |- - #YAML - Sample yaml content "404": description: 'not-found: Resource Not Found Error' content: @@ -635,11 +447,9 @@ paths: schema: type: string description: kind of resource - example: pipeline enum: - task - pipeline - example: task - name: name in: path description: name of resource @@ -665,14 +475,6 @@ paths: application/json: schema: $ref: '#/components/schemas/ResourceVersionYaml' - example: - data: - readme: |- - #Readme - Sample readme content - yaml: |- - #YAML - Sample yaml content "404": description: 'not-found: Resource Not Found Error' content: @@ -709,11 +511,9 @@ paths: schema: type: string description: kind of resource - example: pipeline enum: - task - pipeline - example: task - name: name in: path description: name of resource @@ -767,45 +567,6 @@ paths: application/json: schema: $ref: '#/components/schemas/Resource' - example: - data: - catalog: - id: 1 - name: tekton - type: community - categories: - - id: 1 - name: image-build - hubRawURLPath: /tekton/task/buildah/raw - hubURLPath: tekton/task/buildah - id: 1 - kind: task - latestVersion: - description: Buildah task builds source into a container image and then pushes it to a container registry. - displayName: Buildah - hubRawURLPath: /tekton/task/buildah/latest/raw - id: 1 - minPipelinesVersion: 0.12.1 - platforms: - - id: 1 - name: linux/amd64 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml - updatedAt: 2020-01-01 12:00:00 +0000 UTC - version: "0.1" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml - name: buildah - platforms: - - id: 1 - name: linux/amd64 - rating: 4.3 - tags: - - id: 1 - name: image-build - versions: - - id: 1 - version: "0.1" - - id: 2 - version: "0.2" "404": description: 'not-found: Resource Not Found Error' content: @@ -842,25 +603,6 @@ paths: application/json: schema: $ref: '#/components/schemas/ResourceVersions' - example: - data: - latest: - hubRawURLPath: /resource/tektoncd/task/buildah/raw - id: 2 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.2/buildah.yaml - version: "0.2" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.2/buildah.yaml - versions: - - hubRawURLPath: /resource/tektoncd/task/buildah/0.1/raw - id: 1 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml - version: "0.1" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml - - hubRawURLPath: /resource/tektoncd/task/buildah/0.2/raw - id: 2 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.2/buildah.yaml - version: "0.2" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.2/buildah.yaml "404": description: 'not-found: Resource Not Found Error' content: @@ -897,39 +639,6 @@ paths: application/json: schema: $ref: '#/components/schemas/ResourceVersion' - example: - data: - deprecated: true - description: Buildah task builds source into a container image and then pushes it to a container registry. - displayName: Buildah - hubRawURLPath: /tekton/task/buildah/raw - hubURLPath: tekton/task/buildah - id: 1 - minPipelinesVersion: 0.12.1 - platforms: - - id: 1 - name: linux/s390x - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml - resource: - catalog: - id: 1 - type: community - categories: - - id: 1 - name: Build Tools - id: 1 - kind: task - name: buildah - platforms: - - id: 1 - name: linux/amd64 - rating: 4.3 - tags: - - id: 1 - name: image-build - updatedAt: 2020-01-01 12:00:00 +0000 UTC - version: "0.1" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml "404": description: 'not-found: Resource Not Found Error' content: @@ -967,82 +676,6 @@ paths: application/json: schema: $ref: '#/components/schemas/Resources' - example: - data: - - catalog: - id: 1 - name: tekton - type: community - categories: - - id: 1 - name: image-build - hubRawURLPath: /tekton/task/buildah/raw - hubURLPath: tekton/task/buildah - id: 1 - kind: task - latestVersion: - description: Buildah task builds source into a container image and then pushes it to a container registry. - displayName: Buildah - hubRawURLPath: /tekton/task/buildah/latest/raw - id: 1 - minPipelinesVersion: 0.12.1 - platforms: - - id: 1 - name: linux/amd64 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml - updatedAt: 2020-01-01 12:00:00 +0000 UTC - version: "0.1" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml - name: buildah - platforms: - - id: 1 - name: linux/amd64 - rating: 4.3 - tags: - - id: 1 - name: image-build - versions: - - id: 1 - version: "0.1" - - id: 2 - version: "0.2" - - catalog: - id: 1 - name: tekton - type: community - categories: - - id: 1 - name: image-build - hubRawURLPath: /tekton/task/buildah/raw - hubURLPath: tekton/task/buildah - id: 1 - kind: task - latestVersion: - description: Buildah task builds source into a container image and then pushes it to a container registry. - displayName: Buildah - hubRawURLPath: /tekton/task/buildah/latest/raw - id: 1 - minPipelinesVersion: 0.12.1 - platforms: - - id: 1 - name: linux/amd64 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml - updatedAt: 2020-01-01 12:00:00 +0000 UTC - version: "0.1" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml - name: buildah - platforms: - - id: 1 - name: linux/amd64 - rating: 4.3 - tags: - - id: 1 - name: image-build - versions: - - id: 1 - version: "0.1" - - id: 2 - version: "0.2" "404": description: 'not-found: Resource Not Found Error' content: @@ -1093,12 +726,6 @@ components: type: string description: URL of catalog example: https://github.com/tektoncd/hub - example: - id: 1 - name: Tekton - provider: github - type: community - url: https://github.com/tektoncd/hub required: - id - name @@ -1116,9 +743,6 @@ components: type: string description: Name of category example: Image Builder - example: - id: 1 - name: Image Builder required: - id - name @@ -1128,7 +752,6 @@ components: fault: type: boolean description: Is the error a server-side fault? - example: true id: type: string description: ID is a unique identifier for this particular occurrence of the problem. @@ -1144,19 +767,10 @@ components: temporary: type: boolean description: Is the error temporary? - example: true timeout: type: boolean description: Is the error a timeout? - example: true description: Internal Server Error - example: - fault: true - id: 123abc - message: parameter 'p' must be an integer - name: bad_request - temporary: true - timeout: false required: - name - id @@ -1171,78 +785,11 @@ components: type: array items: $ref: '#/components/schemas/Catalog' - example: - - id: 1 - name: Tekton - provider: github - type: community - url: https://github.com/tektoncd/hub - - id: 1 - name: Tekton - provider: github - type: community - url: https://github.com/tektoncd/hub - example: - data: - - id: 1 - name: Tekton - provider: github - type: community - url: https://github.com/tektoncd/hub - - id: 1 - name: Tekton - provider: github - type: community - url: https://github.com/tektoncd/hub - - id: 1 - name: Tekton - provider: github - type: community - url: https://github.com/tektoncd/hub Resource: type: object properties: data: $ref: '#/components/schemas/ResourceData' - example: - data: - catalog: - id: 1 - name: tekton - type: community - categories: - - id: 1 - name: image-build - hubRawURLPath: /tekton/task/buildah/raw - hubURLPath: tekton/task/buildah - id: 1 - kind: task - latestVersion: - description: Buildah task builds source into a container image and then pushes it to a container registry. - displayName: Buildah - hubRawURLPath: /tekton/task/buildah/latest/raw - id: 1 - minPipelinesVersion: 0.12.1 - platforms: - - id: 1 - name: linux/amd64 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml - updatedAt: 2020-01-01 12:00:00 +0000 UTC - version: "0.1" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml - name: buildah - platforms: - - id: 1 - name: linux/amd64 - rating: 4.3 - tags: - - id: 1 - name: image-build - versions: - - id: 1 - version: "0.1" - - id: 2 - version: "0.2" required: - data ResourceContent: @@ -1260,13 +807,6 @@ components: example: |- #YAML Sample yaml content - example: - readme: |- - #Readme - Sample readme content - yaml: |- - #YAML - Sample yaml content ResourceData: type: object properties: @@ -1334,44 +874,6 @@ components: - id: 2 version: "0.2" description: The resource type describes resource information. - example: - catalog: - id: 1 - name: tekton - type: community - categories: - - id: 1 - name: image-build - hubRawURLPath: /tekton/task/buildah/raw - hubURLPath: tekton/task/buildah - id: 1 - kind: task - latestVersion: - description: Buildah task builds source into a container image and then pushes it to a container registry. - displayName: Buildah - hubRawURLPath: /tekton/task/buildah/latest/raw - id: 1 - minPipelinesVersion: 0.12.1 - platforms: - - id: 1 - name: linux/amd64 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml - updatedAt: 2020-01-01 12:00:00 +0000 UTC - version: "0.1" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml - name: buildah - platforms: - - id: 1 - name: linux/amd64 - rating: 4.3 - tags: - - id: 1 - name: image-build - versions: - - id: 1 - version: "0.1" - - id: 2 - version: "0.2" required: - id - name @@ -1389,193 +891,11 @@ components: type: array items: $ref: '#/components/schemas/ResourceData' - example: - - catalog: - id: 1 - name: tekton - type: community - categories: - - id: 1 - name: image-build - hubRawURLPath: /tekton/task/buildah/raw - hubURLPath: tekton/task/buildah - id: 1 - kind: task - latestVersion: - description: Buildah task builds source into a container image and then pushes it to a container registry. - displayName: Buildah - hubRawURLPath: /tekton/task/buildah/latest/raw - id: 1 - minPipelinesVersion: 0.12.1 - platforms: - - id: 1 - name: linux/amd64 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml - updatedAt: 2020-01-01 12:00:00 +0000 UTC - version: "0.1" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml - name: buildah - platforms: - - id: 1 - name: linux/amd64 - rating: 4.3 - tags: - - id: 1 - name: image-build - versions: - - id: 1 - version: "0.1" - - id: 2 - version: "0.2" - - catalog: - id: 1 - name: tekton - type: community - categories: - - id: 1 - name: image-build - hubRawURLPath: /tekton/task/buildah/raw - hubURLPath: tekton/task/buildah - id: 1 - kind: task - latestVersion: - description: Buildah task builds source into a container image and then pushes it to a container registry. - displayName: Buildah - hubRawURLPath: /tekton/task/buildah/latest/raw - id: 1 - minPipelinesVersion: 0.12.1 - platforms: - - id: 1 - name: linux/amd64 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml - updatedAt: 2020-01-01 12:00:00 +0000 UTC - version: "0.1" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml - name: buildah - platforms: - - id: 1 - name: linux/amd64 - rating: 4.3 - tags: - - id: 1 - name: image-build - versions: - - id: 1 - version: "0.1" - - id: 2 - version: "0.2" - - catalog: - id: 1 - name: tekton - type: community - categories: - - id: 1 - name: image-build - hubRawURLPath: /tekton/task/buildah/raw - hubURLPath: tekton/task/buildah - id: 1 - kind: task - latestVersion: - description: Buildah task builds source into a container image and then pushes it to a container registry. - displayName: Buildah - hubRawURLPath: /tekton/task/buildah/latest/raw - id: 1 - minPipelinesVersion: 0.12.1 - platforms: - - id: 1 - name: linux/amd64 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml - updatedAt: 2020-01-01 12:00:00 +0000 UTC - version: "0.1" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml - name: buildah - platforms: - - id: 1 - name: linux/amd64 - rating: 4.3 - tags: - - id: 1 - name: image-build - versions: - - id: 1 - version: "0.1" - - id: 2 - version: "0.2" - - catalog: - id: 1 - name: tekton - type: community - categories: - - id: 1 - name: image-build - hubRawURLPath: /tekton/task/buildah/raw - hubURLPath: tekton/task/buildah - id: 1 - kind: task - latestVersion: - description: Buildah task builds source into a container image and then pushes it to a container registry. - displayName: Buildah - hubRawURLPath: /tekton/task/buildah/latest/raw - id: 1 - minPipelinesVersion: 0.12.1 - platforms: - - id: 1 - name: linux/amd64 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml - updatedAt: 2020-01-01 12:00:00 +0000 UTC - version: "0.1" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml - name: buildah - platforms: - - id: 1 - name: linux/amd64 - rating: 4.3 - tags: - - id: 1 - name: image-build - versions: - - id: 1 - version: "0.1" - - id: 2 - version: "0.2" ResourceVersion: type: object properties: data: $ref: '#/components/schemas/ResourceVersionData' - example: - data: - deprecated: true - description: Buildah task builds source into a container image and then pushes it to a container registry. - displayName: Buildah - hubRawURLPath: /tekton/task/buildah/raw - hubURLPath: tekton/task/buildah - id: 1 - minPipelinesVersion: 0.12.1 - platforms: - - id: 1 - name: linux/s390x - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml - resource: - catalog: - id: 1 - type: community - categories: - - id: 1 - name: Build Tools - id: 1 - kind: task - name: buildah - platforms: - - id: 1 - name: linux/amd64 - rating: 4.3 - tags: - - id: 1 - name: image-build - updatedAt: 2020-01-01 12:00:00 +0000 UTC - version: "0.1" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml required: - data ResourceVersionData: @@ -1639,38 +959,6 @@ components: example: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml format: uri description: The Version result type describes resource's version information. - example: - deprecated: true - description: Buildah task builds source into a container image and then pushes it to a container registry. - displayName: Buildah - hubRawURLPath: /tekton/task/buildah/raw - hubURLPath: tekton/task/buildah - id: 1 - minPipelinesVersion: 0.12.1 - platforms: - - id: 1 - name: linux/s390x - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml - resource: - catalog: - id: 1 - type: community - categories: - - id: 1 - name: Build Tools - id: 1 - kind: task - name: buildah - platforms: - - id: 1 - name: linux/amd64 - rating: 4.3 - tags: - - id: 1 - name: image-build - updatedAt: 2020-01-01 12:00:00 +0000 UTC - version: "0.1" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml required: - id - version @@ -1689,14 +977,6 @@ components: properties: data: $ref: '#/components/schemas/ResourceContent' - example: - data: - readme: |- - #Readme - Sample readme content - yaml: |- - #YAML - Sample yaml content required: - data ResourceVersionYaml: @@ -1704,14 +984,6 @@ components: properties: data: $ref: '#/components/schemas/ResourceContent' - example: - data: - readme: |- - #Readme - Sample readme content - yaml: |- - #YAML - Sample yaml content required: - data ResourceVersions: @@ -1719,25 +991,6 @@ components: properties: data: $ref: '#/components/schemas/Versions' - example: - data: - latest: - hubRawURLPath: /resource/tektoncd/task/buildah/raw - id: 2 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.2/buildah.yaml - version: "0.2" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.2/buildah.yaml - versions: - - hubRawURLPath: /resource/tektoncd/task/buildah/0.1/raw - id: 1 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml - version: "0.1" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml - - hubRawURLPath: /resource/tektoncd/task/buildah/0.2/raw - id: 2 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.2/buildah.yaml - version: "0.2" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.2/buildah.yaml required: - data Resources: @@ -1745,82 +998,6 @@ components: properties: data: $ref: '#/components/schemas/ResourceDataCollection' - example: - data: - - catalog: - id: 1 - name: tekton - type: community - categories: - - id: 1 - name: image-build - hubRawURLPath: /tekton/task/buildah/raw - hubURLPath: tekton/task/buildah - id: 1 - kind: task - latestVersion: - description: Buildah task builds source into a container image and then pushes it to a container registry. - displayName: Buildah - hubRawURLPath: /tekton/task/buildah/latest/raw - id: 1 - minPipelinesVersion: 0.12.1 - platforms: - - id: 1 - name: linux/amd64 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml - updatedAt: 2020-01-01 12:00:00 +0000 UTC - version: "0.1" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml - name: buildah - platforms: - - id: 1 - name: linux/amd64 - rating: 4.3 - tags: - - id: 1 - name: image-build - versions: - - id: 1 - version: "0.1" - - id: 2 - version: "0.2" - - catalog: - id: 1 - name: tekton - type: community - categories: - - id: 1 - name: image-build - hubRawURLPath: /tekton/task/buildah/raw - hubURLPath: tekton/task/buildah - id: 1 - kind: task - latestVersion: - description: Buildah task builds source into a container image and then pushes it to a container registry. - displayName: Buildah - hubRawURLPath: /tekton/task/buildah/latest/raw - id: 1 - minPipelinesVersion: 0.12.1 - platforms: - - id: 1 - name: linux/amd64 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml - updatedAt: 2020-01-01 12:00:00 +0000 UTC - version: "0.1" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml - name: buildah - platforms: - - id: 1 - name: linux/amd64 - rating: 4.3 - tags: - - id: 1 - name: image-build - versions: - - id: 1 - version: "0.1" - - id: 2 - version: "0.2" required: - data Versions: @@ -1845,24 +1022,6 @@ components: version: "0.2" webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.2/buildah.yaml description: The Versions type describes response for versions by resource id API. - example: - latest: - hubRawURLPath: /resource/tektoncd/task/buildah/raw - id: 2 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.2/buildah.yaml - version: "0.2" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.2/buildah.yaml - versions: - - hubRawURLPath: /resource/tektoncd/task/buildah/0.1/raw - id: 1 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.1/buildah.yaml - version: "0.1" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.1/buildah.yaml - - hubRawURLPath: /resource/tektoncd/task/buildah/0.2/raw - id: 2 - rawURL: https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.2/buildah.yaml - version: "0.2" - webURL: https://github.com/tektoncd/catalog/blob/main/task/buildah/0.2/buildah.yaml required: - latest - versions diff --git a/api/v1/gen/http/resource/client/cli.go b/api/v1/gen/http/resource/client/cli.go index fac9bf41d8..3db71dc686 100644 --- a/api/v1/gen/http/resource/client/cli.go +++ b/api/v1/gen/http/resource/client/cli.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // resource HTTP client CLI support package // diff --git a/api/v1/gen/http/resource/client/client.go b/api/v1/gen/http/resource/client/client.go index 2bd6b92c18..d52da98bb9 100644 --- a/api/v1/gen/http/resource/client/client.go +++ b/api/v1/gen/http/resource/client/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // resource client HTTP transport // diff --git a/api/v1/gen/http/resource/client/encode_decode.go b/api/v1/gen/http/resource/client/encode_decode.go index 0b3edfdc5f..6f521a1a82 100644 --- a/api/v1/gen/http/resource/client/encode_decode.go +++ b/api/v1/gen/http/resource/client/encode_decode.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // resource HTTP client encoders and decoders // diff --git a/api/v1/gen/http/resource/client/paths.go b/api/v1/gen/http/resource/client/paths.go index 93667ee6cf..0f5199625f 100644 --- a/api/v1/gen/http/resource/client/paths.go +++ b/api/v1/gen/http/resource/client/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // HTTP request path constructors for the resource service. // diff --git a/api/v1/gen/http/resource/client/types.go b/api/v1/gen/http/resource/client/types.go index 2b47ceb537..647412fba4 100644 --- a/api/v1/gen/http/resource/client/types.go +++ b/api/v1/gen/http/resource/client/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // resource HTTP client types // diff --git a/api/v1/gen/http/resource/server/encode_decode.go b/api/v1/gen/http/resource/server/encode_decode.go index b1aad77973..4768e18543 100644 --- a/api/v1/gen/http/resource/server/encode_decode.go +++ b/api/v1/gen/http/resource/server/encode_decode.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // resource HTTP server encoders and decoders // diff --git a/api/v1/gen/http/resource/server/paths.go b/api/v1/gen/http/resource/server/paths.go index e2b8d75b42..822df83482 100644 --- a/api/v1/gen/http/resource/server/paths.go +++ b/api/v1/gen/http/resource/server/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // HTTP request path constructors for the resource service. // diff --git a/api/v1/gen/http/resource/server/server.go b/api/v1/gen/http/resource/server/server.go index 774bfba40b..42582700e8 100644 --- a/api/v1/gen/http/resource/server/server.go +++ b/api/v1/gen/http/resource/server/server.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // resource HTTP server // diff --git a/api/v1/gen/http/resource/server/types.go b/api/v1/gen/http/resource/server/types.go index 50a2d1d471..d20e078803 100644 --- a/api/v1/gen/http/resource/server/types.go +++ b/api/v1/gen/http/resource/server/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // resource HTTP server types // diff --git a/api/v1/gen/http/swagger/client/client.go b/api/v1/gen/http/swagger/client/client.go index d31f84987b..81cbaabd50 100644 --- a/api/v1/gen/http/swagger/client/client.go +++ b/api/v1/gen/http/swagger/client/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // swagger client HTTP transport // diff --git a/api/v1/gen/http/swagger/client/encode_decode.go b/api/v1/gen/http/swagger/client/encode_decode.go index 30041e125c..8c98de4194 100644 --- a/api/v1/gen/http/swagger/client/encode_decode.go +++ b/api/v1/gen/http/swagger/client/encode_decode.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // swagger HTTP client encoders and decoders // diff --git a/api/v1/gen/http/swagger/client/paths.go b/api/v1/gen/http/swagger/client/paths.go index 3aa4cd7e2e..2b07d194ec 100644 --- a/api/v1/gen/http/swagger/client/paths.go +++ b/api/v1/gen/http/swagger/client/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // HTTP request path constructors for the swagger service. // diff --git a/api/v1/gen/http/swagger/client/types.go b/api/v1/gen/http/swagger/client/types.go index 9336c44e9b..570dd84b0f 100644 --- a/api/v1/gen/http/swagger/client/types.go +++ b/api/v1/gen/http/swagger/client/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // swagger HTTP client types // diff --git a/api/v1/gen/http/swagger/server/paths.go b/api/v1/gen/http/swagger/server/paths.go index c9501cd1bf..4db0811970 100644 --- a/api/v1/gen/http/swagger/server/paths.go +++ b/api/v1/gen/http/swagger/server/paths.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // HTTP request path constructors for the swagger service. // diff --git a/api/v1/gen/http/swagger/server/server.go b/api/v1/gen/http/swagger/server/server.go index 3935e1d01d..52b8badd24 100644 --- a/api/v1/gen/http/swagger/server/server.go +++ b/api/v1/gen/http/swagger/server/server.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // swagger HTTP server // diff --git a/api/v1/gen/http/swagger/server/types.go b/api/v1/gen/http/swagger/server/types.go index cfa169b894..4d42fb0a46 100644 --- a/api/v1/gen/http/swagger/server/types.go +++ b/api/v1/gen/http/swagger/server/types.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // swagger HTTP server types // diff --git a/api/v1/gen/log/logger.go b/api/v1/gen/log/logger.go index c84e7f063a..37f97de179 100644 --- a/api/v1/gen/log/logger.go +++ b/api/v1/gen/log/logger.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // Zap logger implementation // diff --git a/api/v1/gen/resource/client.go b/api/v1/gen/resource/client.go index 70c686cfac..603d10c5ad 100644 --- a/api/v1/gen/resource/client.go +++ b/api/v1/gen/resource/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // resource client // diff --git a/api/v1/gen/resource/endpoints.go b/api/v1/gen/resource/endpoints.go index ef59abb730..5d064697c7 100644 --- a/api/v1/gen/resource/endpoints.go +++ b/api/v1/gen/resource/endpoints.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // resource endpoints // diff --git a/api/v1/gen/resource/service.go b/api/v1/gen/resource/service.go index c6f180c1b6..0662aa1b1d 100644 --- a/api/v1/gen/resource/service.go +++ b/api/v1/gen/resource/service.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // resource service // diff --git a/api/v1/gen/resource/views/view.go b/api/v1/gen/resource/views/view.go index a4686f2cc2..6f40e0c5fa 100644 --- a/api/v1/gen/resource/views/view.go +++ b/api/v1/gen/resource/views/view.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // resource views // diff --git a/api/v1/gen/swagger/client.go b/api/v1/gen/swagger/client.go index 67efbe58c5..e7ccb612c5 100644 --- a/api/v1/gen/swagger/client.go +++ b/api/v1/gen/swagger/client.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // swagger client // diff --git a/api/v1/gen/swagger/endpoints.go b/api/v1/gen/swagger/endpoints.go index 819c5d1a52..9efb3d55b8 100644 --- a/api/v1/gen/swagger/endpoints.go +++ b/api/v1/gen/swagger/endpoints.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // swagger endpoints // diff --git a/api/v1/gen/swagger/service.go b/api/v1/gen/swagger/service.go index c82b09ba4a..6a0668a4b8 100644 --- a/api/v1/gen/swagger/service.go +++ b/api/v1/gen/swagger/service.go @@ -1,4 +1,4 @@ -// Code generated by goa v3.12.4, DO NOT EDIT. +// Code generated by goa v3.13.0, DO NOT EDIT. // // swagger service // diff --git a/go.mod b/go.mod index 47454448e0..6e44fd943e 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( github.com/tektoncd/plumbing v0.0.0-20220817140952-3da8ce01aeeb go.uber.org/automaxprocs v1.5.3 go.uber.org/zap v1.25.0 - goa.design/goa/v3 v3.12.4 + goa.design/goa/v3 v3.13.0 goa.design/plugins/v3 v3.12.4 golang.org/x/term v0.13.0 golang.org/x/text v0.13.0 @@ -57,7 +57,6 @@ require ( github.com/creack/pty v1.1.17 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 // indirect - github.com/dimfeld/httptreemux/v5 v5.5.0 // indirect github.com/docker/cli v24.0.0+incompatible // indirect github.com/docker/distribution v2.8.2+incompatible // indirect github.com/docker/docker v24.0.0+incompatible // indirect @@ -67,6 +66,7 @@ require ( github.com/evanphx/json-patch/v5 v5.6.0 // indirect github.com/felixge/httpsnoop v1.0.3 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/go-chi/chi/v5 v5.0.10 // indirect github.com/go-faster/city v1.0.1 // indirect github.com/go-faster/errors v0.6.1 // indirect github.com/go-kit/log v0.2.1 // indirect @@ -74,7 +74,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-openapi/jsonpointer v0.19.6 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect - github.com/go-openapi/swag v0.22.3 // indirect + github.com/go-openapi/swag v0.22.4 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.3 // indirect diff --git a/go.sum b/go.sum index a36eeb15eb..2d09a51744 100644 --- a/go.sum +++ b/go.sum @@ -343,8 +343,6 @@ github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8 github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U= github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 h1:MGKhKyiYrvMDZsmLR/+RGffQSXwEkXgfLSA08qDn9AI= github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598/go.mod h1:0FpDmbrt36utu8jEmeU05dPC9AB5tsLYVVi+ZHfyuwI= -github.com/dimfeld/httptreemux/v5 v5.5.0 h1:p8jkiMrCuZ0CmhwYLcbNbl7DDo21fozhKHQ2PccwOFQ= -github.com/dimfeld/httptreemux/v5 v5.5.0/go.mod h1:QeEylH57C0v3VO0tkKraVz9oD3Uu93CKPnTLbsidvSw= github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= github.com/docker/cli v20.10.7+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/cli v24.0.0+incompatible h1:0+1VshNwBQzQAx9lOl+OYCTCEAD8fKs/qeXMx3O0wqM= @@ -419,10 +417,12 @@ github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYis github.com/gdamore/encoding v0.0.0-20151215212835-b23993cbb635/go.mod h1:yrQYJKKDTrHmbYxI7CYi+/hbdiDT2m4Hj+t0ikCjsrQ= github.com/gdamore/tcell v1.0.1-0.20180608172421-b3cebc399d6f/go.mod h1:tqyG50u7+Ctv1w5VX67kLzKcj9YXR/JSBZQq/+mLl1A= github.com/getkin/kin-openapi v0.76.0/go.mod h1:660oXbgy5JFMKreazJaQTw7o+X00qeSyhcnluiMv+Xg= -github.com/getkin/kin-openapi v0.118.0 h1:z43njxPmJ7TaPpMSCQb7PN0dEYno4tyBPQcrFdHoLuM= +github.com/getkin/kin-openapi v0.119.0 h1:FIn6hYX3huTFV28GS1hotceX8MAsGGf/c+jFta5XRaE= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= +github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk= +github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-co-op/gocron v1.33.1 h1:wjX+Dg6Ae29a/f9BSQjY1Rl+jflTpW9aDyMqseCj78c= github.com/go-co-op/gocron v1.33.1/go.mod h1:NLi+bkm4rRSy1F8U7iacZOz0xPseMoIOnvabGoSe/no= github.com/go-faster/city v1.0.1 h1:4WAxSZ3V2Ws4QRDrscLEDcibJY8uf41H6AhXDrNDcGw= @@ -470,8 +470,9 @@ github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8 github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= -github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU= +github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= @@ -704,7 +705,7 @@ github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/invopop/yaml v0.1.0 h1:YW3WGUoJEXYfzWBjn00zIlrw7brGVD0fUKRYDPAPhrc= +github.com/invopop/yaml v0.2.0 h1:7zky/qH+O0DwAyoobXUqvVBwgBFRxKoQ/3FjcVpjTMY= github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA= github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8= github.com/jackc/pgconn v1.14.0 h1:vrbA9Ud87g6JdFWkHTJXppVce58qPIdP7N8y0Ml/A7Q= @@ -1237,8 +1238,8 @@ go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= go.uber.org/zap v1.25.0 h1:4Hvk6GtkucQ790dqmj7l1eEnRdKm3k3ZUrUMS2d5+5c= go.uber.org/zap v1.25.0/go.mod h1:JIAUzQIH94IC4fOJQm7gMmBJP5k7wQfdcnYdPoEXJYk= -goa.design/goa/v3 v3.12.4 h1:g3G8yHLk+jyUDNRL2sNg+ZcoQ62zY83rpgagAQ5VmTA= -goa.design/goa/v3 v3.12.4/go.mod h1:h1vjyGQ+rqWK+VvnqN8oLcpqaHrKIyuY1Vx+jhKodpg= +goa.design/goa/v3 v3.13.0 h1:6oNRisXAlzZbajDVhgVCEAojN/UPvp0PiUAr8z09BuU= +goa.design/goa/v3 v3.13.0/go.mod h1:dZd1Xib+mDb49UIwlRY1xOvSXPeCbA0z5K/303LHvBk= goa.design/plugins/v3 v3.12.4 h1:hc3CBS8DLT2uWes2qo997t1xPYl9icADhA1ZJcSh6xY= goa.design/plugins/v3 v3.12.4/go.mod h1:8JJ02wnoYGFJGdfXMbwSURitX7n0Rr4QYCm/DI5ZxrA= golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= diff --git a/vendor/github.com/dimfeld/httptreemux/v5/.gitignore b/vendor/github.com/dimfeld/httptreemux/v5/.gitignore deleted file mode 100644 index ba39ef7eb0..0000000000 --- a/vendor/github.com/dimfeld/httptreemux/v5/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe -*.test - -.idea/ diff --git a/vendor/github.com/dimfeld/httptreemux/v5/.travis.yml b/vendor/github.com/dimfeld/httptreemux/v5/.travis.yml deleted file mode 100644 index 9267a02e76..0000000000 --- a/vendor/github.com/dimfeld/httptreemux/v5/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -language: go - -gobuild_args: "-v -race" -go: - - 1.5 - - 1.6 - - 1.7 - - 1.8 - - 1.9 - - tip - -matrix: - allow_failures: - - go: tip diff --git a/vendor/github.com/dimfeld/httptreemux/v5/LICENSE b/vendor/github.com/dimfeld/httptreemux/v5/LICENSE deleted file mode 100644 index 32c75c9b1e..0000000000 --- a/vendor/github.com/dimfeld/httptreemux/v5/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014,2015 Daniel Imfeld - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/dimfeld/httptreemux/v5/README.md b/vendor/github.com/dimfeld/httptreemux/v5/README.md deleted file mode 100644 index 4dde584d3a..0000000000 --- a/vendor/github.com/dimfeld/httptreemux/v5/README.md +++ /dev/null @@ -1,272 +0,0 @@ -httptreemux [![Build Status](https://travis-ci.org/dimfeld/httptreemux.png?branch=master)](https://travis-ci.org/dimfeld/httptreemux) [![GoDoc](https://godoc.org/github.com/dimfeld/httptreemux?status.svg)](https://godoc.org/github.com/dimfeld/httptreemux) -=========== - -High-speed, flexible, tree-based HTTP router for Go. - -This is inspired by [Julien Schmidt's httprouter](https://www.github.com/julienschmidt/httprouter), in that it uses a patricia tree, but the implementation is rather different. Specifically, the routing rules are relaxed so that a single path segment may be a wildcard in one route and a static token in another. This gives a nice combination of high performance with a lot of convenience in designing the routing patterns. In [benchmarks](https://github.com/julienschmidt/go-http-routing-benchmark), httptreemux is close to, but slightly slower than, httprouter. - -Release notes may be found using the [Github releases tab](https://github.com/dimfeld/httptreemux/releases). Version numbers are compatible with the [Semantic Versioning 2.0.0](http://semver.org/) convention, and a new release is made after every change to the code. - -## Installing with Go Modules - -When using Go Modules, import this repository with `import "github.com/dimfeld/httptreemux/v5"` to ensure that you get the right version. - -## Why? -There are a lot of good routers out there. But looking at the ones that were really lightweight, I couldn't quite get something that fit with the route patterns I wanted. The code itself is simple enough, so I spent an evening writing this. - -## Handler -The handler is a simple function with the prototype `func(w http.ResponseWriter, r *http.Request, params map[string]string)`. The params argument contains the parameters parsed from wildcards and catch-alls in the URL, as described below. This type is aliased as httptreemux.HandlerFunc. - -### Using http.HandlerFunc -Due to the inclusion of the [context](https://godoc.org/context) package as of Go 1.7, `httptreemux` now supports handlers of type [http.HandlerFunc](https://godoc.org/net/http#HandlerFunc). There are two ways to enable this support. - -#### Adapting an Existing Router - -The `UsingContext` method will wrap the router or group in a new group at the same path, but adapted for use with `context` and `http.HandlerFunc`. - -```go -router := httptreemux.New() - -group := router.NewGroup("/api") -group.GET("/v1/:id", func(w http.ResponseWriter, r *http.Request, params map[string]string) { - id := params["id"] - fmt.Fprintf(w, "GET /api/v1/%s", id) -}) - -// UsingContext returns a version of the router or group with context support. -ctxGroup := group.UsingContext() // sibling to 'group' node in tree -ctxGroup.GET("/v2/:id", func(w http.ResponseWriter, r *http.Request) { - ctxData := httptreemux.ContextData(r.Context()) - params := ctxData.Params() - id := params["id"] - - // Useful for middleware to see which route was hit without dealing with wildcards - routePath := ctxData.Route() - - // Prints GET /api/v2/:id id=... - fmt.Fprintf(w, "GET %s id=%s", routePath, id) -}) - -http.ListenAndServe(":8080", router) -``` - -#### New Router with Context Support - -The `NewContextMux` function returns a router preconfigured for use with `context` and `http.HandlerFunc`. - -```go -router := httptreemux.NewContextMux() - -router.GET("/:page", func(w http.ResponseWriter, r *http.Request) { - params := httptreemux.ContextParams(r.Context()) - fmt.Fprintf(w, "GET /%s", params["page"]) -}) - -group := router.NewGroup("/api") -group.GET("/v1/:id", func(w http.ResponseWriter, r *http.Request) { - ctxData := httptreemux.ContextData(r.Context()) - params := ctxData.Params() - id := params["id"] - - // Useful for middleware to see which route was hit without dealing with wildcards - routePath := ctxData.Route() - - // Prints GET /api/v1/:id id=... - fmt.Fprintf(w, "GET %s id=%s", routePath, id) -}) - -http.ListenAndServe(":8080", router) -``` - - - -## Routing Rules -The syntax here is also modeled after httprouter. Each variable in a path may match on one segment only, except for an optional catch-all variable at the end of the URL. - -Some examples of valid URL patterns are: -* `/post/all` -* `/post/:postid` -* `/post/:postid/page/:page` -* `/post/:postid/:page` -* `/images/*path` -* `/favicon.ico` -* `/:year/:month/` -* `/:year/:month/:post` -* `/:page` - -Note that all of the above URL patterns may exist concurrently in the router. - -Path elements starting with `:` indicate a wildcard in the path. A wildcard will only match on a single path segment. That is, the pattern `/post/:postid` will match on `/post/1` or `/post/1/`, but not `/post/1/2`. - -A path element starting with `*` is a catch-all, whose value will be a string containing all text in the URL matched by the wildcards. For example, with a pattern of `/images/*path` and a requested URL `images/abc/def`, path would contain `abc/def`. A catch-all path will not match an empty string, so in this example a separate route would need to be installed if you also want to match `/images/`. - -#### Using : and * in routing patterns - -The characters `:` and `*` can be used at the beginning of a path segment by escaping them with a backslash. A double backslash at the beginning of a segment is interpreted as a single backslash. These escapes are only checked at the very beginning of a path segment; they are not necessary or processed elsewhere in a token. - -```go -router.GET("/foo/\\*starToken", handler) // matches /foo/*starToken -router.GET("/foo/star*inTheMiddle", handler) // matches /foo/star*inTheMiddle -router.GET("/foo/starBackslash\\*", handler) // matches /foo/starBackslash\* -router.GET("/foo/\\\\*backslashWithStar") // matches /foo/\*backslashWithStar -``` - -### Routing Groups -Lets you create a new group of routes with a given path prefix. Makes it easier to create clusters of paths like: -* `/api/v1/foo` -* `/api/v1/bar` - -To use this you do: -```go -router = httptreemux.New() -api := router.NewGroup("/api/v1") -api.GET("/foo", fooHandler) // becomes /api/v1/foo -api.GET("/bar", barHandler) // becomes /api/v1/bar -``` - -### Routing Priority -The priority rules in the router are simple. - -1. Static path segments take the highest priority. If a segment and its subtree are able to match the URL, that match is returned. -2. Wildcards take second priority. For a particular wildcard to match, that wildcard and its subtree must match the URL. -3. Finally, a catch-all rule will match when the earlier path segments have matched, and none of the static or wildcard conditions have matched. Catch-all rules must be at the end of a pattern. - -So with the following patterns adapted from [simpleblog](https://www.github.com/dimfeld/simpleblog), we'll see certain matches: -```go -router = httptreemux.New() -router.GET("/:page", pageHandler) -router.GET("/:year/:month/:post", postHandler) -router.GET("/:year/:month", archiveHandler) -router.GET("/images/*path", staticHandler) -router.GET("/favicon.ico", staticHandler) -``` - -#### Example scenarios - -- `/abc` will match `/:page` -- `/2014/05` will match `/:year/:month` -- `/2014/05/really-great-blog-post` will match `/:year/:month/:post` -- `/images/CoolImage.gif` will match `/images/*path` -- `/images/2014/05/MayImage.jpg` will also match `/images/*path`, with all the text after `/images` stored in the variable path. -- `/favicon.ico` will match `/favicon.ico` - -### Special Method Behavior -If TreeMux.HeadCanUseGet is set to true, the router will call the GET handler for a pattern when a HEAD request is processed, if no HEAD handler has been added for that pattern. This behavior is enabled by default. - -Go's http.ServeContent and related functions already handle the HEAD method correctly by sending only the header, so in most cases your handlers will not need any special cases for it. - -By default TreeMux.OptionsHandler is a null handler that doesn't affect your routing. If you set the handler, it will be called on OPTIONS requests to a path already registered by another method. If you set a path specific handler by using `router.OPTIONS`, it will override the global Options Handler for that path. - -### Trailing Slashes -The router has special handling for paths with trailing slashes. If a pattern is added to the router with a trailing slash, any matches on that pattern without a trailing slash will be redirected to the version with the slash. If a pattern does not have a trailing slash, matches on that pattern with a trailing slash will be redirected to the version without. - -The trailing slash flag is only stored once for a pattern. That is, if a pattern is added for a method with a trailing slash, all other methods for that pattern will also be considered to have a trailing slash, regardless of whether or not it is specified for those methods too. -However this behavior can be turned off by setting TreeMux.RedirectTrailingSlash to false. By default it is set to true. - -One exception to this rule is catch-all patterns. By default, trailing slash redirection is disabled on catch-all patterns, since the structure of the entire URL and the desired patterns can not be predicted. If trailing slash removal is desired on catch-all patterns, set TreeMux.RemoveCatchAllTrailingSlash to true. - -```go -router = httptreemux.New() -router.GET("/about", pageHandler) -router.GET("/posts/", postIndexHandler) -router.POST("/posts", postFormHandler) - -GET /about will match normally. -GET /about/ will redirect to /about. -GET /posts will redirect to /posts/. -GET /posts/ will match normally. -POST /posts will redirect to /posts/, because the GET method used a trailing slash. -``` - -### Custom Redirects - -RedirectBehavior sets the behavior when the router redirects the request to the canonical version of the requested URL using RedirectTrailingSlash or RedirectClean. The default behavior is to return a 301 status, redirecting the browser to the version of the URL that matches the given pattern. - -These are the values accepted for RedirectBehavior. You may also add these values to the RedirectMethodBehavior map to define custom per-method redirect behavior. - -* Redirect301 - HTTP 301 Moved Permanently; this is the default. -* Redirect307 - HTTP/1.1 Temporary Redirect -* Redirect308 - RFC7538 Permanent Redirect -* UseHandler - Don't redirect to the canonical path. Just call the handler instead. - -### Case Insensitive Routing - -You can optionally allow case-insensitive routing by setting the _CaseInsensitive_ property on the router to true. -This allows you to make all routes case-insensitive. For example: -```go -router := httptreemux.New() -router.CaseInsensitive -router.GET("/My-RoUtE", pageHandler) -``` -In this example, performing a GET request to /my-route will match the route and execute the _pageHandler_ functionality. -It's important to note that when using case-insensitive routing, the CaseInsensitive property must be set before routes are defined or there may be unexpected side effects. - -#### Rationale/Usage -On a POST request, most browsers that receive a 301 will submit a GET request to the redirected URL, meaning that any data will likely be lost. If you want to handle and avoid this behavior, you may use Redirect307, which causes most browsers to resubmit the request using the original method and request body. - -Since 307 is supposed to be a temporary redirect, the new 308 status code has been proposed, which is treated the same, except it indicates correctly that the redirection is permanent. The big caveat here is that the RFC is relatively recent, and older or non-compliant browsers will not handle it. Therefore its use is not recommended unless you really know what you're doing. - -Finally, the UseHandler value will simply call the handler function for the pattern, without redirecting to the canonical version of the URL. - -### RequestURI vs. URL.Path - -#### Escaped Slashes -Go automatically processes escaped characters in a URL, converting + to a space and %XX to the corresponding character. This can present issues when the URL contains a %2f, which is unescaped to '/'. This isn't an issue for most applications, but it will prevent the router from correctly matching paths and wildcards. - -For example, the pattern `/post/:post` would not match on `/post/abc%2fdef`, which is unescaped to `/post/abc/def`. The desired behavior is that it matches, and the `post` wildcard is set to `abc/def`. - -Therefore, this router defaults to using the raw URL, stored in the Request.RequestURI variable. Matching wildcards and catch-alls are then unescaped, to give the desired behavior. - -TL;DR: If a requested URL contains a %2f, this router will still do the right thing. Some Go HTTP routers may not due to [Go issue 3659](https://code.google.com/p/go/issues/detail?id=3659). - -#### Escaped Characters - -As mentioned above, characters in the URL are not unescaped when using RequestURI to determine the matched route. If this is a problem for you and you are unable to switch to URL.Path for the above reasons, you may set `router.EscapeAddedRoutes` to `true`. This option will run each added route through the `URL.EscapedPath` function, and add an additional route if the escaped version differs. - -#### http Package Utility Functions - -Although using RequestURI avoids the issue described above, certain utility functions such as `http.StripPrefix` modify URL.Path, and expect that the underlying router is using that field to make its decision. If you are using some of these functions, set the router's `PathSource` member to `URLPath`. This will give up the proper handling of escaped slashes described above, while allowing the router to work properly with these utility functions. - -## Concurrency - -The router contains an `RWMutex` that arbitrates access to the tree. This allows routes to be safely added from multiple goroutines at once. - -No concurrency controls are needed when only reading from the tree, so the default behavior is to not use the `RWMutex` when serving a request. This avoids a theoretical slowdown under high-usage scenarios from competing atomic integer operations inside the `RWMutex`. If your application adds routes to the router after it has begun serving requests, you should avoid potential race conditions by setting `router.SafeAddRoutesWhileRunning` to `true` to use the `RWMutex` when serving requests. - -## Error Handlers - -### NotFoundHandler -TreeMux.NotFoundHandler can be set to provide custom 404-error handling. The default implementation is Go's `http.NotFound` function. - -### MethodNotAllowedHandler -If a pattern matches, but the pattern does not have an associated handler for the requested method, the router calls the MethodNotAllowedHandler. The default -version of this handler just writes the status code `http.StatusMethodNotAllowed` and sets the response header's `Allowed` field appropriately. - -### Panic Handling -TreeMux.PanicHandler can be set to provide custom panic handling. The `SimplePanicHandler` just writes the status code `http.StatusInternalServerError`. The function `ShowErrorsPanicHandler`, adapted from [gocraft/web](https://github.com/gocraft/web), will print panic errors to the browser in an easily-readable format. - -## Unexpected Differences from Other Routers - -This router is intentionally light on features in the name of simplicity and -performance. When coming from another router that does heavier processing behind -the scenes, you may encounter some unexpected behavior. This list is by no means -exhaustive, but covers some nonobvious cases that users have encountered. - -### gorilla/pat query string modifications - -When matching on parameters in a route, the `gorilla/pat` router will modify -`Request.URL.RawQuery` to make it appear like the parameters were in the -query string. `httptreemux` does not do this. See [Issue #26](https://github.com/dimfeld/httptreemux/issues/26) for more details and a -code snippet that can perform this transformation for you, should you want it. - -### httprouter and catch-all parameters - -When using `httprouter`, a route with a catch-all parameter (e.g. `/images/*path`) will match on URLs like `/images/` where the catch-all parameter is empty. This router does not match on empty catch-all parameters, but the behavior can be duplicated by adding a route without the catch-all (e.g. `/images/`). - -## Middleware -This package provides no middleware. But there are a lot of great options out there and it's pretty easy to write your own. The router provides the `Use` and `UseHandler` functions to ease the creation of middleware chains. (Real documentation of these functions coming soon.) - -# Acknowledgements - -* Inspiration from Julien Schmidt's [httprouter](https://github.com/julienschmidt/httprouter) -* Show Errors panic handler from [gocraft/web](https://github.com/gocraft/web) diff --git a/vendor/github.com/dimfeld/httptreemux/v5/context.go b/vendor/github.com/dimfeld/httptreemux/v5/context.go deleted file mode 100644 index 66e1bba05a..0000000000 --- a/vendor/github.com/dimfeld/httptreemux/v5/context.go +++ /dev/null @@ -1,209 +0,0 @@ -// +build go1.7 - -package httptreemux - -import ( - "context" - "net/http" -) - -// ContextGroup is a wrapper around Group, with the purpose of mimicking its API, but with the use of http.HandlerFunc-based handlers. -// Instead of passing a parameter map via the handler (i.e. httptreemux.HandlerFunc), the path parameters are accessed via the request -// object's context. -type ContextGroup struct { - group *Group -} - -// Use appends a middleware handler to the Group middleware stack. -func (cg *ContextGroup) Use(fn MiddlewareFunc) { - cg.group.Use(fn) -} - -// UseHandler is like Use but accepts http.Handler middleware. -func (cg *ContextGroup) UseHandler(middleware func(http.Handler) http.Handler) { - cg.group.UseHandler(middleware) -} - -// UsingContext wraps the receiver to return a new instance of a ContextGroup. -// The returned ContextGroup is a sibling to its wrapped Group, within the parent TreeMux. -// The choice of using a *Group as the receiver, as opposed to a function parameter, allows chaining -// while method calls between a TreeMux, Group, and ContextGroup. For example: -// -// tree := httptreemux.New() -// group := tree.NewGroup("/api") -// -// group.GET("/v1", func(w http.ResponseWriter, r *http.Request, params map[string]string) { -// w.Write([]byte(`GET /api/v1`)) -// }) -// -// group.UsingContext().GET("/v2", func(w http.ResponseWriter, r *http.Request) { -// w.Write([]byte(`GET /api/v2`)) -// }) -// -// http.ListenAndServe(":8080", tree) -// -func (g *Group) UsingContext() *ContextGroup { - return &ContextGroup{g} -} - -// NewContextGroup adds a child context group to its path. -func (cg *ContextGroup) NewContextGroup(path string) *ContextGroup { - return &ContextGroup{cg.group.NewGroup(path)} -} - -func (cg *ContextGroup) NewGroup(path string) *ContextGroup { - return cg.NewContextGroup(path) -} - -func (cg *ContextGroup) wrapHandler(path string, handler HandlerFunc) HandlerFunc { - if len(cg.group.stack) > 0 { - handler = handlerWithMiddlewares(handler, cg.group.stack) - } - - //add the context data after adding all middleware - fullPath := cg.group.path + path - return func(writer http.ResponseWriter, request *http.Request, m map[string]string) { - routeData := &contextData{ - route: fullPath, - params: m, - } - request = request.WithContext(AddRouteDataToContext(request.Context(), routeData)) - handler(writer, request, m) - } -} - -// Handle allows handling HTTP requests via an http.HandlerFunc, as opposed to an httptreemux.HandlerFunc. -// Any parameters from the request URL are stored in a map[string]string in the request's context. -func (cg *ContextGroup) Handle(method, path string, handler http.HandlerFunc) { - cg.group.mux.mutex.Lock() - defer cg.group.mux.mutex.Unlock() - - wrapped := cg.wrapHandler(path, func(w http.ResponseWriter, r *http.Request, params map[string]string) { - handler(w, r) - }) - - cg.group.addFullStackHandler(method, path, wrapped) -} - -// Handler allows handling HTTP requests via an http.Handler interface, as opposed to an httptreemux.HandlerFunc. -// Any parameters from the request URL are stored in a map[string]string in the request's context. -func (cg *ContextGroup) Handler(method, path string, handler http.Handler) { - cg.group.mux.mutex.Lock() - defer cg.group.mux.mutex.Unlock() - - wrapped := cg.wrapHandler(path, func(w http.ResponseWriter, r *http.Request, params map[string]string) { - handler.ServeHTTP(w, r) - }) - - cg.group.addFullStackHandler(method, path, wrapped) -} - -// GET is convenience method for handling GET requests on a context group. -func (cg *ContextGroup) GET(path string, handler http.HandlerFunc) { - cg.Handle("GET", path, handler) -} - -// POST is convenience method for handling POST requests on a context group. -func (cg *ContextGroup) POST(path string, handler http.HandlerFunc) { - cg.Handle("POST", path, handler) -} - -// PUT is convenience method for handling PUT requests on a context group. -func (cg *ContextGroup) PUT(path string, handler http.HandlerFunc) { - cg.Handle("PUT", path, handler) -} - -// DELETE is convenience method for handling DELETE requests on a context group. -func (cg *ContextGroup) DELETE(path string, handler http.HandlerFunc) { - cg.Handle("DELETE", path, handler) -} - -// PATCH is convenience method for handling PATCH requests on a context group. -func (cg *ContextGroup) PATCH(path string, handler http.HandlerFunc) { - cg.Handle("PATCH", path, handler) -} - -// HEAD is convenience method for handling HEAD requests on a context group. -func (cg *ContextGroup) HEAD(path string, handler http.HandlerFunc) { - cg.Handle("HEAD", path, handler) -} - -// OPTIONS is convenience method for handling OPTIONS requests on a context group. -func (cg *ContextGroup) OPTIONS(path string, handler http.HandlerFunc) { - cg.Handle("OPTIONS", path, handler) -} - -type contextData struct { - route string - params map[string]string -} - -func (cd *contextData) Route() string { - return cd.route -} - -func (cd *contextData) Params() map[string]string { - if cd.params != nil { - return cd.params - } - return map[string]string{} -} - -// ContextRouteData is the information associated with the matched path. -// Route() returns the matched route, without expanded wildcards. -// Params() returns a map of the route's wildcards and their matched values. -type ContextRouteData interface { - Route() string - Params() map[string]string -} - -// ContextParams returns a map of the route's wildcards and their matched values. -func ContextParams(ctx context.Context) map[string]string { - if cd := ContextData(ctx); cd != nil { - return cd.Params() - } - return map[string]string{} -} - -// ContextRoute returns the matched route, without expanded wildcards. -func ContextRoute(ctx context.Context) string { - if cd := ContextData(ctx); cd != nil { - return cd.Route() - } - return "" -} - -// ContextData returns the ContextRouteData associated with the matched path -func ContextData(ctx context.Context) ContextRouteData { - if p, ok := ctx.Value(contextDataKey).(ContextRouteData); ok { - return p - } - return nil -} - -// AddRouteDataToContext can be used for testing handlers, to insert route data into the request's `Context`. -func AddRouteDataToContext(ctx context.Context, data ContextRouteData) context.Context { - return context.WithValue(ctx, contextDataKey, data) -} - -// AddParamsToContext inserts a parameters map into a context using -// the package's internal context key. -func AddParamsToContext(ctx context.Context, params map[string]string) context.Context { - return AddRouteDataToContext(ctx, &contextData{ - params: params, - }) -} - -// AddRouteToContext inserts a route into a context using -// the package's internal context key. -func AddRouteToContext(ctx context.Context, route string) context.Context { - return AddRouteDataToContext(ctx, &contextData{ - route: route, - }) -} - -type contextKey int - -// contextDataKey is used to retrieve the path's params map and matched route -// from a request's context. -const contextDataKey contextKey = 0 diff --git a/vendor/github.com/dimfeld/httptreemux/v5/group.go b/vendor/github.com/dimfeld/httptreemux/v5/group.go deleted file mode 100644 index b01c265a83..0000000000 --- a/vendor/github.com/dimfeld/httptreemux/v5/group.go +++ /dev/null @@ -1,250 +0,0 @@ -package httptreemux - -import ( - "fmt" - "net/http" - "net/url" - "strings" -) - -type MiddlewareFunc func(next HandlerFunc) HandlerFunc - -func handlerWithMiddlewares(handler HandlerFunc, stack []MiddlewareFunc) HandlerFunc { - for i := len(stack) - 1; i >= 0; i-- { - handler = stack[i](handler) - } - return handler -} - -type Group struct { - path string - mux *TreeMux - stack []MiddlewareFunc -} - -// Add a sub-group to this group -func (g *Group) NewGroup(path string) *Group { - if len(path) < 1 { - panic("Group path must not be empty") - } - - checkPath(path) - path = g.path + path - //Don't want trailing slash as all sub-paths start with slash - if path[len(path)-1] == '/' { - path = path[:len(path)-1] - } - return &Group{ - path: path, - mux: g.mux, - stack: g.stack[:len(g.stack):len(g.stack)], - } -} - -// Use appends a middleware handler to the Group middleware stack. -func (g *Group) Use(fn MiddlewareFunc) { - g.stack = append(g.stack, fn) -} - -type handlerWithParams struct { - handler HandlerFunc - params map[string]string -} - -func (h handlerWithParams) ServeHTTP(w http.ResponseWriter, r *http.Request) { - h.handler(w, r, h.params) -} - -// UseHandler is like Use but accepts http.Handler middleware. -func (g *Group) UseHandler(middleware func(http.Handler) http.Handler) { - g.stack = append(g.stack, func(next HandlerFunc) HandlerFunc { - return func(w http.ResponseWriter, r *http.Request, params map[string]string) { - nextHandler := handlerWithParams{ - handler: next, - params: params, - } - middleware(nextHandler).ServeHTTP(w, r) - } - }) -} - -// Path elements starting with : indicate a wildcard in the path. A wildcard will only match on a -// single path segment. That is, the pattern `/post/:postid` will match on `/post/1` or `/post/1/`, -// but not `/post/1/2`. -// -// A path element starting with * is a catch-all, whose value will be a string containing all text -// in the URL matched by the wildcards. For example, with a pattern of `/images/*path` and a -// requested URL `images/abc/def`, path would contain `abc/def`. -// -// # Routing Rule Priority -// -// The priority rules in the router are simple. -// -// 1. Static path segments take the highest priority. If a segment and its subtree are able to match the URL, that match is returned. -// -// 2. Wildcards take second priority. For a particular wildcard to match, that wildcard and its subtree must match the URL. -// -// 3. Finally, a catch-all rule will match when the earlier path segments have matched, and none of the static or wildcard conditions have matched. Catch-all rules must be at the end of a pattern. -// -// So with the following patterns, we'll see certain matches: -// router = httptreemux.New() -// router.GET("/:page", pageHandler) -// router.GET("/:year/:month/:post", postHandler) -// router.GET("/:year/:month", archiveHandler) -// router.GET("/images/*path", staticHandler) -// router.GET("/favicon.ico", staticHandler) -// -// /abc will match /:page -// /2014/05 will match /:year/:month -// /2014/05/really-great-blog-post will match /:year/:month/:post -// /images/CoolImage.gif will match /images/*path -// /images/2014/05/MayImage.jpg will also match /images/*path, with all the text after /images stored in the variable path. -// /favicon.ico will match /favicon.ico -// -// # Trailing Slashes -// -// The router has special handling for paths with trailing slashes. If a pattern is added to the -// router with a trailing slash, any matches on that pattern without a trailing slash will be -// redirected to the version with the slash. If a pattern does not have a trailing slash, matches on -// that pattern with a trailing slash will be redirected to the version without. -// -// The trailing slash flag is only stored once for a pattern. That is, if a pattern is added for a -// method with a trailing slash, all other methods for that pattern will also be considered to have a -// trailing slash, regardless of whether or not it is specified for those methods too. -// -// This behavior can be turned off by setting TreeMux.RedirectTrailingSlash to false. By -// default it is set to true. The specifics of the redirect depend on RedirectBehavior. -// -// One exception to this rule is catch-all patterns. By default, trailing slash redirection is -// disabled on catch-all patterns, since the structure of the entire URL and the desired patterns -// can not be predicted. If trailing slash removal is desired on catch-all patterns, set -// TreeMux.RemoveCatchAllTrailingSlash to true. -// -// router = httptreemux.New() -// router.GET("/about", pageHandler) -// router.GET("/posts/", postIndexHandler) -// router.POST("/posts", postFormHandler) -// -// GET /about will match normally. -// GET /about/ will redirect to /about. -// GET /posts will redirect to /posts/. -// GET /posts/ will match normally. -// POST /posts will redirect to /posts/, because the GET method used a trailing slash. -func (g *Group) Handle(method string, path string, handler HandlerFunc) { - g.mux.mutex.Lock() - defer g.mux.mutex.Unlock() - - if len(g.stack) > 0 { - handler = handlerWithMiddlewares(handler, g.stack) - } - - g.addFullStackHandler(method, path, handler) -} - -func (g *Group) addFullStackHandler(method string, path string, handler HandlerFunc) { - addSlash := false - addOne := func(thePath string) { - if g.mux.CaseInsensitive { - thePath = strings.ToLower(thePath) - } - - node := g.mux.root.addPath(thePath[1:], nil, false) - if addSlash { - node.addSlash = true - } - node.setHandler(method, handler, false) - - if g.mux.HeadCanUseGet && method == "GET" && node.leafHandler["HEAD"] == nil { - node.setHandler("HEAD", handler, true) - } - } - - checkPath(path) - path = g.path + path - if len(path) == 0 { - panic("Cannot map an empty path") - } - - if len(path) > 1 && path[len(path)-1] == '/' && g.mux.RedirectTrailingSlash { - addSlash = true - path = path[:len(path)-1] - } - - if g.mux.EscapeAddedRoutes { - u, err := url.ParseRequestURI(path) - if err != nil { - panic("URL parsing error " + err.Error() + " on url " + path) - } - escapedPath := unescapeSpecial(u.String()) - - if escapedPath != path { - addOne(escapedPath) - } - } - - addOne(path) - -} - -// Syntactic sugar for Handle("GET", path, handler) -func (g *Group) GET(path string, handler HandlerFunc) { - g.Handle("GET", path, handler) -} - -// Syntactic sugar for Handle("POST", path, handler) -func (g *Group) POST(path string, handler HandlerFunc) { - g.Handle("POST", path, handler) -} - -// Syntactic sugar for Handle("PUT", path, handler) -func (g *Group) PUT(path string, handler HandlerFunc) { - g.Handle("PUT", path, handler) -} - -// Syntactic sugar for Handle("DELETE", path, handler) -func (g *Group) DELETE(path string, handler HandlerFunc) { - g.Handle("DELETE", path, handler) -} - -// Syntactic sugar for Handle("PATCH", path, handler) -func (g *Group) PATCH(path string, handler HandlerFunc) { - g.Handle("PATCH", path, handler) -} - -// Syntactic sugar for Handle("HEAD", path, handler) -func (g *Group) HEAD(path string, handler HandlerFunc) { - g.Handle("HEAD", path, handler) -} - -// Syntactic sugar for Handle("OPTIONS", path, handler) -func (g *Group) OPTIONS(path string, handler HandlerFunc) { - g.Handle("OPTIONS", path, handler) -} - -func checkPath(path string) { - // All non-empty paths must start with a slash - if len(path) > 0 && path[0] != '/' { - panic(fmt.Sprintf("Path %s must start with slash", path)) - } -} - -func unescapeSpecial(s string) string { - // Look for sequences of \*, *, and \: that were escaped, and undo some of that escaping. - - // Unescape /* since it references a wildcard token. - s = strings.Replace(s, "/%2A", "/*", -1) - - // Unescape /\: since it references a literal colon - s = strings.Replace(s, "/%5C:", "/\\:", -1) - - // Replace escaped /\\: with /\: - s = strings.Replace(s, "/%5C%5C:", "/%5C:", -1) - - // Replace escaped /\* with /* - s = strings.Replace(s, "/%5C%2A", "/%2A", -1) - - // Replace escaped /\\* with /\* - s = strings.Replace(s, "/%5C%5C%2A", "/%5C%2A", -1) - - return s -} diff --git a/vendor/github.com/dimfeld/httptreemux/v5/panichandler.go b/vendor/github.com/dimfeld/httptreemux/v5/panichandler.go deleted file mode 100644 index cebb661bc4..0000000000 --- a/vendor/github.com/dimfeld/httptreemux/v5/panichandler.go +++ /dev/null @@ -1,211 +0,0 @@ -package httptreemux - -import ( - "bufio" - "encoding/json" - "html/template" - "net/http" - "os" - "runtime" - "strings" -) - -// SimplePanicHandler just returns error 500. -func SimplePanicHandler(w http.ResponseWriter, r *http.Request, err interface{}) { - w.WriteHeader(http.StatusInternalServerError) -} - -// ShowErrorsPanicHandler prints a nice representation of an error to the browser. -// This was taken from github.com/gocraft/web, which adapted it from the Traffic project. -func ShowErrorsPanicHandler(w http.ResponseWriter, r *http.Request, err interface{}) { - const size = 4096 - stack := make([]byte, size) - stack = stack[:runtime.Stack(stack, false)] - renderPrettyError(w, r, err, stack) -} - -func makeErrorData(r *http.Request, err interface{}, stack []byte, filePath string, line int) map[string]interface{} { - - data := map[string]interface{}{ - "Stack": string(stack), - "Params": r.URL.Query(), - "Method": r.Method, - "FilePath": filePath, - "Line": line, - "Lines": readErrorFileLines(filePath, line), - } - - if e, ok := err.(error); ok { - data["Error"] = e.Error() - } else { - data["Error"] = err - } - - return data -} - -func renderPrettyError(rw http.ResponseWriter, req *http.Request, err interface{}, stack []byte) { - _, filePath, line, _ := runtime.Caller(5) - - data := makeErrorData(req, err, stack, filePath, line) - rw.Header().Set("Content-Type", "text/html") - rw.WriteHeader(http.StatusInternalServerError) - - tpl := template.Must(template.New("ErrorPage").Parse(panicPageTpl)) - tpl.Execute(rw, data) -} - -func ShowErrorsJsonPanicHandler(w http.ResponseWriter, r *http.Request, err interface{}) { - const size = 4096 - stack := make([]byte, size) - stack = stack[:runtime.Stack(stack, false)] - - _, filePath, line, _ := runtime.Caller(4) - data := makeErrorData(r, err, stack, filePath, line) - - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusInternalServerError) - json.NewEncoder(w).Encode(data) -} - -func readErrorFileLines(filePath string, errorLine int) map[int]string { - lines := make(map[int]string) - - file, err := os.Open(filePath) - if err != nil { - return lines - } - - defer file.Close() - - reader := bufio.NewReader(file) - currentLine := 0 - for { - line, err := reader.ReadString('\n') - if err != nil || currentLine > errorLine+5 { - break - } - - currentLine++ - - if currentLine >= errorLine-5 { - lines[currentLine] = strings.Replace(line, "\n", "", -1) - } - } - - return lines -} - -const panicPageTpl string = ` - - - Panic - - - - -
-
-

Error

-
-
- -
-

{{ .Error }}

-
- -
-

- In {{ .FilePath }}:{{ .Line }}

-

- - - - - - -
-
{{ range $lineNumber, $line :=  .Lines }}{{ $lineNumber }}{{ end }}
-
-
{{ range $lineNumber, $line :=  .Lines }}{{ $line }}
{{ end }}
-
-

Stack

-
{{ .Stack }}
-

Request

-

Method: {{ .Method }}

-

Parameters:

- -
- - - ` diff --git a/vendor/github.com/dimfeld/httptreemux/v5/path.go b/vendor/github.com/dimfeld/httptreemux/v5/path.go deleted file mode 100644 index 506ac38469..0000000000 --- a/vendor/github.com/dimfeld/httptreemux/v5/path.go +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright 2013 Julien Schmidt. All rights reserved. -// Based on the path package, Copyright 2009 The Go Authors. -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. - -package httptreemux - -// Clean is the URL version of path.Clean, it returns a canonical URL path -// for p, eliminating . and .. elements. -// -// The following rules are applied iteratively until no further processing can -// be done: -// 1. Replace multiple slashes with a single slash. -// 2. Eliminate each . path name element (the current directory). -// 3. Eliminate each inner .. path name element (the parent directory) -// along with the non-.. element that precedes it. -// 4. Eliminate .. elements that begin a rooted path: -// that is, replace "/.." by "/" at the beginning of a path. -// -// If the result of this process is an empty string, "/" is returned -func Clean(p string) string { - if p == "" { - return "/" - } - - n := len(p) - var buf []byte - - // Invariants: - // reading from path; r is index of next byte to process. - // writing to buf; w is index of next byte to write. - - // path must start with '/' - r := 1 - w := 1 - - if p[0] != '/' { - r = 0 - buf = make([]byte, n+1) - buf[0] = '/' - } - - trailing := n > 2 && p[n-1] == '/' - - // A bit more clunky without a 'lazybuf' like the path package, but the loop - // gets completely inlined (bufApp). So in contrast to the path package this - // loop has no expensive function calls (except 1x make) - - for r < n { - switch { - case p[r] == '/': - // empty path element, trailing slash is added after the end - r++ - - case p[r] == '.' && r+1 == n: - trailing = true - r++ - - case p[r] == '.' && p[r+1] == '/': - // . element - r++ - - case p[r] == '.' && p[r+1] == '.' && (r+2 == n || p[r+2] == '/'): - // .. element: remove to last / - r += 2 - - if w > 1 { - // can backtrack - w-- - - if buf == nil { - for w > 1 && p[w] != '/' { - w-- - } - } else { - for w > 1 && buf[w] != '/' { - w-- - } - } - } - - default: - // real path element. - // add slash if needed - if w > 1 { - bufApp(&buf, p, w, '/') - w++ - } - - // copy element - for r < n && p[r] != '/' { - bufApp(&buf, p, w, p[r]) - w++ - r++ - } - } - } - - // re-append trailing slash - if trailing && w > 1 { - bufApp(&buf, p, w, '/') - w++ - } - - // Turn empty string into "/" - if w == 0 { - return "/" - } - - if buf == nil { - return p[:w] - } - return string(buf[:w]) -} - -// internal helper to lazily create a buffer if necessary -func bufApp(buf *[]byte, s string, w int, c byte) { - if *buf == nil { - if s[w] == c { - return - } - - *buf = make([]byte, len(s)) - copy(*buf, s[:w]) - } - (*buf)[w] = c -} diff --git a/vendor/github.com/dimfeld/httptreemux/v5/router.go b/vendor/github.com/dimfeld/httptreemux/v5/router.go deleted file mode 100644 index 08e8aef94d..0000000000 --- a/vendor/github.com/dimfeld/httptreemux/v5/router.go +++ /dev/null @@ -1,306 +0,0 @@ -// This is inspired by Julien Schmidt's httprouter, in that it uses a patricia tree, but the -// implementation is rather different. Specifically, the routing rules are relaxed so that a -// single path segment may be a wildcard in one route and a static token in another. This gives a -// nice combination of high performance with a lot of convenience in designing the routing patterns. -package httptreemux - -import ( - "fmt" - "net/http" - "net/url" - "strings" -) - -// The params argument contains the parameters parsed from wildcards and catch-alls in the URL. -type HandlerFunc func(http.ResponseWriter, *http.Request, map[string]string) -type PanicHandler func(http.ResponseWriter, *http.Request, interface{}) - -// RedirectBehavior sets the behavior when the router redirects the request to the -// canonical version of the requested URL using RedirectTrailingSlash or RedirectClean. -// The default behavior is to return a 301 status, redirecting the browser to the version -// of the URL that matches the given pattern. -// -// On a POST request, most browsers that receive a 301 will submit a GET request to -// the redirected URL, meaning that any data will likely be lost. If you want to handle -// and avoid this behavior, you may use Redirect307, which causes most browsers to -// resubmit the request using the original method and request body. -// -// Since 307 is supposed to be a temporary redirect, the new 308 status code has been -// proposed, which is treated the same, except it indicates correctly that the redirection -// is permanent. The big caveat here is that the RFC is relatively recent, and older -// browsers will not know what to do with it. Therefore its use is not recommended -// unless you really know what you're doing. -// -// Finally, the UseHandler value will simply call the handler function for the pattern. -type RedirectBehavior int - -type PathSource int - -const ( - Redirect301 RedirectBehavior = iota // Return 301 Moved Permanently - Redirect307 // Return 307 HTTP/1.1 Temporary Redirect - Redirect308 // Return a 308 RFC7538 Permanent Redirect - UseHandler // Just call the handler function - - RequestURI PathSource = iota // Use r.RequestURI - URLPath // Use r.URL.Path -) - -// LookupResult contains information about a route lookup, which is returned from Lookup and -// can be passed to ServeLookupResult if the request should be served. -type LookupResult struct { - // StatusCode informs the caller about the result of the lookup. - // This will generally be `http.StatusNotFound` or `http.StatusMethodNotAllowed` for an - // error case. On a normal success, the statusCode will be `http.StatusOK`. A redirect code - // will also be used in the case - StatusCode int - handler HandlerFunc - // Params represents the key value pairs of the path parameters. - Params map[string]string - leafHandler map[string]HandlerFunc // Only has a value when StatusCode is MethodNotAllowed. -} - -// Dump returns a text representation of the routing tree. -func (t *TreeMux) Dump() string { - return t.root.dumpTree("", "") -} - -func (t *TreeMux) serveHTTPPanic(w http.ResponseWriter, r *http.Request) { - if err := recover(); err != nil { - t.PanicHandler(w, r, err) - } -} - -func (t *TreeMux) redirectStatusCode(method string) (int, bool) { - var behavior RedirectBehavior - var ok bool - if behavior, ok = t.RedirectMethodBehavior[method]; !ok { - behavior = t.RedirectBehavior - } - switch behavior { - case Redirect301: - return http.StatusMovedPermanently, true - case Redirect307: - return http.StatusTemporaryRedirect, true - case Redirect308: - // Go doesn't have a constant for this yet. Yet another sign - // that you probably shouldn't use it. - return 308, true - case UseHandler: - return 0, false - default: - return http.StatusMovedPermanently, true - } -} - -func redirectHandler(newPath string, statusCode int) HandlerFunc { - return func(w http.ResponseWriter, r *http.Request, params map[string]string) { - redirect(w, r, newPath, statusCode) - } -} - -func redirect(w http.ResponseWriter, r *http.Request, newPath string, statusCode int) { - newURL := url.URL{ - Path: newPath, - RawQuery: r.URL.RawQuery, - Fragment: r.URL.Fragment, - } - http.Redirect(w, r, newURL.String(), statusCode) -} - -func (t *TreeMux) lookup(w http.ResponseWriter, r *http.Request) (result LookupResult, found bool) { - result.StatusCode = http.StatusNotFound - path := r.RequestURI - unescapedPath := r.URL.Path - pathLen := len(path) - if pathLen > 0 && t.PathSource == RequestURI { - rawQueryLen := len(r.URL.RawQuery) - - if rawQueryLen != 0 || path[pathLen-1] == '?' { - // Remove any query string and the ?. - path = path[:pathLen-rawQueryLen-1] - pathLen = len(path) - } - } else { - // In testing with http.NewRequest, - // RequestURI is not set so just grab URL.Path instead. - path = r.URL.Path - pathLen = len(path) - } - if t.CaseInsensitive { - path = strings.ToLower(path) - unescapedPath = strings.ToLower(unescapedPath) - } - - trailingSlash := path[pathLen-1] == '/' && pathLen > 1 - if trailingSlash && t.RedirectTrailingSlash { - path = path[:pathLen-1] - unescapedPath = unescapedPath[:len(unescapedPath)-1] - } - - n, handler, params := t.root.search(r.Method, path[1:]) - if n == nil { - if t.RedirectCleanPath { - // Path was not found. Try cleaning it up and search again. - // TODO Test this - cleanPath := Clean(unescapedPath) - n, handler, params = t.root.search(r.Method, cleanPath[1:]) - if n == nil { - // Still nothing found. - return - } - if statusCode, ok := t.redirectStatusCode(r.Method); ok { - // Redirect to the actual path - return LookupResult{statusCode, redirectHandler(cleanPath, statusCode), nil, nil}, true - } - } else { - // Not found. - return - } - } - - if handler == nil { - if r.Method == "OPTIONS" && t.OptionsHandler != nil { - handler = t.OptionsHandler - } - - if handler == nil { - result.leafHandler = n.leafHandler - result.StatusCode = http.StatusMethodNotAllowed - return - } - } - - if !n.isCatchAll || t.RemoveCatchAllTrailingSlash { - if trailingSlash != n.addSlash && t.RedirectTrailingSlash { - if statusCode, ok := t.redirectStatusCode(r.Method); ok { - var h HandlerFunc - if n.addSlash { - // Need to add a slash. - h = redirectHandler(unescapedPath+"/", statusCode) - } else if path != "/" { - // We need to remove the slash. This was already done at the - // beginning of the function. - h = redirectHandler(unescapedPath, statusCode) - } - - if h != nil { - return LookupResult{statusCode, h, nil, nil}, true - } - } - } - } - - var paramMap map[string]string - if len(params) != 0 { - if len(params) != len(n.leafWildcardNames) { - // Need better behavior here. Should this be a panic? - panic(fmt.Sprintf("httptreemux parameter list length mismatch: %v, %v", - params, n.leafWildcardNames)) - } - - paramMap = make(map[string]string) - numParams := len(params) - for index := 0; index < numParams; index++ { - paramMap[n.leafWildcardNames[numParams-index-1]] = params[index] - } - } - - return LookupResult{http.StatusOK, handler, paramMap, nil}, true -} - -// Lookup performs a lookup without actually serving the request or mutating the request or response. -// The return values are a LookupResult and a boolean. The boolean will be true when a handler -// was found or the lookup resulted in a redirect which will point to a real handler. It is false -// for requests which would result in a `StatusNotFound` or `StatusMethodNotAllowed`. -// -// Regardless of the returned boolean's value, the LookupResult may be passed to ServeLookupResult -// to be served appropriately. -func (t *TreeMux) Lookup(w http.ResponseWriter, r *http.Request) (LookupResult, bool) { - if t.SafeAddRoutesWhileRunning { - // In concurrency safe mode, we acquire a read lock on the mutex for any access. - // This is optional to avoid potential performance loss in high-usage scenarios. - t.mutex.RLock() - } - - result, found := t.lookup(w, r) - - if t.SafeAddRoutesWhileRunning { - t.mutex.RUnlock() - } - - return result, found -} - -// ServeLookupResult serves a request, given a lookup result from the Lookup function. -func (t *TreeMux) ServeLookupResult(w http.ResponseWriter, r *http.Request, lr LookupResult) { - if lr.handler == nil { - if lr.StatusCode == http.StatusMethodNotAllowed && lr.leafHandler != nil { - if t.SafeAddRoutesWhileRunning { - t.mutex.RLock() - } - - t.MethodNotAllowedHandler(w, r, lr.leafHandler) - - if t.SafeAddRoutesWhileRunning { - t.mutex.RUnlock() - } - } else { - t.NotFoundHandler(w, r) - } - } else { - r = t.setDefaultRequestContext(r) - lr.handler(w, r, lr.Params) - } -} - -func (t *TreeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) { - if t.PanicHandler != nil { - defer t.serveHTTPPanic(w, r) - } - - if t.SafeAddRoutesWhileRunning { - // In concurrency safe mode, we acquire a read lock on the mutex for any access. - // This is optional to avoid potential performance loss in high-usage scenarios. - t.mutex.RLock() - } - - result, _ := t.lookup(w, r) - - if t.SafeAddRoutesWhileRunning { - t.mutex.RUnlock() - } - - t.ServeLookupResult(w, r, result) -} - -// MethodNotAllowedHandler is the default handler for TreeMux.MethodNotAllowedHandler, -// which is called for patterns that match, but do not have a handler installed for the -// requested method. It simply writes the status code http.StatusMethodNotAllowed and fills -// in the `Allow` header value appropriately. -func MethodNotAllowedHandler(w http.ResponseWriter, r *http.Request, - methods map[string]HandlerFunc) { - - for m := range methods { - w.Header().Add("Allow", m) - } - - w.WriteHeader(http.StatusMethodNotAllowed) -} - -func New() *TreeMux { - tm := &TreeMux{ - root: &node{path: "/"}, - NotFoundHandler: http.NotFound, - MethodNotAllowedHandler: MethodNotAllowedHandler, - HeadCanUseGet: true, - RedirectTrailingSlash: true, - RedirectCleanPath: true, - RedirectBehavior: Redirect301, - RedirectMethodBehavior: make(map[string]RedirectBehavior), - PathSource: RequestURI, - EscapeAddedRoutes: false, - } - tm.Group.mux = tm - return tm -} diff --git a/vendor/github.com/dimfeld/httptreemux/v5/tree.go b/vendor/github.com/dimfeld/httptreemux/v5/tree.go deleted file mode 100644 index 530d427848..0000000000 --- a/vendor/github.com/dimfeld/httptreemux/v5/tree.go +++ /dev/null @@ -1,340 +0,0 @@ -package httptreemux - -import ( - "fmt" - "strings" -) - -type node struct { - path string - - priority int - - // The list of static children to check. - staticIndices []byte - staticChild []*node - - // If none of the above match, check the wildcard children - wildcardChild *node - - // If none of the above match, then we use the catch-all, if applicable. - catchAllChild *node - - // Data for the node is below. - - addSlash bool - isCatchAll bool - // If true, the head handler was set implicitly, so let it also be set explicitly. - implicitHead bool - // If this node is the end of the URL, then call the handler, if applicable. - leafHandler map[string]HandlerFunc - - // The names of the parameters to apply. - leafWildcardNames []string -} - -func (n *node) sortStaticChild(i int) { - for i > 0 && n.staticChild[i].priority > n.staticChild[i-1].priority { - n.staticChild[i], n.staticChild[i-1] = n.staticChild[i-1], n.staticChild[i] - n.staticIndices[i], n.staticIndices[i-1] = n.staticIndices[i-1], n.staticIndices[i] - i -= 1 - } -} - -func (n *node) setHandler(verb string, handler HandlerFunc, implicitHead bool) { - if n.leafHandler == nil { - n.leafHandler = make(map[string]HandlerFunc) - } - _, ok := n.leafHandler[verb] - if ok && (verb != "HEAD" || !n.implicitHead) { - panic(fmt.Sprintf("%s already handles %s", n.path, verb)) - } - n.leafHandler[verb] = handler - - if verb == "HEAD" { - n.implicitHead = implicitHead - } -} - -func (n *node) addPath(path string, wildcards []string, inStaticToken bool) *node { - leaf := len(path) == 0 - if leaf { - if wildcards != nil { - // Make sure the current wildcards are the same as the old ones. - // If not then we have an ambiguous path. - if n.leafWildcardNames != nil { - if len(n.leafWildcardNames) != len(wildcards) { - // This should never happen. - panic("Reached leaf node with differing wildcard array length. Please report this as a bug.") - } - - for i := 0; i < len(wildcards); i++ { - if n.leafWildcardNames[i] != wildcards[i] { - panic(fmt.Sprintf("Wildcards %v are ambiguous with wildcards %v", - n.leafWildcardNames, wildcards)) - } - } - } else { - // No wildcards yet, so just add the existing set. - n.leafWildcardNames = wildcards - } - } - - return n - } - - c := path[0] - nextSlash := strings.Index(path, "/") - var thisToken string - var tokenEnd int - - if c == '/' { - // Done processing the previous token, so reset inStaticToken to false. - thisToken = "/" - tokenEnd = 1 - } else if nextSlash == -1 { - thisToken = path - tokenEnd = len(path) - } else { - thisToken = path[0:nextSlash] - tokenEnd = nextSlash - } - remainingPath := path[tokenEnd:] - - if c == '*' && !inStaticToken { - // Token starts with a *, so it's a catch-all - thisToken = thisToken[1:] - if n.catchAllChild == nil { - n.catchAllChild = &node{path: thisToken, isCatchAll: true} - } - - if path[1:] != n.catchAllChild.path { - panic(fmt.Sprintf("Catch-all name in %s doesn't match %s. You probably tried to define overlapping catchalls", - path, n.catchAllChild.path)) - } - - if nextSlash != -1 { - panic("/ after catch-all found in " + path) - } - - if wildcards == nil { - wildcards = []string{thisToken} - } else { - wildcards = append(wildcards, thisToken) - } - n.catchAllChild.leafWildcardNames = wildcards - - return n.catchAllChild - } else if c == ':' && !inStaticToken { - // Token starts with a : - thisToken = thisToken[1:] - - if wildcards == nil { - wildcards = []string{thisToken} - } else { - wildcards = append(wildcards, thisToken) - } - - if n.wildcardChild == nil { - n.wildcardChild = &node{path: "wildcard"} - } - - return n.wildcardChild.addPath(remainingPath, wildcards, false) - - } else { - // if strings.ContainsAny(thisToken, ":*") { - // panic("* or : in middle of path component " + path) - // } - - unescaped := false - if len(thisToken) >= 2 && !inStaticToken { - if thisToken[0] == '\\' && (thisToken[1] == '*' || thisToken[1] == ':' || thisToken[1] == '\\') { - // The token starts with a character escaped by a backslash. Drop the backslash. - c = thisToken[1] - thisToken = thisToken[1:] - unescaped = true - } - } - - // Set inStaticToken to ensure that the rest of this token is not mistaken - // for a wildcard if a prefix split occurs at a '*' or ':'. - inStaticToken = (c != '/') - - // Do we have an existing node that starts with the same letter? - for i, index := range n.staticIndices { - if c == index { - // Yes. Split it based on the common prefix of the existing - // node and the new one. - child, prefixSplit := n.splitCommonPrefix(i, thisToken) - - child.priority++ - n.sortStaticChild(i) - if unescaped { - // Account for the removed backslash. - prefixSplit++ - } - return child.addPath(path[prefixSplit:], wildcards, inStaticToken) - } - } - - // No existing node starting with this letter, so create it. - child := &node{path: thisToken} - - if n.staticIndices == nil { - n.staticIndices = []byte{c} - n.staticChild = []*node{child} - } else { - n.staticIndices = append(n.staticIndices, c) - n.staticChild = append(n.staticChild, child) - } - return child.addPath(remainingPath, wildcards, inStaticToken) - } -} - -func (n *node) splitCommonPrefix(existingNodeIndex int, path string) (*node, int) { - childNode := n.staticChild[existingNodeIndex] - - if strings.HasPrefix(path, childNode.path) { - // No split needs to be done. Rather, the new path shares the entire - // prefix with the existing node, so the new node is just a child of - // the existing one. Or the new path is the same as the existing path, - // which means that we just move on to the next token. Either way, - // this return accomplishes that - return childNode, len(childNode.path) - } - - var i int - // Find the length of the common prefix of the child node and the new path. - for i = range childNode.path { - if i == len(path) { - break - } - if path[i] != childNode.path[i] { - break - } - } - - commonPrefix := path[0:i] - childNode.path = childNode.path[i:] - - // Create a new intermediary node in the place of the existing node, with - // the existing node as a child. - newNode := &node{ - path: commonPrefix, - priority: childNode.priority, - // Index is the first letter of the non-common part of the path. - staticIndices: []byte{childNode.path[0]}, - staticChild: []*node{childNode}, - } - n.staticChild[existingNodeIndex] = newNode - - return newNode, i -} - -func (n *node) search(method, path string) (found *node, handler HandlerFunc, params []string) { - // if test != nil { - // test.Logf("Searching for %s in %s", path, n.dumpTree("", "")) - // } - pathLen := len(path) - if pathLen == 0 { - if len(n.leafHandler) == 0 { - return nil, nil, nil - } else { - return n, n.leafHandler[method], nil - } - } - - // First see if this matches a static token. - firstChar := path[0] - for i, staticIndex := range n.staticIndices { - if staticIndex == firstChar { - child := n.staticChild[i] - childPathLen := len(child.path) - if pathLen >= childPathLen && child.path == path[:childPathLen] { - nextPath := path[childPathLen:] - found, handler, params = child.search(method, nextPath) - } - break - } - } - - // If we found a node and it had a valid handler, then return here. Otherwise - // let's remember that we found this one, but look for a better match. - if handler != nil { - return - } - - if n.wildcardChild != nil { - // Didn't find a static token, so check for a wildcard. - nextSlash := strings.IndexByte(path, '/') - if nextSlash < 0 { - nextSlash = pathLen - } - - thisToken := path[0:nextSlash] - nextToken := path[nextSlash:] - - if len(thisToken) > 0 { // Don't match on empty tokens. - wcNode, wcHandler, wcParams := n.wildcardChild.search(method, nextToken) - if wcHandler != nil || (found == nil && wcNode != nil) { - unescaped, err := unescape(thisToken) - if err != nil { - unescaped = thisToken - } - - if wcParams == nil { - wcParams = []string{unescaped} - } else { - wcParams = append(wcParams, unescaped) - } - - if wcHandler != nil { - return wcNode, wcHandler, wcParams - } - - // Didn't actually find a handler here, so remember that we - // found a node but also see if we can fall through to the - // catchall. - found = wcNode - handler = wcHandler - params = wcParams - } - } - } - - catchAllChild := n.catchAllChild - if catchAllChild != nil { - // Hit the catchall, so just assign the whole remaining path if it - // has a matching handler. - handler = catchAllChild.leafHandler[method] - // Found a handler, or we found a catchall node without a handler. - // Either way, return it since there's nothing left to check after this. - if handler != nil || found == nil { - unescaped, err := unescape(path) - if err != nil { - unescaped = path - } - - return catchAllChild, handler, []string{unescaped} - } - - } - - return found, handler, params -} - -func (n *node) dumpTree(prefix, nodeType string) string { - line := fmt.Sprintf("%s %02d %s%s [%d] %v wildcards %v\n", prefix, n.priority, nodeType, n.path, - len(n.staticChild), n.leafHandler, n.leafWildcardNames) - prefix += " " - for _, node := range n.staticChild { - line += node.dumpTree(prefix, "") - } - if n.wildcardChild != nil { - line += n.wildcardChild.dumpTree(prefix, ":") - } - if n.catchAllChild != nil { - line += n.catchAllChild.dumpTree(prefix, "*") - } - return line -} diff --git a/vendor/github.com/dimfeld/httptreemux/v5/treemux_16.go b/vendor/github.com/dimfeld/httptreemux/v5/treemux_16.go deleted file mode 100644 index 6bd5f2e97a..0000000000 --- a/vendor/github.com/dimfeld/httptreemux/v5/treemux_16.go +++ /dev/null @@ -1,86 +0,0 @@ -// +build !go1.7 - -package httptreemux - -import ( - "net/http" - "sync" -) - -type TreeMux struct { - root *node - mutex sync.RWMutex - - Group - - // The default PanicHandler just returns a 500 code. - PanicHandler PanicHandler - - // The default NotFoundHandler is http.NotFound. - NotFoundHandler func(w http.ResponseWriter, r *http.Request) - - // Any OPTIONS request that matches a path without its own OPTIONS handler will use this handler, - // if set, instead of calling MethodNotAllowedHandler. - OptionsHandler HandlerFunc - - // MethodNotAllowedHandler is called when a pattern matches, but that - // pattern does not have a handler for the requested method. The default - // handler just writes the status code http.StatusMethodNotAllowed and adds - // the required Allowed header. - // The methods parameter contains the map of each method to the corresponding - // handler function. - MethodNotAllowedHandler func(w http.ResponseWriter, r *http.Request, - methods map[string]HandlerFunc) - - // HeadCanUseGet allows the router to use the GET handler to respond to - // HEAD requests if no explicit HEAD handler has been added for the - // matching pattern. This is true by default. - HeadCanUseGet bool - - // RedirectCleanPath allows the router to try clean the current request path, - // if no handler is registered for it, using CleanPath from github.com/dimfeld/httppath. - // This is true by default. - RedirectCleanPath bool - - // RedirectTrailingSlash enables automatic redirection in case router doesn't find a matching route - // for the current request path but a handler for the path with or without the trailing - // slash exists. This is true by default. - RedirectTrailingSlash bool - - // RemoveCatchAllTrailingSlash removes the trailing slash when a catch-all pattern - // is matched, if set to true. By default, catch-all paths are never redirected. - RemoveCatchAllTrailingSlash bool - - // RedirectBehavior sets the default redirect behavior when RedirectTrailingSlash or - // RedirectCleanPath are true. The default value is Redirect301. - RedirectBehavior RedirectBehavior - - // RedirectMethodBehavior overrides the default behavior for a particular HTTP method. - // The key is the method name, and the value is the behavior to use for that method. - RedirectMethodBehavior map[string]RedirectBehavior - - // PathSource determines from where the router gets its path to search. - // By default it pulls the data from the RequestURI member, but this can - // be overridden to use URL.Path instead. - // - // There is a small tradeoff here. Using RequestURI allows the router to handle - // encoded slashes (i.e. %2f) in the URL properly, while URL.Path provides - // better compatibility with some utility functions in the http - // library that modify the Request before passing it to the router. - PathSource PathSource - - // EscapeAddedRoutes controls URI escaping behavior when adding a route to the tree. - // If set to true, the router will add both the route as originally passed, and - // a version passed through URL.EscapedPath. This behavior is disabled by default. - EscapeAddedRoutes bool - - // SafeAddRoutesWhileRunning tells the router to protect all accesses to the tree with an RWMutex. This is only needed - // if you are going to add routes after the router has already begun serving requests. There is a potential - // performance penalty at high load. - SafeAddRoutesWhileRunning bool -} - -func (t *TreeMux) setDefaultRequestContext(r *http.Request) *http.Request { - // Nothing to do on Go 1.6 and before - return r -} diff --git a/vendor/github.com/dimfeld/httptreemux/v5/treemux_17.go b/vendor/github.com/dimfeld/httptreemux/v5/treemux_17.go deleted file mode 100644 index 876c8d34c0..0000000000 --- a/vendor/github.com/dimfeld/httptreemux/v5/treemux_17.go +++ /dev/null @@ -1,152 +0,0 @@ -// +build go1.7 - -package httptreemux - -import ( - "context" - "net/http" - "sync" -) - -type TreeMux struct { - root *node - mutex sync.RWMutex - - Group - - // The default PanicHandler just returns a 500 code. - PanicHandler PanicHandler - - // The default NotFoundHandler is http.NotFound. - NotFoundHandler func(w http.ResponseWriter, r *http.Request) - - // Any OPTIONS request that matches a path without its own OPTIONS handler will use this handler, - // if set, instead of calling MethodNotAllowedHandler. - OptionsHandler HandlerFunc - - // MethodNotAllowedHandler is called when a pattern matches, but that - // pattern does not have a handler for the requested method. The default - // handler just writes the status code http.StatusMethodNotAllowed and adds - // the required Allowed header. - // The methods parameter contains the map of each method to the corresponding - // handler function. - MethodNotAllowedHandler func(w http.ResponseWriter, r *http.Request, - methods map[string]HandlerFunc) - - // HeadCanUseGet allows the router to use the GET handler to respond to - // HEAD requests if no explicit HEAD handler has been added for the - // matching pattern. This is true by default. - HeadCanUseGet bool - - // RedirectCleanPath allows the router to try clean the current request path, - // if no handler is registered for it, using CleanPath from github.com/dimfeld/httppath. - // This is true by default. - RedirectCleanPath bool - - // RedirectTrailingSlash enables automatic redirection in case router doesn't find a matching route - // for the current request path but a handler for the path with or without the trailing - // slash exists. This is true by default. - RedirectTrailingSlash bool - - // RemoveCatchAllTrailingSlash removes the trailing slash when a catch-all pattern - // is matched, if set to true. By default, catch-all paths are never redirected. - RemoveCatchAllTrailingSlash bool - - // RedirectBehavior sets the default redirect behavior when RedirectTrailingSlash or - // RedirectCleanPath are true. The default value is Redirect301. - RedirectBehavior RedirectBehavior - - // RedirectMethodBehavior overrides the default behavior for a particular HTTP method. - // The key is the method name, and the value is the behavior to use for that method. - RedirectMethodBehavior map[string]RedirectBehavior - - // PathSource determines from where the router gets its path to search. - // By default it pulls the data from the RequestURI member, but this can - // be overridden to use URL.Path instead. - // - // There is a small tradeoff here. Using RequestURI allows the router to handle - // encoded slashes (i.e. %2f) in the URL properly, while URL.Path provides - // better compatibility with some utility functions in the http - // library that modify the Request before passing it to the router. - PathSource PathSource - - // EscapeAddedRoutes controls URI escaping behavior when adding a route to the tree. - // If set to true, the router will add both the route as originally passed, and - // a version passed through URL.EscapedPath. This behavior is disabled by default. - EscapeAddedRoutes bool - - // If present, override the default context with this one. - DefaultContext context.Context - - // SafeAddRoutesWhileRunning tells the router to protect all accesses to the tree with an RWMutex. This is only needed - // if you are going to add routes after the router has already begun serving requests. There is a potential - // performance penalty at high load. - SafeAddRoutesWhileRunning bool - - // CaseInsensitive determines if routes should be treated as case-insensitive. - CaseInsensitive bool -} - -func (t *TreeMux) setDefaultRequestContext(r *http.Request) *http.Request { - if t.DefaultContext != nil { - r = r.WithContext(t.DefaultContext) - } - - return r -} - -type ContextMux struct { - *TreeMux - *ContextGroup -} - -// NewContextMux returns a TreeMux preconfigured to work with standard http -// Handler functions and context objects. -func NewContextMux() *ContextMux { - mux := New() - cg := mux.UsingContext() - - return &ContextMux{ - TreeMux: mux, - ContextGroup: cg, - } -} - -func (cm *ContextMux) NewGroup(path string) *ContextGroup { - return cm.ContextGroup.NewGroup(path) -} - -// GET is convenience method for handling GET requests on a context group. -func (cm *ContextMux) GET(path string, handler http.HandlerFunc) { - cm.ContextGroup.Handle("GET", path, handler) -} - -// POST is convenience method for handling POST requests on a context group. -func (cm *ContextMux) POST(path string, handler http.HandlerFunc) { - cm.ContextGroup.Handle("POST", path, handler) -} - -// PUT is convenience method for handling PUT requests on a context group. -func (cm *ContextMux) PUT(path string, handler http.HandlerFunc) { - cm.ContextGroup.Handle("PUT", path, handler) -} - -// DELETE is convenience method for handling DELETE requests on a context group. -func (cm *ContextMux) DELETE(path string, handler http.HandlerFunc) { - cm.ContextGroup.Handle("DELETE", path, handler) -} - -// PATCH is convenience method for handling PATCH requests on a context group. -func (cm *ContextMux) PATCH(path string, handler http.HandlerFunc) { - cm.ContextGroup.Handle("PATCH", path, handler) -} - -// HEAD is convenience method for handling HEAD requests on a context group. -func (cm *ContextMux) HEAD(path string, handler http.HandlerFunc) { - cm.ContextGroup.Handle("HEAD", path, handler) -} - -// OPTIONS is convenience method for handling OPTIONS requests on a context group. -func (cm *ContextMux) OPTIONS(path string, handler http.HandlerFunc) { - cm.ContextGroup.Handle("OPTIONS", path, handler) -} diff --git a/vendor/github.com/dimfeld/httptreemux/v5/unescape_17.go b/vendor/github.com/dimfeld/httptreemux/v5/unescape_17.go deleted file mode 100644 index 5d6d087875..0000000000 --- a/vendor/github.com/dimfeld/httptreemux/v5/unescape_17.go +++ /dev/null @@ -1,9 +0,0 @@ -// +build !go1.8 - -package httptreemux - -import "net/url" - -func unescape(path string) (string, error) { - return url.QueryUnescape(path) -} diff --git a/vendor/github.com/dimfeld/httptreemux/v5/unescape_18.go b/vendor/github.com/dimfeld/httptreemux/v5/unescape_18.go deleted file mode 100644 index 254dfcdd7f..0000000000 --- a/vendor/github.com/dimfeld/httptreemux/v5/unescape_18.go +++ /dev/null @@ -1,9 +0,0 @@ -// +build go1.8 - -package httptreemux - -import "net/url" - -func unescape(path string) (string, error) { - return url.PathUnescape(path) -} diff --git a/vendor/github.com/go-chi/chi/v5/.gitignore b/vendor/github.com/go-chi/chi/v5/.gitignore new file mode 100644 index 0000000000..ba22c99a99 --- /dev/null +++ b/vendor/github.com/go-chi/chi/v5/.gitignore @@ -0,0 +1,3 @@ +.idea +*.sw? +.vscode diff --git a/vendor/github.com/go-chi/chi/v5/CHANGELOG.md b/vendor/github.com/go-chi/chi/v5/CHANGELOG.md new file mode 100644 index 0000000000..f6eb7e6e40 --- /dev/null +++ b/vendor/github.com/go-chi/chi/v5/CHANGELOG.md @@ -0,0 +1,331 @@ +# Changelog + +## v5.0.10 (2023-07-13) + +- Fixed small edge case in tests of v5.0.9 for older Go versions +- History of changes: see https://github.com/go-chi/chi/compare/v5.0.8...v5.0.10 + + +## v5.0.9 (2023-07-13) + +- History of changes: see https://github.com/go-chi/chi/compare/v5.0.8...v5.0.9 + + +## v5.0.8 (2022-12-07) + +- History of changes: see https://github.com/go-chi/chi/compare/v5.0.7...v5.0.8 + + +## v5.0.7 (2021-11-18) + +- History of changes: see https://github.com/go-chi/chi/compare/v5.0.6...v5.0.7 + + +## v5.0.6 (2021-11-15) + +- History of changes: see https://github.com/go-chi/chi/compare/v5.0.5...v5.0.6 + + +## v5.0.5 (2021-10-27) + +- History of changes: see https://github.com/go-chi/chi/compare/v5.0.4...v5.0.5 + + +## v5.0.4 (2021-08-29) + +- History of changes: see https://github.com/go-chi/chi/compare/v5.0.3...v5.0.4 + + +## v5.0.3 (2021-04-29) + +- History of changes: see https://github.com/go-chi/chi/compare/v5.0.2...v5.0.3 + + +## v5.0.2 (2021-03-25) + +- History of changes: see https://github.com/go-chi/chi/compare/v5.0.1...v5.0.2 + + +## v5.0.1 (2021-03-10) + +- Small improvements +- History of changes: see https://github.com/go-chi/chi/compare/v5.0.0...v5.0.1 + + +## v5.0.0 (2021-02-27) + +- chi v5, `github.com/go-chi/chi/v5` introduces the adoption of Go's SIV to adhere to the current state-of-the-tools in Go. +- chi v1.5.x did not work out as planned, as the Go tooling is too powerful and chi's adoption is too wide. + The most responsible thing to do for everyone's benefit is to just release v5 with SIV, so I present to you all, + chi v5 at `github.com/go-chi/chi/v5`. I hope someday the developer experience and ergonomics I've been seeking + will still come to fruition in some form, see https://github.com/golang/go/issues/44550 +- History of changes: see https://github.com/go-chi/chi/compare/v1.5.4...v5.0.0 + + +## v1.5.4 (2021-02-27) + +- Undo prior retraction in v1.5.3 as we prepare for v5.0.0 release +- History of changes: see https://github.com/go-chi/chi/compare/v1.5.3...v1.5.4 + + +## v1.5.3 (2021-02-21) + +- Update go.mod to go 1.16 with new retract directive marking all versions without prior go.mod support +- History of changes: see https://github.com/go-chi/chi/compare/v1.5.2...v1.5.3 + + +## v1.5.2 (2021-02-10) + +- Reverting allocation optimization as a precaution as go test -race fails. +- Minor improvements, see history below +- History of changes: see https://github.com/go-chi/chi/compare/v1.5.1...v1.5.2 + + +## v1.5.1 (2020-12-06) + +- Performance improvement: removing 1 allocation by foregoing context.WithValue, thank you @bouk for + your contribution (https://github.com/go-chi/chi/pull/555). Note: new benchmarks posted in README. +- `middleware.CleanPath`: new middleware that clean's request path of double slashes +- deprecate & remove `chi.ServerBaseContext` in favour of stdlib `http.Server#BaseContext` +- plus other tiny improvements, see full commit history below +- History of changes: see https://github.com/go-chi/chi/compare/v4.1.2...v1.5.1 + + +## v1.5.0 (2020-11-12) - now with go.mod support + +`chi` dates back to 2016 with it's original implementation as one of the first routers to adopt the newly introduced +context.Context api to the stdlib -- set out to design a router that is faster, more modular and simpler than anything +else out there -- while not introducing any custom handler types or dependencies. Today, `chi` still has zero dependencies, +and in many ways is future proofed from changes, given it's minimal nature. Between versions, chi's iterations have been very +incremental, with the architecture and api being the same today as it was originally designed in 2016. For this reason it +makes chi a pretty easy project to maintain, as well thanks to the many amazing community contributions over the years +to who all help make chi better (total of 86 contributors to date -- thanks all!). + +Chi has been a labour of love, art and engineering, with the goals to offer beautiful ergonomics, flexibility, performance +and simplicity when building HTTP services with Go. I've strived to keep the router very minimal in surface area / code size, +and always improving the code wherever possible -- and as of today the `chi` package is just 1082 lines of code (not counting +middlewares, which are all optional). As well, I don't have the exact metrics, but from my analysis and email exchanges from +companies and developers, chi is used by thousands of projects around the world -- thank you all as there is no better form of +joy for me than to have art I had started be helpful and enjoyed by others. And of course I use chi in all of my own projects too :) + +For me, the aesthetics of chi's code and usage are very important. With the introduction of Go's module support +(which I'm a big fan of), chi's past versioning scheme choice to v2, v3 and v4 would mean I'd require the import path +of "github.com/go-chi/chi/v4", leading to the lengthy discussion at https://github.com/go-chi/chi/issues/462. +Haha, to some, you may be scratching your head why I've spent > 1 year stalling to adopt "/vXX" convention in the import +path -- which isn't horrible in general -- but for chi, I'm unable to accept it as I strive for perfection in it's API design, +aesthetics and simplicity. It just doesn't feel good to me given chi's simple nature -- I do not foresee a "v5" or "v6", +and upgrading between versions in the future will also be just incremental. + +I do understand versioning is a part of the API design as well, which is why the solution for a while has been to "do nothing", +as Go supports both old and new import paths with/out go.mod. However, now that Go module support has had time to iron out kinks and +is adopted everywhere, it's time for chi to get with the times. Luckily, I've discovered a path forward that will make me happy, +while also not breaking anyone's app who adopted a prior versioning from tags in v2/v3/v4. I've made an experimental release of +v1.5.0 with go.mod silently, and tested it with new and old projects, to ensure the developer experience is preserved, and it's +largely unnoticed. Fortunately, Go's toolchain will check the tags of a repo and consider the "latest" tag the one with go.mod. +However, you can still request a specific older tag such as v4.1.2, and everything will "just work". But new users can just +`go get github.com/go-chi/chi` or `go get github.com/go-chi/chi@latest` and they will get the latest version which contains +go.mod support, which is v1.5.0+. `chi` will not change very much over the years, just like it hasn't changed much from 4 years ago. +Therefore, we will stay on v1.x from here on, starting from v1.5.0. Any breaking changes will bump a "minor" release and +backwards-compatible improvements/fixes will bump a "tiny" release. + +For existing projects who want to upgrade to the latest go.mod version, run: `go get -u github.com/go-chi/chi@v1.5.0`, +which will get you on the go.mod version line (as Go's mod cache may still remember v4.x). Brand new systems can run +`go get -u github.com/go-chi/chi` or `go get -u github.com/go-chi/chi@latest` to install chi, which will install v1.5.0+ +built with go.mod support. + +My apologies to the developers who will disagree with the decisions above, but, hope you'll try it and see it's a very +minor request which is backwards compatible and won't break your existing installations. + +Cheers all, happy coding! + + +--- + + +## v4.1.2 (2020-06-02) + +- fix that handles MethodNotAllowed with path variables, thank you @caseyhadden for your contribution +- fix to replace nested wildcards correctly in RoutePattern, thank you @@unmultimedio for your contribution +- History of changes: see https://github.com/go-chi/chi/compare/v4.1.1...v4.1.2 + + +## v4.1.1 (2020-04-16) + +- fix for issue https://github.com/go-chi/chi/issues/411 which allows for overlapping regexp + route to the correct handler through a recursive tree search, thanks to @Jahaja for the PR/fix! +- new middleware.RouteHeaders as a simple router for request headers with wildcard support +- History of changes: see https://github.com/go-chi/chi/compare/v4.1.0...v4.1.1 + + +## v4.1.0 (2020-04-1) + +- middleware.LogEntry: Write method on interface now passes the response header + and an extra interface type useful for custom logger implementations. +- middleware.WrapResponseWriter: minor fix +- middleware.Recoverer: a bit prettier +- History of changes: see https://github.com/go-chi/chi/compare/v4.0.4...v4.1.0 + +## v4.0.4 (2020-03-24) + +- middleware.Recoverer: new pretty stack trace printing (https://github.com/go-chi/chi/pull/496) +- a few minor improvements and fixes +- History of changes: see https://github.com/go-chi/chi/compare/v4.0.3...v4.0.4 + + +## v4.0.3 (2020-01-09) + +- core: fix regexp routing to include default value when param is not matched +- middleware: rewrite of middleware.Compress +- middleware: suppress http.ErrAbortHandler in middleware.Recoverer +- History of changes: see https://github.com/go-chi/chi/compare/v4.0.2...v4.0.3 + + +## v4.0.2 (2019-02-26) + +- Minor fixes +- History of changes: see https://github.com/go-chi/chi/compare/v4.0.1...v4.0.2 + + +## v4.0.1 (2019-01-21) + +- Fixes issue with compress middleware: #382 #385 +- History of changes: see https://github.com/go-chi/chi/compare/v4.0.0...v4.0.1 + + +## v4.0.0 (2019-01-10) + +- chi v4 requires Go 1.10.3+ (or Go 1.9.7+) - we have deprecated support for Go 1.7 and 1.8 +- router: respond with 404 on router with no routes (#362) +- router: additional check to ensure wildcard is at the end of a url pattern (#333) +- middleware: deprecate use of http.CloseNotifier (#347) +- middleware: fix RedirectSlashes to include query params on redirect (#334) +- History of changes: see https://github.com/go-chi/chi/compare/v3.3.4...v4.0.0 + + +## v3.3.4 (2019-01-07) + +- Minor middleware improvements. No changes to core library/router. Moving v3 into its +- own branch as a version of chi for Go 1.7, 1.8, 1.9, 1.10, 1.11 +- History of changes: see https://github.com/go-chi/chi/compare/v3.3.3...v3.3.4 + + +## v3.3.3 (2018-08-27) + +- Minor release +- See https://github.com/go-chi/chi/compare/v3.3.2...v3.3.3 + + +## v3.3.2 (2017-12-22) + +- Support to route trailing slashes on mounted sub-routers (#281) +- middleware: new `ContentCharset` to check matching charsets. Thank you + @csucu for your community contribution! + + +## v3.3.1 (2017-11-20) + +- middleware: new `AllowContentType` handler for explicit whitelist of accepted request Content-Types +- middleware: new `SetHeader` handler for short-hand middleware to set a response header key/value +- Minor bug fixes + + +## v3.3.0 (2017-10-10) + +- New chi.RegisterMethod(method) to add support for custom HTTP methods, see _examples/custom-method for usage +- Deprecated LINK and UNLINK methods from the default list, please use `chi.RegisterMethod("LINK")` and `chi.RegisterMethod("UNLINK")` in an `init()` function + + +## v3.2.1 (2017-08-31) + +- Add new `Match(rctx *Context, method, path string) bool` method to `Routes` interface + and `Mux`. Match searches the mux's routing tree for a handler that matches the method/path +- Add new `RouteMethod` to `*Context` +- Add new `Routes` pointer to `*Context` +- Add new `middleware.GetHead` to route missing HEAD requests to GET handler +- Updated benchmarks (see README) + + +## v3.1.5 (2017-08-02) + +- Setup golint and go vet for the project +- As per golint, we've redefined `func ServerBaseContext(h http.Handler, baseCtx context.Context) http.Handler` + to `func ServerBaseContext(baseCtx context.Context, h http.Handler) http.Handler` + + +## v3.1.0 (2017-07-10) + +- Fix a few minor issues after v3 release +- Move `docgen` sub-pkg to https://github.com/go-chi/docgen +- Move `render` sub-pkg to https://github.com/go-chi/render +- Add new `URLFormat` handler to chi/middleware sub-pkg to make working with url mime + suffixes easier, ie. parsing `/articles/1.json` and `/articles/1.xml`. See comments in + https://github.com/go-chi/chi/blob/master/middleware/url_format.go for example usage. + + +## v3.0.0 (2017-06-21) + +- Major update to chi library with many exciting updates, but also some *breaking changes* +- URL parameter syntax changed from `/:id` to `/{id}` for even more flexible routing, such as + `/articles/{month}-{day}-{year}-{slug}`, `/articles/{id}`, and `/articles/{id}.{ext}` on the + same router +- Support for regexp for routing patterns, in the form of `/{paramKey:regExp}` for example: + `r.Get("/articles/{name:[a-z]+}", h)` and `chi.URLParam(r, "name")` +- Add `Method` and `MethodFunc` to `chi.Router` to allow routing definitions such as + `r.Method("GET", "/", h)` which provides a cleaner interface for custom handlers like + in `_examples/custom-handler` +- Deprecating `mux#FileServer` helper function. Instead, we encourage users to create their + own using file handler with the stdlib, see `_examples/fileserver` for an example +- Add support for LINK/UNLINK http methods via `r.Method()` and `r.MethodFunc()` +- Moved the chi project to its own organization, to allow chi-related community packages to + be easily discovered and supported, at: https://github.com/go-chi +- *NOTE:* please update your import paths to `"github.com/go-chi/chi"` +- *NOTE:* chi v2 is still available at https://github.com/go-chi/chi/tree/v2 + + +## v2.1.0 (2017-03-30) + +- Minor improvements and update to the chi core library +- Introduced a brand new `chi/render` sub-package to complete the story of building + APIs to offer a pattern for managing well-defined request / response payloads. Please + check out the updated `_examples/rest` example for how it works. +- Added `MethodNotAllowed(h http.HandlerFunc)` to chi.Router interface + + +## v2.0.0 (2017-01-06) + +- After many months of v2 being in an RC state with many companies and users running it in + production, the inclusion of some improvements to the middlewares, we are very pleased to + announce v2.0.0 of chi. + + +## v2.0.0-rc1 (2016-07-26) + +- Huge update! chi v2 is a large refactor targeting Go 1.7+. As of Go 1.7, the popular + community `"net/context"` package has been included in the standard library as `"context"` and + utilized by `"net/http"` and `http.Request` to managing deadlines, cancelation signals and other + request-scoped values. We're very excited about the new context addition and are proud to + introduce chi v2, a minimal and powerful routing package for building large HTTP services, + with zero external dependencies. Chi focuses on idiomatic design and encourages the use of + stdlib HTTP handlers and middlwares. +- chi v2 deprecates its `chi.Handler` interface and requires `http.Handler` or `http.HandlerFunc` +- chi v2 stores URL routing parameters and patterns in the standard request context: `r.Context()` +- chi v2 lower-level routing context is accessible by `chi.RouteContext(r.Context()) *chi.Context`, + which provides direct access to URL routing parameters, the routing path and the matching + routing patterns. +- Users upgrading from chi v1 to v2, need to: + 1. Update the old chi.Handler signature, `func(ctx context.Context, w http.ResponseWriter, r *http.Request)` to + the standard http.Handler: `func(w http.ResponseWriter, r *http.Request)` + 2. Use `chi.URLParam(r *http.Request, paramKey string) string` + or `URLParamFromCtx(ctx context.Context, paramKey string) string` to access a url parameter value + + +## v1.0.0 (2016-07-01) + +- Released chi v1 stable https://github.com/go-chi/chi/tree/v1.0.0 for Go 1.6 and older. + + +## v0.9.0 (2016-03-31) + +- Reuse context objects via sync.Pool for zero-allocation routing [#33](https://github.com/go-chi/chi/pull/33) +- BREAKING NOTE: due to subtle API changes, previously `chi.URLParams(ctx)["id"]` used to access url parameters + has changed to: `chi.URLParam(ctx, "id")` diff --git a/vendor/github.com/go-chi/chi/v5/CONTRIBUTING.md b/vendor/github.com/go-chi/chi/v5/CONTRIBUTING.md new file mode 100644 index 0000000000..c0ac2dfe85 --- /dev/null +++ b/vendor/github.com/go-chi/chi/v5/CONTRIBUTING.md @@ -0,0 +1,31 @@ +# Contributing + +## Prerequisites + +1. [Install Go][go-install]. +2. Download the sources and switch the working directory: + + ```bash + go get -u -d github.com/go-chi/chi + cd $GOPATH/src/github.com/go-chi/chi + ``` + +## Submitting a Pull Request + +A typical workflow is: + +1. [Fork the repository.][fork] [This tip maybe also helpful.][go-fork-tip] +2. [Create a topic branch.][branch] +3. Add tests for your change. +4. Run `go test`. If your tests pass, return to the step 3. +5. Implement the change and ensure the steps from the previous step pass. +6. Run `goimports -w .`, to ensure the new code conforms to Go formatting guideline. +7. [Add, commit and push your changes.][git-help] +8. [Submit a pull request.][pull-req] + +[go-install]: https://golang.org/doc/install +[go-fork-tip]: http://blog.campoy.cat/2014/03/github-and-go-forking-pull-requests-and.html +[fork]: https://help.github.com/articles/fork-a-repo +[branch]: http://learn.github.com/p/branching.html +[git-help]: https://guides.github.com +[pull-req]: https://help.github.com/articles/using-pull-requests diff --git a/vendor/github.com/go-chi/chi/v5/LICENSE b/vendor/github.com/go-chi/chi/v5/LICENSE new file mode 100644 index 0000000000..d99f02ffac --- /dev/null +++ b/vendor/github.com/go-chi/chi/v5/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2015-present Peter Kieltyka (https://github.com/pkieltyka), Google Inc. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/go-chi/chi/v5/Makefile b/vendor/github.com/go-chi/chi/v5/Makefile new file mode 100644 index 0000000000..e0f18c7da2 --- /dev/null +++ b/vendor/github.com/go-chi/chi/v5/Makefile @@ -0,0 +1,22 @@ +.PHONY: all +all: + @echo "**********************************************************" + @echo "** chi build tool **" + @echo "**********************************************************" + + +.PHONY: test +test: + go clean -testcache && $(MAKE) test-router && $(MAKE) test-middleware + +.PHONY: test-router +test-router: + go test -race -v . + +.PHONY: test-middleware +test-middleware: + go test -race -v ./middleware + +.PHONY: docs +docs: + npx docsify-cli serve ./docs diff --git a/vendor/github.com/go-chi/chi/v5/README.md b/vendor/github.com/go-chi/chi/v5/README.md new file mode 100644 index 0000000000..718e373fa0 --- /dev/null +++ b/vendor/github.com/go-chi/chi/v5/README.md @@ -0,0 +1,500 @@ +# chi + + +[![GoDoc Widget]][GoDoc] + +`chi` is a lightweight, idiomatic and composable router for building Go HTTP services. It's +especially good at helping you write large REST API services that are kept maintainable as your +project grows and changes. `chi` is built on the new `context` package introduced in Go 1.7 to +handle signaling, cancelation and request-scoped values across a handler chain. + +The focus of the project has been to seek out an elegant and comfortable design for writing +REST API servers, written during the development of the Pressly API service that powers our +public API service, which in turn powers all of our client-side applications. + +The key considerations of chi's design are: project structure, maintainability, standard http +handlers (stdlib-only), developer productivity, and deconstructing a large system into many small +parts. The core router `github.com/go-chi/chi` is quite small (less than 1000 LOC), but we've also +included some useful/optional subpackages: [middleware](/middleware), [render](https://github.com/go-chi/render) +and [docgen](https://github.com/go-chi/docgen). We hope you enjoy it too! + +## Install + +`go get -u github.com/go-chi/chi/v5` + + +## Features + +* **Lightweight** - cloc'd in ~1000 LOC for the chi router +* **Fast** - yes, see [benchmarks](#benchmarks) +* **100% compatible with net/http** - use any http or middleware pkg in the ecosystem that is also compatible with `net/http` +* **Designed for modular/composable APIs** - middlewares, inline middlewares, route groups and sub-router mounting +* **Context control** - built on new `context` package, providing value chaining, cancellations and timeouts +* **Robust** - in production at Pressly, Cloudflare, Heroku, 99Designs, and many others (see [discussion](https://github.com/go-chi/chi/issues/91)) +* **Doc generation** - `docgen` auto-generates routing documentation from your source to JSON or Markdown +* **Go.mod support** - as of v5, go.mod support (see [CHANGELOG](https://github.com/go-chi/chi/blob/master/CHANGELOG.md)) +* **No external dependencies** - plain ol' Go stdlib + net/http + + +## Examples + +See [_examples/](https://github.com/go-chi/chi/blob/master/_examples/) for a variety of examples. + + +**As easy as:** + +```go +package main + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + "github.com/go-chi/chi/v5/middleware" +) + +func main() { + r := chi.NewRouter() + r.Use(middleware.Logger) + r.Get("/", func(w http.ResponseWriter, r *http.Request) { + w.Write([]byte("welcome")) + }) + http.ListenAndServe(":3000", r) +} +``` + +**REST Preview:** + +Here is a little preview of how routing looks like with chi. Also take a look at the generated routing docs +in JSON ([routes.json](https://github.com/go-chi/chi/blob/master/_examples/rest/routes.json)) and in +Markdown ([routes.md](https://github.com/go-chi/chi/blob/master/_examples/rest/routes.md)). + +I highly recommend reading the source of the [examples](https://github.com/go-chi/chi/blob/master/_examples/) listed +above, they will show you all the features of chi and serve as a good form of documentation. + +```go +import ( + //... + "context" + "github.com/go-chi/chi/v5" + "github.com/go-chi/chi/v5/middleware" +) + +func main() { + r := chi.NewRouter() + + // A good base middleware stack + r.Use(middleware.RequestID) + r.Use(middleware.RealIP) + r.Use(middleware.Logger) + r.Use(middleware.Recoverer) + + // Set a timeout value on the request context (ctx), that will signal + // through ctx.Done() that the request has timed out and further + // processing should be stopped. + r.Use(middleware.Timeout(60 * time.Second)) + + r.Get("/", func(w http.ResponseWriter, r *http.Request) { + w.Write([]byte("hi")) + }) + + // RESTy routes for "articles" resource + r.Route("/articles", func(r chi.Router) { + r.With(paginate).Get("/", listArticles) // GET /articles + r.With(paginate).Get("/{month}-{day}-{year}", listArticlesByDate) // GET /articles/01-16-2017 + + r.Post("/", createArticle) // POST /articles + r.Get("/search", searchArticles) // GET /articles/search + + // Regexp url parameters: + r.Get("/{articleSlug:[a-z-]+}", getArticleBySlug) // GET /articles/home-is-toronto + + // Subrouters: + r.Route("/{articleID}", func(r chi.Router) { + r.Use(ArticleCtx) + r.Get("/", getArticle) // GET /articles/123 + r.Put("/", updateArticle) // PUT /articles/123 + r.Delete("/", deleteArticle) // DELETE /articles/123 + }) + }) + + // Mount the admin sub-router + r.Mount("/admin", adminRouter()) + + http.ListenAndServe(":3333", r) +} + +func ArticleCtx(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + articleID := chi.URLParam(r, "articleID") + article, err := dbGetArticle(articleID) + if err != nil { + http.Error(w, http.StatusText(404), 404) + return + } + ctx := context.WithValue(r.Context(), "article", article) + next.ServeHTTP(w, r.WithContext(ctx)) + }) +} + +func getArticle(w http.ResponseWriter, r *http.Request) { + ctx := r.Context() + article, ok := ctx.Value("article").(*Article) + if !ok { + http.Error(w, http.StatusText(422), 422) + return + } + w.Write([]byte(fmt.Sprintf("title:%s", article.Title))) +} + +// A completely separate router for administrator routes +func adminRouter() http.Handler { + r := chi.NewRouter() + r.Use(AdminOnly) + r.Get("/", adminIndex) + r.Get("/accounts", adminListAccounts) + return r +} + +func AdminOnly(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + ctx := r.Context() + perm, ok := ctx.Value("acl.permission").(YourPermissionType) + if !ok || !perm.IsAdmin() { + http.Error(w, http.StatusText(403), 403) + return + } + next.ServeHTTP(w, r) + }) +} +``` + + +## Router interface + +chi's router is based on a kind of [Patricia Radix trie](https://en.wikipedia.org/wiki/Radix_tree). +The router is fully compatible with `net/http`. + +Built on top of the tree is the `Router` interface: + +```go +// Router consisting of the core routing methods used by chi's Mux, +// using only the standard net/http. +type Router interface { + http.Handler + Routes + + // Use appends one or more middlewares onto the Router stack. + Use(middlewares ...func(http.Handler) http.Handler) + + // With adds inline middlewares for an endpoint handler. + With(middlewares ...func(http.Handler) http.Handler) Router + + // Group adds a new inline-Router along the current routing + // path, with a fresh middleware stack for the inline-Router. + Group(fn func(r Router)) Router + + // Route mounts a sub-Router along a `pattern`` string. + Route(pattern string, fn func(r Router)) Router + + // Mount attaches another http.Handler along ./pattern/* + Mount(pattern string, h http.Handler) + + // Handle and HandleFunc adds routes for `pattern` that matches + // all HTTP methods. + Handle(pattern string, h http.Handler) + HandleFunc(pattern string, h http.HandlerFunc) + + // Method and MethodFunc adds routes for `pattern` that matches + // the `method` HTTP method. + Method(method, pattern string, h http.Handler) + MethodFunc(method, pattern string, h http.HandlerFunc) + + // HTTP-method routing along `pattern` + Connect(pattern string, h http.HandlerFunc) + Delete(pattern string, h http.HandlerFunc) + Get(pattern string, h http.HandlerFunc) + Head(pattern string, h http.HandlerFunc) + Options(pattern string, h http.HandlerFunc) + Patch(pattern string, h http.HandlerFunc) + Post(pattern string, h http.HandlerFunc) + Put(pattern string, h http.HandlerFunc) + Trace(pattern string, h http.HandlerFunc) + + // NotFound defines a handler to respond whenever a route could + // not be found. + NotFound(h http.HandlerFunc) + + // MethodNotAllowed defines a handler to respond whenever a method is + // not allowed. + MethodNotAllowed(h http.HandlerFunc) +} + +// Routes interface adds two methods for router traversal, which is also +// used by the github.com/go-chi/docgen package to generate documentation for Routers. +type Routes interface { + // Routes returns the routing tree in an easily traversable structure. + Routes() []Route + + // Middlewares returns the list of middlewares in use by the router. + Middlewares() Middlewares + + // Match searches the routing tree for a handler that matches + // the method/path - similar to routing a http request, but without + // executing the handler thereafter. + Match(rctx *Context, method, path string) bool +} +``` + +Each routing method accepts a URL `pattern` and chain of `handlers`. The URL pattern +supports named params (ie. `/users/{userID}`) and wildcards (ie. `/admin/*`). URL parameters +can be fetched at runtime by calling `chi.URLParam(r, "userID")` for named parameters +and `chi.URLParam(r, "*")` for a wildcard parameter. + + +### Middleware handlers + +chi's middlewares are just stdlib net/http middleware handlers. There is nothing special +about them, which means the router and all the tooling is designed to be compatible and +friendly with any middleware in the community. This offers much better extensibility and reuse +of packages and is at the heart of chi's purpose. + +Here is an example of a standard net/http middleware where we assign a context key `"user"` +the value of `"123"`. This middleware sets a hypothetical user identifier on the request +context and calls the next handler in the chain. + +```go +// HTTP middleware setting a value on the request context +func MyMiddleware(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + // create new context from `r` request context, and assign key `"user"` + // to value of `"123"` + ctx := context.WithValue(r.Context(), "user", "123") + + // call the next handler in the chain, passing the response writer and + // the updated request object with the new context value. + // + // note: context.Context values are nested, so any previously set + // values will be accessible as well, and the new `"user"` key + // will be accessible from this point forward. + next.ServeHTTP(w, r.WithContext(ctx)) + }) +} +``` + + +### Request handlers + +chi uses standard net/http request handlers. This little snippet is an example of a http.Handler +func that reads a user identifier from the request context - hypothetically, identifying +the user sending an authenticated request, validated+set by a previous middleware handler. + +```go +// HTTP handler accessing data from the request context. +func MyRequestHandler(w http.ResponseWriter, r *http.Request) { + // here we read from the request context and fetch out `"user"` key set in + // the MyMiddleware example above. + user := r.Context().Value("user").(string) + + // respond to the client + w.Write([]byte(fmt.Sprintf("hi %s", user))) +} +``` + + +### URL parameters + +chi's router parses and stores URL parameters right onto the request context. Here is +an example of how to access URL params in your net/http handlers. And of course, middlewares +are able to access the same information. + +```go +// HTTP handler accessing the url routing parameters. +func MyRequestHandler(w http.ResponseWriter, r *http.Request) { + // fetch the url parameter `"userID"` from the request of a matching + // routing pattern. An example routing pattern could be: /users/{userID} + userID := chi.URLParam(r, "userID") + + // fetch `"key"` from the request context + ctx := r.Context() + key := ctx.Value("key").(string) + + // respond to the client + w.Write([]byte(fmt.Sprintf("hi %v, %v", userID, key))) +} +``` + + +## Middlewares + +chi comes equipped with an optional `middleware` package, providing a suite of standard +`net/http` middlewares. Please note, any middleware in the ecosystem that is also compatible +with `net/http` can be used with chi's mux. + +### Core middlewares + +---------------------------------------------------------------------------------------------------- +| chi/middleware Handler | description | +| :--------------------- | :---------------------------------------------------------------------- | +| [AllowContentEncoding] | Enforces a whitelist of request Content-Encoding headers | +| [AllowContentType] | Explicit whitelist of accepted request Content-Types | +| [BasicAuth] | Basic HTTP authentication | +| [Compress] | Gzip compression for clients that accept compressed responses | +| [ContentCharset] | Ensure charset for Content-Type request headers | +| [CleanPath] | Clean double slashes from request path | +| [GetHead] | Automatically route undefined HEAD requests to GET handlers | +| [Heartbeat] | Monitoring endpoint to check the servers pulse | +| [Logger] | Logs the start and end of each request with the elapsed processing time | +| [NoCache] | Sets response headers to prevent clients from caching | +| [Profiler] | Easily attach net/http/pprof to your routers | +| [RealIP] | Sets a http.Request's RemoteAddr to either X-Real-IP or X-Forwarded-For | +| [Recoverer] | Gracefully absorb panics and prints the stack trace | +| [RequestID] | Injects a request ID into the context of each request | +| [RedirectSlashes] | Redirect slashes on routing paths | +| [RouteHeaders] | Route handling for request headers | +| [SetHeader] | Short-hand middleware to set a response header key/value | +| [StripSlashes] | Strip slashes on routing paths | +| [Throttle] | Puts a ceiling on the number of concurrent requests | +| [Timeout] | Signals to the request context when the timeout deadline is reached | +| [URLFormat] | Parse extension from url and put it on request context | +| [WithValue] | Short-hand middleware to set a key/value on the request context | +---------------------------------------------------------------------------------------------------- + +[AllowContentEncoding]: https://pkg.go.dev/github.com/go-chi/chi/middleware#AllowContentEncoding +[AllowContentType]: https://pkg.go.dev/github.com/go-chi/chi/middleware#AllowContentType +[BasicAuth]: https://pkg.go.dev/github.com/go-chi/chi/middleware#BasicAuth +[Compress]: https://pkg.go.dev/github.com/go-chi/chi/middleware#Compress +[ContentCharset]: https://pkg.go.dev/github.com/go-chi/chi/middleware#ContentCharset +[CleanPath]: https://pkg.go.dev/github.com/go-chi/chi/middleware#CleanPath +[GetHead]: https://pkg.go.dev/github.com/go-chi/chi/middleware#GetHead +[GetReqID]: https://pkg.go.dev/github.com/go-chi/chi/middleware#GetReqID +[Heartbeat]: https://pkg.go.dev/github.com/go-chi/chi/middleware#Heartbeat +[Logger]: https://pkg.go.dev/github.com/go-chi/chi/middleware#Logger +[NoCache]: https://pkg.go.dev/github.com/go-chi/chi/middleware#NoCache +[Profiler]: https://pkg.go.dev/github.com/go-chi/chi/middleware#Profiler +[RealIP]: https://pkg.go.dev/github.com/go-chi/chi/middleware#RealIP +[Recoverer]: https://pkg.go.dev/github.com/go-chi/chi/middleware#Recoverer +[RedirectSlashes]: https://pkg.go.dev/github.com/go-chi/chi/middleware#RedirectSlashes +[RequestLogger]: https://pkg.go.dev/github.com/go-chi/chi/middleware#RequestLogger +[RequestID]: https://pkg.go.dev/github.com/go-chi/chi/middleware#RequestID +[RouteHeaders]: https://pkg.go.dev/github.com/go-chi/chi/middleware#RouteHeaders +[SetHeader]: https://pkg.go.dev/github.com/go-chi/chi/middleware#SetHeader +[StripSlashes]: https://pkg.go.dev/github.com/go-chi/chi/middleware#StripSlashes +[Throttle]: https://pkg.go.dev/github.com/go-chi/chi/middleware#Throttle +[ThrottleBacklog]: https://pkg.go.dev/github.com/go-chi/chi/middleware#ThrottleBacklog +[ThrottleWithOpts]: https://pkg.go.dev/github.com/go-chi/chi/middleware#ThrottleWithOpts +[Timeout]: https://pkg.go.dev/github.com/go-chi/chi/middleware#Timeout +[URLFormat]: https://pkg.go.dev/github.com/go-chi/chi/middleware#URLFormat +[WithLogEntry]: https://pkg.go.dev/github.com/go-chi/chi/middleware#WithLogEntry +[WithValue]: https://pkg.go.dev/github.com/go-chi/chi/middleware#WithValue +[Compressor]: https://pkg.go.dev/github.com/go-chi/chi/middleware#Compressor +[DefaultLogFormatter]: https://pkg.go.dev/github.com/go-chi/chi/middleware#DefaultLogFormatter +[EncoderFunc]: https://pkg.go.dev/github.com/go-chi/chi/middleware#EncoderFunc +[HeaderRoute]: https://pkg.go.dev/github.com/go-chi/chi/middleware#HeaderRoute +[HeaderRouter]: https://pkg.go.dev/github.com/go-chi/chi/middleware#HeaderRouter +[LogEntry]: https://pkg.go.dev/github.com/go-chi/chi/middleware#LogEntry +[LogFormatter]: https://pkg.go.dev/github.com/go-chi/chi/middleware#LogFormatter +[LoggerInterface]: https://pkg.go.dev/github.com/go-chi/chi/middleware#LoggerInterface +[ThrottleOpts]: https://pkg.go.dev/github.com/go-chi/chi/middleware#ThrottleOpts +[WrapResponseWriter]: https://pkg.go.dev/github.com/go-chi/chi/middleware#WrapResponseWriter + +### Extra middlewares & packages + +Please see https://github.com/go-chi for additional packages. + +-------------------------------------------------------------------------------------------------------------------- +| package | description | +|:---------------------------------------------------|:------------------------------------------------------------- +| [cors](https://github.com/go-chi/cors) | Cross-origin resource sharing (CORS) | +| [docgen](https://github.com/go-chi/docgen) | Print chi.Router routes at runtime | +| [jwtauth](https://github.com/go-chi/jwtauth) | JWT authentication | +| [hostrouter](https://github.com/go-chi/hostrouter) | Domain/host based request routing | +| [httplog](https://github.com/go-chi/httplog) | Small but powerful structured HTTP request logging | +| [httprate](https://github.com/go-chi/httprate) | HTTP request rate limiter | +| [httptracer](https://github.com/go-chi/httptracer) | HTTP request performance tracing library | +| [httpvcr](https://github.com/go-chi/httpvcr) | Write deterministic tests for external sources | +| [stampede](https://github.com/go-chi/stampede) | HTTP request coalescer | +-------------------------------------------------------------------------------------------------------------------- + + +## context? + +`context` is a tiny pkg that provides simple interface to signal context across call stacks +and goroutines. It was originally written by [Sameer Ajmani](https://github.com/Sajmani) +and is available in stdlib since go1.7. + +Learn more at https://blog.golang.org/context + +and.. +* Docs: https://golang.org/pkg/context +* Source: https://github.com/golang/go/tree/master/src/context + + +## Benchmarks + +The benchmark suite: https://github.com/pkieltyka/go-http-routing-benchmark + +Results as of Nov 29, 2020 with Go 1.15.5 on Linux AMD 3950x + +```shell +BenchmarkChi_Param 3075895 384 ns/op 400 B/op 2 allocs/op +BenchmarkChi_Param5 2116603 566 ns/op 400 B/op 2 allocs/op +BenchmarkChi_Param20 964117 1227 ns/op 400 B/op 2 allocs/op +BenchmarkChi_ParamWrite 2863413 420 ns/op 400 B/op 2 allocs/op +BenchmarkChi_GithubStatic 3045488 395 ns/op 400 B/op 2 allocs/op +BenchmarkChi_GithubParam 2204115 540 ns/op 400 B/op 2 allocs/op +BenchmarkChi_GithubAll 10000 113811 ns/op 81203 B/op 406 allocs/op +BenchmarkChi_GPlusStatic 3337485 359 ns/op 400 B/op 2 allocs/op +BenchmarkChi_GPlusParam 2825853 423 ns/op 400 B/op 2 allocs/op +BenchmarkChi_GPlus2Params 2471697 483 ns/op 400 B/op 2 allocs/op +BenchmarkChi_GPlusAll 194220 5950 ns/op 5200 B/op 26 allocs/op +BenchmarkChi_ParseStatic 3365324 356 ns/op 400 B/op 2 allocs/op +BenchmarkChi_ParseParam 2976614 404 ns/op 400 B/op 2 allocs/op +BenchmarkChi_Parse2Params 2638084 439 ns/op 400 B/op 2 allocs/op +BenchmarkChi_ParseAll 109567 11295 ns/op 10400 B/op 52 allocs/op +BenchmarkChi_StaticAll 16846 71308 ns/op 62802 B/op 314 allocs/op +``` + +Comparison with other routers: https://gist.github.com/pkieltyka/123032f12052520aaccab752bd3e78cc + +NOTE: the allocs in the benchmark above are from the calls to http.Request's +`WithContext(context.Context)` method that clones the http.Request, sets the `Context()` +on the duplicated (alloc'd) request and returns it the new request object. This is just +how setting context on a request in Go works. + + +## Credits + +* Carl Jackson for https://github.com/zenazn/goji + * Parts of chi's thinking comes from goji, and chi's middleware package + sources from goji. +* Armon Dadgar for https://github.com/armon/go-radix +* Contributions: [@VojtechVitek](https://github.com/VojtechVitek) + +We'll be more than happy to see [your contributions](./CONTRIBUTING.md)! + + +## Beyond REST + +chi is just a http router that lets you decompose request handling into many smaller layers. +Many companies use chi to write REST services for their public APIs. But, REST is just a convention +for managing state via HTTP, and there's a lot of other pieces required to write a complete client-server +system or network of microservices. + +Looking beyond REST, I also recommend some newer works in the field: +* [webrpc](https://github.com/webrpc/webrpc) - Web-focused RPC client+server framework with code-gen +* [gRPC](https://github.com/grpc/grpc-go) - Google's RPC framework via protobufs +* [graphql](https://github.com/99designs/gqlgen) - Declarative query language +* [NATS](https://nats.io) - lightweight pub-sub + + +## License + +Copyright (c) 2015-present [Peter Kieltyka](https://github.com/pkieltyka) + +Licensed under [MIT License](./LICENSE) + +[GoDoc]: https://pkg.go.dev/github.com/go-chi/chi?tab=versions +[GoDoc Widget]: https://godoc.org/github.com/go-chi/chi?status.svg +[Travis]: https://travis-ci.org/go-chi/chi +[Travis Widget]: https://travis-ci.org/go-chi/chi.svg?branch=master diff --git a/vendor/github.com/go-chi/chi/v5/chain.go b/vendor/github.com/go-chi/chi/v5/chain.go new file mode 100644 index 0000000000..a2278414f4 --- /dev/null +++ b/vendor/github.com/go-chi/chi/v5/chain.go @@ -0,0 +1,49 @@ +package chi + +import "net/http" + +// Chain returns a Middlewares type from a slice of middleware handlers. +func Chain(middlewares ...func(http.Handler) http.Handler) Middlewares { + return Middlewares(middlewares) +} + +// Handler builds and returns a http.Handler from the chain of middlewares, +// with `h http.Handler` as the final handler. +func (mws Middlewares) Handler(h http.Handler) http.Handler { + return &ChainHandler{h, chain(mws, h), mws} +} + +// HandlerFunc builds and returns a http.Handler from the chain of middlewares, +// with `h http.Handler` as the final handler. +func (mws Middlewares) HandlerFunc(h http.HandlerFunc) http.Handler { + return &ChainHandler{h, chain(mws, h), mws} +} + +// ChainHandler is a http.Handler with support for handler composition and +// execution. +type ChainHandler struct { + Endpoint http.Handler + chain http.Handler + Middlewares Middlewares +} + +func (c *ChainHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { + c.chain.ServeHTTP(w, r) +} + +// chain builds a http.Handler composed of an inline middleware stack and endpoint +// handler in the order they are passed. +func chain(middlewares []func(http.Handler) http.Handler, endpoint http.Handler) http.Handler { + // Return ahead of time if there aren't any middlewares for the chain + if len(middlewares) == 0 { + return endpoint + } + + // Wrap the end handler with the middleware chain + h := middlewares[len(middlewares)-1](endpoint) + for i := len(middlewares) - 2; i >= 0; i-- { + h = middlewares[i](h) + } + + return h +} diff --git a/vendor/github.com/go-chi/chi/v5/chi.go b/vendor/github.com/go-chi/chi/v5/chi.go new file mode 100644 index 0000000000..a1691bbeb1 --- /dev/null +++ b/vendor/github.com/go-chi/chi/v5/chi.go @@ -0,0 +1,134 @@ +// Package chi is a small, idiomatic and composable router for building HTTP services. +// +// chi requires Go 1.14 or newer. +// +// Example: +// +// package main +// +// import ( +// "net/http" +// +// "github.com/go-chi/chi/v5" +// "github.com/go-chi/chi/v5/middleware" +// ) +// +// func main() { +// r := chi.NewRouter() +// r.Use(middleware.Logger) +// r.Use(middleware.Recoverer) +// +// r.Get("/", func(w http.ResponseWriter, r *http.Request) { +// w.Write([]byte("root.")) +// }) +// +// http.ListenAndServe(":3333", r) +// } +// +// See github.com/go-chi/chi/_examples/ for more in-depth examples. +// +// URL patterns allow for easy matching of path components in HTTP +// requests. The matching components can then be accessed using +// chi.URLParam(). All patterns must begin with a slash. +// +// A simple named placeholder {name} matches any sequence of characters +// up to the next / or the end of the URL. Trailing slashes on paths must +// be handled explicitly. +// +// A placeholder with a name followed by a colon allows a regular +// expression match, for example {number:\\d+}. The regular expression +// syntax is Go's normal regexp RE2 syntax, except that regular expressions +// including { or } are not supported, and / will never be +// matched. An anonymous regexp pattern is allowed, using an empty string +// before the colon in the placeholder, such as {:\\d+} +// +// The special placeholder of asterisk matches the rest of the requested +// URL. Any trailing characters in the pattern are ignored. This is the only +// placeholder which will match / characters. +// +// Examples: +// +// "/user/{name}" matches "/user/jsmith" but not "/user/jsmith/info" or "/user/jsmith/" +// "/user/{name}/info" matches "/user/jsmith/info" +// "/page/*" matches "/page/intro/latest" +// "/page/{other}/index" also matches "/page/intro/latest" +// "/date/{yyyy:\\d\\d\\d\\d}/{mm:\\d\\d}/{dd:\\d\\d}" matches "/date/2017/04/01" +package chi + +import "net/http" + +// NewRouter returns a new Mux object that implements the Router interface. +func NewRouter() *Mux { + return NewMux() +} + +// Router consisting of the core routing methods used by chi's Mux, +// using only the standard net/http. +type Router interface { + http.Handler + Routes + + // Use appends one or more middlewares onto the Router stack. + Use(middlewares ...func(http.Handler) http.Handler) + + // With adds inline middlewares for an endpoint handler. + With(middlewares ...func(http.Handler) http.Handler) Router + + // Group adds a new inline-Router along the current routing + // path, with a fresh middleware stack for the inline-Router. + Group(fn func(r Router)) Router + + // Route mounts a sub-Router along a `pattern`` string. + Route(pattern string, fn func(r Router)) Router + + // Mount attaches another http.Handler along ./pattern/* + Mount(pattern string, h http.Handler) + + // Handle and HandleFunc adds routes for `pattern` that matches + // all HTTP methods. + Handle(pattern string, h http.Handler) + HandleFunc(pattern string, h http.HandlerFunc) + + // Method and MethodFunc adds routes for `pattern` that matches + // the `method` HTTP method. + Method(method, pattern string, h http.Handler) + MethodFunc(method, pattern string, h http.HandlerFunc) + + // HTTP-method routing along `pattern` + Connect(pattern string, h http.HandlerFunc) + Delete(pattern string, h http.HandlerFunc) + Get(pattern string, h http.HandlerFunc) + Head(pattern string, h http.HandlerFunc) + Options(pattern string, h http.HandlerFunc) + Patch(pattern string, h http.HandlerFunc) + Post(pattern string, h http.HandlerFunc) + Put(pattern string, h http.HandlerFunc) + Trace(pattern string, h http.HandlerFunc) + + // NotFound defines a handler to respond whenever a route could + // not be found. + NotFound(h http.HandlerFunc) + + // MethodNotAllowed defines a handler to respond whenever a method is + // not allowed. + MethodNotAllowed(h http.HandlerFunc) +} + +// Routes interface adds two methods for router traversal, which is also +// used by the `docgen` subpackage to generation documentation for Routers. +type Routes interface { + // Routes returns the routing tree in an easily traversable structure. + Routes() []Route + + // Middlewares returns the list of middlewares in use by the router. + Middlewares() Middlewares + + // Match searches the routing tree for a handler that matches + // the method/path - similar to routing a http request, but without + // executing the handler thereafter. + Match(rctx *Context, method, path string) bool +} + +// Middlewares type is a slice of standard middleware handlers with methods +// to compose middleware chains and http.Handler's. +type Middlewares []func(http.Handler) http.Handler diff --git a/vendor/github.com/go-chi/chi/v5/context.go b/vendor/github.com/go-chi/chi/v5/context.go new file mode 100644 index 0000000000..88f8e221a1 --- /dev/null +++ b/vendor/github.com/go-chi/chi/v5/context.go @@ -0,0 +1,160 @@ +package chi + +import ( + "context" + "net/http" + "strings" +) + +// URLParam returns the url parameter from a http.Request object. +func URLParam(r *http.Request, key string) string { + if rctx := RouteContext(r.Context()); rctx != nil { + return rctx.URLParam(key) + } + return "" +} + +// URLParamFromCtx returns the url parameter from a http.Request Context. +func URLParamFromCtx(ctx context.Context, key string) string { + if rctx := RouteContext(ctx); rctx != nil { + return rctx.URLParam(key) + } + return "" +} + +// RouteContext returns chi's routing Context object from a +// http.Request Context. +func RouteContext(ctx context.Context) *Context { + val, _ := ctx.Value(RouteCtxKey).(*Context) + return val +} + +// NewRouteContext returns a new routing Context object. +func NewRouteContext() *Context { + return &Context{} +} + +var ( + // RouteCtxKey is the context.Context key to store the request context. + RouteCtxKey = &contextKey{"RouteContext"} +) + +// Context is the default routing context set on the root node of a +// request context to track route patterns, URL parameters and +// an optional routing path. +type Context struct { + Routes Routes + + // parentCtx is the parent of this one, for using Context as a + // context.Context directly. This is an optimization that saves + // 1 allocation. + parentCtx context.Context + + // Routing path/method override used during the route search. + // See Mux#routeHTTP method. + RoutePath string + RouteMethod string + + // URLParams are the stack of routeParams captured during the + // routing lifecycle across a stack of sub-routers. + URLParams RouteParams + + // Route parameters matched for the current sub-router. It is + // intentionally unexported so it cant be tampered. + routeParams RouteParams + + // The endpoint routing pattern that matched the request URI path + // or `RoutePath` of the current sub-router. This value will update + // during the lifecycle of a request passing through a stack of + // sub-routers. + routePattern string + + // Routing pattern stack throughout the lifecycle of the request, + // across all connected routers. It is a record of all matching + // patterns across a stack of sub-routers. + RoutePatterns []string + + // methodNotAllowed hint + methodNotAllowed bool + methodsAllowed []methodTyp // allowed methods in case of a 405 +} + +// Reset a routing context to its initial state. +func (x *Context) Reset() { + x.Routes = nil + x.RoutePath = "" + x.RouteMethod = "" + x.RoutePatterns = x.RoutePatterns[:0] + x.URLParams.Keys = x.URLParams.Keys[:0] + x.URLParams.Values = x.URLParams.Values[:0] + + x.routePattern = "" + x.routeParams.Keys = x.routeParams.Keys[:0] + x.routeParams.Values = x.routeParams.Values[:0] + x.methodNotAllowed = false + x.parentCtx = nil +} + +// URLParam returns the corresponding URL parameter value from the request +// routing context. +func (x *Context) URLParam(key string) string { + for k := len(x.URLParams.Keys) - 1; k >= 0; k-- { + if x.URLParams.Keys[k] == key { + return x.URLParams.Values[k] + } + } + return "" +} + +// RoutePattern builds the routing pattern string for the particular +// request, at the particular point during routing. This means, the value +// will change throughout the execution of a request in a router. That is +// why its advised to only use this value after calling the next handler. +// +// For example, +// +// func Instrument(next http.Handler) http.Handler { +// return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { +// next.ServeHTTP(w, r) +// routePattern := chi.RouteContext(r.Context()).RoutePattern() +// measure(w, r, routePattern) +// }) +// } +func (x *Context) RoutePattern() string { + routePattern := strings.Join(x.RoutePatterns, "") + routePattern = replaceWildcards(routePattern) + routePattern = strings.TrimSuffix(routePattern, "//") + routePattern = strings.TrimSuffix(routePattern, "/") + return routePattern +} + +// replaceWildcards takes a route pattern and recursively replaces all +// occurrences of "/*/" to "/". +func replaceWildcards(p string) string { + if strings.Contains(p, "/*/") { + return replaceWildcards(strings.Replace(p, "/*/", "/", -1)) + } + return p +} + +// RouteParams is a structure to track URL routing parameters efficiently. +type RouteParams struct { + Keys, Values []string +} + +// Add will append a URL parameter to the end of the route param +func (s *RouteParams) Add(key, value string) { + s.Keys = append(s.Keys, key) + s.Values = append(s.Values, value) +} + +// contextKey is a value for use with context.WithValue. It's used as +// a pointer so it fits in an interface{} without allocation. This technique +// for defining context keys was copied from Go 1.7's new use of context in net/http. +type contextKey struct { + name string +} + +func (k *contextKey) String() string { + return "chi context value " + k.name +} diff --git a/vendor/github.com/go-chi/chi/v5/mux.go b/vendor/github.com/go-chi/chi/v5/mux.go new file mode 100644 index 0000000000..977aa52dd1 --- /dev/null +++ b/vendor/github.com/go-chi/chi/v5/mux.go @@ -0,0 +1,493 @@ +package chi + +import ( + "context" + "fmt" + "net/http" + "strings" + "sync" +) + +var _ Router = &Mux{} + +// Mux is a simple HTTP route multiplexer that parses a request path, +// records any URL params, and executes an end handler. It implements +// the http.Handler interface and is friendly with the standard library. +// +// Mux is designed to be fast, minimal and offer a powerful API for building +// modular and composable HTTP services with a large set of handlers. It's +// particularly useful for writing large REST API services that break a handler +// into many smaller parts composed of middlewares and end handlers. +type Mux struct { + // The computed mux handler made of the chained middleware stack and + // the tree router + handler http.Handler + + // The radix trie router + tree *node + + // Custom method not allowed handler + methodNotAllowedHandler http.HandlerFunc + + // A reference to the parent mux used by subrouters when mounting + // to a parent mux + parent *Mux + + // Routing context pool + pool *sync.Pool + + // Custom route not found handler + notFoundHandler http.HandlerFunc + + // The middleware stack + middlewares []func(http.Handler) http.Handler + + // Controls the behaviour of middleware chain generation when a mux + // is registered as an inline group inside another mux. + inline bool +} + +// NewMux returns a newly initialized Mux object that implements the Router +// interface. +func NewMux() *Mux { + mux := &Mux{tree: &node{}, pool: &sync.Pool{}} + mux.pool.New = func() interface{} { + return NewRouteContext() + } + return mux +} + +// ServeHTTP is the single method of the http.Handler interface that makes +// Mux interoperable with the standard library. It uses a sync.Pool to get and +// reuse routing contexts for each request. +func (mx *Mux) ServeHTTP(w http.ResponseWriter, r *http.Request) { + // Ensure the mux has some routes defined on the mux + if mx.handler == nil { + mx.NotFoundHandler().ServeHTTP(w, r) + return + } + + // Check if a routing context already exists from a parent router. + rctx, _ := r.Context().Value(RouteCtxKey).(*Context) + if rctx != nil { + mx.handler.ServeHTTP(w, r) + return + } + + // Fetch a RouteContext object from the sync pool, and call the computed + // mx.handler that is comprised of mx.middlewares + mx.routeHTTP. + // Once the request is finished, reset the routing context and put it back + // into the pool for reuse from another request. + rctx = mx.pool.Get().(*Context) + rctx.Reset() + rctx.Routes = mx + rctx.parentCtx = r.Context() + + // NOTE: r.WithContext() causes 2 allocations and context.WithValue() causes 1 allocation + r = r.WithContext(context.WithValue(r.Context(), RouteCtxKey, rctx)) + + // Serve the request and once its done, put the request context back in the sync pool + mx.handler.ServeHTTP(w, r) + mx.pool.Put(rctx) +} + +// Use appends a middleware handler to the Mux middleware stack. +// +// The middleware stack for any Mux will execute before searching for a matching +// route to a specific handler, which provides opportunity to respond early, +// change the course of the request execution, or set request-scoped values for +// the next http.Handler. +func (mx *Mux) Use(middlewares ...func(http.Handler) http.Handler) { + if mx.handler != nil { + panic("chi: all middlewares must be defined before routes on a mux") + } + mx.middlewares = append(mx.middlewares, middlewares...) +} + +// Handle adds the route `pattern` that matches any http method to +// execute the `handler` http.Handler. +func (mx *Mux) Handle(pattern string, handler http.Handler) { + mx.handle(mALL, pattern, handler) +} + +// HandleFunc adds the route `pattern` that matches any http method to +// execute the `handlerFn` http.HandlerFunc. +func (mx *Mux) HandleFunc(pattern string, handlerFn http.HandlerFunc) { + mx.handle(mALL, pattern, handlerFn) +} + +// Method adds the route `pattern` that matches `method` http method to +// execute the `handler` http.Handler. +func (mx *Mux) Method(method, pattern string, handler http.Handler) { + m, ok := methodMap[strings.ToUpper(method)] + if !ok { + panic(fmt.Sprintf("chi: '%s' http method is not supported.", method)) + } + mx.handle(m, pattern, handler) +} + +// MethodFunc adds the route `pattern` that matches `method` http method to +// execute the `handlerFn` http.HandlerFunc. +func (mx *Mux) MethodFunc(method, pattern string, handlerFn http.HandlerFunc) { + mx.Method(method, pattern, handlerFn) +} + +// Connect adds the route `pattern` that matches a CONNECT http method to +// execute the `handlerFn` http.HandlerFunc. +func (mx *Mux) Connect(pattern string, handlerFn http.HandlerFunc) { + mx.handle(mCONNECT, pattern, handlerFn) +} + +// Delete adds the route `pattern` that matches a DELETE http method to +// execute the `handlerFn` http.HandlerFunc. +func (mx *Mux) Delete(pattern string, handlerFn http.HandlerFunc) { + mx.handle(mDELETE, pattern, handlerFn) +} + +// Get adds the route `pattern` that matches a GET http method to +// execute the `handlerFn` http.HandlerFunc. +func (mx *Mux) Get(pattern string, handlerFn http.HandlerFunc) { + mx.handle(mGET, pattern, handlerFn) +} + +// Head adds the route `pattern` that matches a HEAD http method to +// execute the `handlerFn` http.HandlerFunc. +func (mx *Mux) Head(pattern string, handlerFn http.HandlerFunc) { + mx.handle(mHEAD, pattern, handlerFn) +} + +// Options adds the route `pattern` that matches an OPTIONS http method to +// execute the `handlerFn` http.HandlerFunc. +func (mx *Mux) Options(pattern string, handlerFn http.HandlerFunc) { + mx.handle(mOPTIONS, pattern, handlerFn) +} + +// Patch adds the route `pattern` that matches a PATCH http method to +// execute the `handlerFn` http.HandlerFunc. +func (mx *Mux) Patch(pattern string, handlerFn http.HandlerFunc) { + mx.handle(mPATCH, pattern, handlerFn) +} + +// Post adds the route `pattern` that matches a POST http method to +// execute the `handlerFn` http.HandlerFunc. +func (mx *Mux) Post(pattern string, handlerFn http.HandlerFunc) { + mx.handle(mPOST, pattern, handlerFn) +} + +// Put adds the route `pattern` that matches a PUT http method to +// execute the `handlerFn` http.HandlerFunc. +func (mx *Mux) Put(pattern string, handlerFn http.HandlerFunc) { + mx.handle(mPUT, pattern, handlerFn) +} + +// Trace adds the route `pattern` that matches a TRACE http method to +// execute the `handlerFn` http.HandlerFunc. +func (mx *Mux) Trace(pattern string, handlerFn http.HandlerFunc) { + mx.handle(mTRACE, pattern, handlerFn) +} + +// NotFound sets a custom http.HandlerFunc for routing paths that could +// not be found. The default 404 handler is `http.NotFound`. +func (mx *Mux) NotFound(handlerFn http.HandlerFunc) { + // Build NotFound handler chain + m := mx + hFn := handlerFn + if mx.inline && mx.parent != nil { + m = mx.parent + hFn = Chain(mx.middlewares...).HandlerFunc(hFn).ServeHTTP + } + + // Update the notFoundHandler from this point forward + m.notFoundHandler = hFn + m.updateSubRoutes(func(subMux *Mux) { + if subMux.notFoundHandler == nil { + subMux.NotFound(hFn) + } + }) +} + +// MethodNotAllowed sets a custom http.HandlerFunc for routing paths where the +// method is unresolved. The default handler returns a 405 with an empty body. +func (mx *Mux) MethodNotAllowed(handlerFn http.HandlerFunc) { + // Build MethodNotAllowed handler chain + m := mx + hFn := handlerFn + if mx.inline && mx.parent != nil { + m = mx.parent + hFn = Chain(mx.middlewares...).HandlerFunc(hFn).ServeHTTP + } + + // Update the methodNotAllowedHandler from this point forward + m.methodNotAllowedHandler = hFn + m.updateSubRoutes(func(subMux *Mux) { + if subMux.methodNotAllowedHandler == nil { + subMux.MethodNotAllowed(hFn) + } + }) +} + +// With adds inline middlewares for an endpoint handler. +func (mx *Mux) With(middlewares ...func(http.Handler) http.Handler) Router { + // Similarly as in handle(), we must build the mux handler once additional + // middleware registration isn't allowed for this stack, like now. + if !mx.inline && mx.handler == nil { + mx.updateRouteHandler() + } + + // Copy middlewares from parent inline muxs + var mws Middlewares + if mx.inline { + mws = make(Middlewares, len(mx.middlewares)) + copy(mws, mx.middlewares) + } + mws = append(mws, middlewares...) + + im := &Mux{ + pool: mx.pool, inline: true, parent: mx, tree: mx.tree, middlewares: mws, + notFoundHandler: mx.notFoundHandler, methodNotAllowedHandler: mx.methodNotAllowedHandler, + } + + return im +} + +// Group creates a new inline-Mux with a fresh middleware stack. It's useful +// for a group of handlers along the same routing path that use an additional +// set of middlewares. See _examples/. +func (mx *Mux) Group(fn func(r Router)) Router { + im := mx.With().(*Mux) + if fn != nil { + fn(im) + } + return im +} + +// Route creates a new Mux with a fresh middleware stack and mounts it +// along the `pattern` as a subrouter. Effectively, this is a short-hand +// call to Mount. See _examples/. +func (mx *Mux) Route(pattern string, fn func(r Router)) Router { + if fn == nil { + panic(fmt.Sprintf("chi: attempting to Route() a nil subrouter on '%s'", pattern)) + } + subRouter := NewRouter() + fn(subRouter) + mx.Mount(pattern, subRouter) + return subRouter +} + +// Mount attaches another http.Handler or chi Router as a subrouter along a routing +// path. It's very useful to split up a large API as many independent routers and +// compose them as a single service using Mount. See _examples/. +// +// Note that Mount() simply sets a wildcard along the `pattern` that will continue +// routing at the `handler`, which in most cases is another chi.Router. As a result, +// if you define two Mount() routes on the exact same pattern the mount will panic. +func (mx *Mux) Mount(pattern string, handler http.Handler) { + if handler == nil { + panic(fmt.Sprintf("chi: attempting to Mount() a nil handler on '%s'", pattern)) + } + + // Provide runtime safety for ensuring a pattern isn't mounted on an existing + // routing pattern. + if mx.tree.findPattern(pattern+"*") || mx.tree.findPattern(pattern+"/*") { + panic(fmt.Sprintf("chi: attempting to Mount() a handler on an existing path, '%s'", pattern)) + } + + // Assign sub-Router's with the parent not found & method not allowed handler if not specified. + subr, ok := handler.(*Mux) + if ok && subr.notFoundHandler == nil && mx.notFoundHandler != nil { + subr.NotFound(mx.notFoundHandler) + } + if ok && subr.methodNotAllowedHandler == nil && mx.methodNotAllowedHandler != nil { + subr.MethodNotAllowed(mx.methodNotAllowedHandler) + } + + mountHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + rctx := RouteContext(r.Context()) + + // shift the url path past the previous subrouter + rctx.RoutePath = mx.nextRoutePath(rctx) + + // reset the wildcard URLParam which connects the subrouter + n := len(rctx.URLParams.Keys) - 1 + if n >= 0 && rctx.URLParams.Keys[n] == "*" && len(rctx.URLParams.Values) > n { + rctx.URLParams.Values[n] = "" + } + + handler.ServeHTTP(w, r) + }) + + if pattern == "" || pattern[len(pattern)-1] != '/' { + mx.handle(mALL|mSTUB, pattern, mountHandler) + mx.handle(mALL|mSTUB, pattern+"/", mountHandler) + pattern += "/" + } + + method := mALL + subroutes, _ := handler.(Routes) + if subroutes != nil { + method |= mSTUB + } + n := mx.handle(method, pattern+"*", mountHandler) + + if subroutes != nil { + n.subroutes = subroutes + } +} + +// Routes returns a slice of routing information from the tree, +// useful for traversing available routes of a router. +func (mx *Mux) Routes() []Route { + return mx.tree.routes() +} + +// Middlewares returns a slice of middleware handler functions. +func (mx *Mux) Middlewares() Middlewares { + return mx.middlewares +} + +// Match searches the routing tree for a handler that matches the method/path. +// It's similar to routing a http request, but without executing the handler +// thereafter. +// +// Note: the *Context state is updated during execution, so manage +// the state carefully or make a NewRouteContext(). +func (mx *Mux) Match(rctx *Context, method, path string) bool { + m, ok := methodMap[method] + if !ok { + return false + } + + node, _, h := mx.tree.FindRoute(rctx, m, path) + + if node != nil && node.subroutes != nil { + rctx.RoutePath = mx.nextRoutePath(rctx) + return node.subroutes.Match(rctx, method, rctx.RoutePath) + } + + return h != nil +} + +// NotFoundHandler returns the default Mux 404 responder whenever a route +// cannot be found. +func (mx *Mux) NotFoundHandler() http.HandlerFunc { + if mx.notFoundHandler != nil { + return mx.notFoundHandler + } + return http.NotFound +} + +// MethodNotAllowedHandler returns the default Mux 405 responder whenever +// a method cannot be resolved for a route. +func (mx *Mux) MethodNotAllowedHandler(methodsAllowed ...methodTyp) http.HandlerFunc { + if mx.methodNotAllowedHandler != nil { + return mx.methodNotAllowedHandler + } + return methodNotAllowedHandler(methodsAllowed...) +} + +// handle registers a http.Handler in the routing tree for a particular http method +// and routing pattern. +func (mx *Mux) handle(method methodTyp, pattern string, handler http.Handler) *node { + if len(pattern) == 0 || pattern[0] != '/' { + panic(fmt.Sprintf("chi: routing pattern must begin with '/' in '%s'", pattern)) + } + + // Build the computed routing handler for this routing pattern. + if !mx.inline && mx.handler == nil { + mx.updateRouteHandler() + } + + // Build endpoint handler with inline middlewares for the route + var h http.Handler + if mx.inline { + mx.handler = http.HandlerFunc(mx.routeHTTP) + h = Chain(mx.middlewares...).Handler(handler) + } else { + h = handler + } + + // Add the endpoint to the tree and return the node + return mx.tree.InsertRoute(method, pattern, h) +} + +// routeHTTP routes a http.Request through the Mux routing tree to serve +// the matching handler for a particular http method. +func (mx *Mux) routeHTTP(w http.ResponseWriter, r *http.Request) { + // Grab the route context object + rctx := r.Context().Value(RouteCtxKey).(*Context) + + // The request routing path + routePath := rctx.RoutePath + if routePath == "" { + if r.URL.RawPath != "" { + routePath = r.URL.RawPath + } else { + routePath = r.URL.Path + } + if routePath == "" { + routePath = "/" + } + } + + // Check if method is supported by chi + if rctx.RouteMethod == "" { + rctx.RouteMethod = r.Method + } + method, ok := methodMap[rctx.RouteMethod] + if !ok { + mx.MethodNotAllowedHandler().ServeHTTP(w, r) + return + } + + // Find the route + if _, _, h := mx.tree.FindRoute(rctx, method, routePath); h != nil { + h.ServeHTTP(w, r) + return + } + if rctx.methodNotAllowed { + mx.MethodNotAllowedHandler(rctx.methodsAllowed...).ServeHTTP(w, r) + } else { + mx.NotFoundHandler().ServeHTTP(w, r) + } +} + +func (mx *Mux) nextRoutePath(rctx *Context) string { + routePath := "/" + nx := len(rctx.routeParams.Keys) - 1 // index of last param in list + if nx >= 0 && rctx.routeParams.Keys[nx] == "*" && len(rctx.routeParams.Values) > nx { + routePath = "/" + rctx.routeParams.Values[nx] + } + return routePath +} + +// Recursively update data on child routers. +func (mx *Mux) updateSubRoutes(fn func(subMux *Mux)) { + for _, r := range mx.tree.routes() { + subMux, ok := r.SubRoutes.(*Mux) + if !ok { + continue + } + fn(subMux) + } +} + +// updateRouteHandler builds the single mux handler that is a chain of the middleware +// stack, as defined by calls to Use(), and the tree router (Mux) itself. After this +// point, no other middlewares can be registered on this Mux's stack. But you can still +// compose additional middlewares via Group()'s or using a chained middleware handler. +func (mx *Mux) updateRouteHandler() { + mx.handler = chain(mx.middlewares, http.HandlerFunc(mx.routeHTTP)) +} + +// methodNotAllowedHandler is a helper function to respond with a 405, +// method not allowed. It sets the Allow header with the list of allowed +// methods for the route. +func methodNotAllowedHandler(methodsAllowed ...methodTyp) func(w http.ResponseWriter, r *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + for _, m := range methodsAllowed { + w.Header().Add("Allow", reverseMethodMap[m]) + } + w.WriteHeader(405) + w.Write(nil) + } +} diff --git a/vendor/github.com/go-chi/chi/v5/tree.go b/vendor/github.com/go-chi/chi/v5/tree.go new file mode 100644 index 0000000000..c7d3bc5704 --- /dev/null +++ b/vendor/github.com/go-chi/chi/v5/tree.go @@ -0,0 +1,892 @@ +package chi + +// Radix tree implementation below is a based on the original work by +// Armon Dadgar in https://github.com/armon/go-radix/blob/master/radix.go +// (MIT licensed). It's been heavily modified for use as a HTTP routing tree. + +import ( + "fmt" + "net/http" + "regexp" + "sort" + "strconv" + "strings" +) + +type methodTyp uint + +const ( + mSTUB methodTyp = 1 << iota + mCONNECT + mDELETE + mGET + mHEAD + mOPTIONS + mPATCH + mPOST + mPUT + mTRACE +) + +var mALL = mCONNECT | mDELETE | mGET | mHEAD | + mOPTIONS | mPATCH | mPOST | mPUT | mTRACE + +var methodMap = map[string]methodTyp{ + http.MethodConnect: mCONNECT, + http.MethodDelete: mDELETE, + http.MethodGet: mGET, + http.MethodHead: mHEAD, + http.MethodOptions: mOPTIONS, + http.MethodPatch: mPATCH, + http.MethodPost: mPOST, + http.MethodPut: mPUT, + http.MethodTrace: mTRACE, +} + +var reverseMethodMap = map[methodTyp]string{ + mCONNECT: http.MethodConnect, + mDELETE: http.MethodDelete, + mGET: http.MethodGet, + mHEAD: http.MethodHead, + mOPTIONS: http.MethodOptions, + mPATCH: http.MethodPatch, + mPOST: http.MethodPost, + mPUT: http.MethodPut, + mTRACE: http.MethodTrace, +} + +// RegisterMethod adds support for custom HTTP method handlers, available +// via Router#Method and Router#MethodFunc +func RegisterMethod(method string) { + if method == "" { + return + } + method = strings.ToUpper(method) + if _, ok := methodMap[method]; ok { + return + } + n := len(methodMap) + if n > strconv.IntSize-2 { + panic(fmt.Sprintf("chi: max number of methods reached (%d)", strconv.IntSize)) + } + mt := methodTyp(2 << n) + methodMap[method] = mt + mALL |= mt +} + +type nodeTyp uint8 + +const ( + ntStatic nodeTyp = iota // /home + ntRegexp // /{id:[0-9]+} + ntParam // /{user} + ntCatchAll // /api/v1/* +) + +type node struct { + // subroutes on the leaf node + subroutes Routes + + // regexp matcher for regexp nodes + rex *regexp.Regexp + + // HTTP handler endpoints on the leaf node + endpoints endpoints + + // prefix is the common prefix we ignore + prefix string + + // child nodes should be stored in-order for iteration, + // in groups of the node type. + children [ntCatchAll + 1]nodes + + // first byte of the child prefix + tail byte + + // node type: static, regexp, param, catchAll + typ nodeTyp + + // first byte of the prefix + label byte +} + +// endpoints is a mapping of http method constants to handlers +// for a given route. +type endpoints map[methodTyp]*endpoint + +type endpoint struct { + // endpoint handler + handler http.Handler + + // pattern is the routing pattern for handler nodes + pattern string + + // parameter keys recorded on handler nodes + paramKeys []string +} + +func (s endpoints) Value(method methodTyp) *endpoint { + mh, ok := s[method] + if !ok { + mh = &endpoint{} + s[method] = mh + } + return mh +} + +func (n *node) InsertRoute(method methodTyp, pattern string, handler http.Handler) *node { + var parent *node + search := pattern + + for { + // Handle key exhaustion + if len(search) == 0 { + // Insert or update the node's leaf handler + n.setEndpoint(method, handler, pattern) + return n + } + + // We're going to be searching for a wild node next, + // in this case, we need to get the tail + var label = search[0] + var segTail byte + var segEndIdx int + var segTyp nodeTyp + var segRexpat string + if label == '{' || label == '*' { + segTyp, _, segRexpat, segTail, _, segEndIdx = patNextSegment(search) + } + + var prefix string + if segTyp == ntRegexp { + prefix = segRexpat + } + + // Look for the edge to attach to + parent = n + n = n.getEdge(segTyp, label, segTail, prefix) + + // No edge, create one + if n == nil { + child := &node{label: label, tail: segTail, prefix: search} + hn := parent.addChild(child, search) + hn.setEndpoint(method, handler, pattern) + + return hn + } + + // Found an edge to match the pattern + + if n.typ > ntStatic { + // We found a param node, trim the param from the search path and continue. + // This param/wild pattern segment would already be on the tree from a previous + // call to addChild when creating a new node. + search = search[segEndIdx:] + continue + } + + // Static nodes fall below here. + // Determine longest prefix of the search key on match. + commonPrefix := longestPrefix(search, n.prefix) + if commonPrefix == len(n.prefix) { + // the common prefix is as long as the current node's prefix we're attempting to insert. + // keep the search going. + search = search[commonPrefix:] + continue + } + + // Split the node + child := &node{ + typ: ntStatic, + prefix: search[:commonPrefix], + } + parent.replaceChild(search[0], segTail, child) + + // Restore the existing node + n.label = n.prefix[commonPrefix] + n.prefix = n.prefix[commonPrefix:] + child.addChild(n, n.prefix) + + // If the new key is a subset, set the method/handler on this node and finish. + search = search[commonPrefix:] + if len(search) == 0 { + child.setEndpoint(method, handler, pattern) + return child + } + + // Create a new edge for the node + subchild := &node{ + typ: ntStatic, + label: search[0], + prefix: search, + } + hn := child.addChild(subchild, search) + hn.setEndpoint(method, handler, pattern) + return hn + } +} + +// addChild appends the new `child` node to the tree using the `pattern` as the trie key. +// For a URL router like chi's, we split the static, param, regexp and wildcard segments +// into different nodes. In addition, addChild will recursively call itself until every +// pattern segment is added to the url pattern tree as individual nodes, depending on type. +func (n *node) addChild(child *node, prefix string) *node { + search := prefix + + // handler leaf node added to the tree is the child. + // this may be overridden later down the flow + hn := child + + // Parse next segment + segTyp, _, segRexpat, segTail, segStartIdx, segEndIdx := patNextSegment(search) + + // Add child depending on next up segment + switch segTyp { + + case ntStatic: + // Search prefix is all static (that is, has no params in path) + // noop + + default: + // Search prefix contains a param, regexp or wildcard + + if segTyp == ntRegexp { + rex, err := regexp.Compile(segRexpat) + if err != nil { + panic(fmt.Sprintf("chi: invalid regexp pattern '%s' in route param", segRexpat)) + } + child.prefix = segRexpat + child.rex = rex + } + + if segStartIdx == 0 { + // Route starts with a param + child.typ = segTyp + + if segTyp == ntCatchAll { + segStartIdx = -1 + } else { + segStartIdx = segEndIdx + } + if segStartIdx < 0 { + segStartIdx = len(search) + } + child.tail = segTail // for params, we set the tail + + if segStartIdx != len(search) { + // add static edge for the remaining part, split the end. + // its not possible to have adjacent param nodes, so its certainly + // going to be a static node next. + + search = search[segStartIdx:] // advance search position + + nn := &node{ + typ: ntStatic, + label: search[0], + prefix: search, + } + hn = child.addChild(nn, search) + } + + } else if segStartIdx > 0 { + // Route has some param + + // starts with a static segment + child.typ = ntStatic + child.prefix = search[:segStartIdx] + child.rex = nil + + // add the param edge node + search = search[segStartIdx:] + + nn := &node{ + typ: segTyp, + label: search[0], + tail: segTail, + } + hn = child.addChild(nn, search) + + } + } + + n.children[child.typ] = append(n.children[child.typ], child) + n.children[child.typ].Sort() + return hn +} + +func (n *node) replaceChild(label, tail byte, child *node) { + for i := 0; i < len(n.children[child.typ]); i++ { + if n.children[child.typ][i].label == label && n.children[child.typ][i].tail == tail { + n.children[child.typ][i] = child + n.children[child.typ][i].label = label + n.children[child.typ][i].tail = tail + return + } + } + panic("chi: replacing missing child") +} + +func (n *node) getEdge(ntyp nodeTyp, label, tail byte, prefix string) *node { + nds := n.children[ntyp] + for i := 0; i < len(nds); i++ { + if nds[i].label == label && nds[i].tail == tail { + if ntyp == ntRegexp && nds[i].prefix != prefix { + continue + } + return nds[i] + } + } + return nil +} + +func (n *node) setEndpoint(method methodTyp, handler http.Handler, pattern string) { + // Set the handler for the method type on the node + if n.endpoints == nil { + n.endpoints = make(endpoints) + } + + paramKeys := patParamKeys(pattern) + + if method&mSTUB == mSTUB { + n.endpoints.Value(mSTUB).handler = handler + } + if method&mALL == mALL { + h := n.endpoints.Value(mALL) + h.handler = handler + h.pattern = pattern + h.paramKeys = paramKeys + for _, m := range methodMap { + h := n.endpoints.Value(m) + h.handler = handler + h.pattern = pattern + h.paramKeys = paramKeys + } + } else { + h := n.endpoints.Value(method) + h.handler = handler + h.pattern = pattern + h.paramKeys = paramKeys + } +} + +func (n *node) FindRoute(rctx *Context, method methodTyp, path string) (*node, endpoints, http.Handler) { + // Reset the context routing pattern and params + rctx.routePattern = "" + rctx.routeParams.Keys = rctx.routeParams.Keys[:0] + rctx.routeParams.Values = rctx.routeParams.Values[:0] + + // Find the routing handlers for the path + rn := n.findRoute(rctx, method, path) + if rn == nil { + return nil, nil, nil + } + + // Record the routing params in the request lifecycle + rctx.URLParams.Keys = append(rctx.URLParams.Keys, rctx.routeParams.Keys...) + rctx.URLParams.Values = append(rctx.URLParams.Values, rctx.routeParams.Values...) + + // Record the routing pattern in the request lifecycle + if rn.endpoints[method].pattern != "" { + rctx.routePattern = rn.endpoints[method].pattern + rctx.RoutePatterns = append(rctx.RoutePatterns, rctx.routePattern) + } + + return rn, rn.endpoints, rn.endpoints[method].handler +} + +// Recursive edge traversal by checking all nodeTyp groups along the way. +// It's like searching through a multi-dimensional radix trie. +func (n *node) findRoute(rctx *Context, method methodTyp, path string) *node { + nn := n + search := path + + for t, nds := range nn.children { + ntyp := nodeTyp(t) + if len(nds) == 0 { + continue + } + + var xn *node + xsearch := search + + var label byte + if search != "" { + label = search[0] + } + + switch ntyp { + case ntStatic: + xn = nds.findEdge(label) + if xn == nil || !strings.HasPrefix(xsearch, xn.prefix) { + continue + } + xsearch = xsearch[len(xn.prefix):] + + case ntParam, ntRegexp: + // short-circuit and return no matching route for empty param values + if xsearch == "" { + continue + } + + // serially loop through each node grouped by the tail delimiter + for idx := 0; idx < len(nds); idx++ { + xn = nds[idx] + + // label for param nodes is the delimiter byte + p := strings.IndexByte(xsearch, xn.tail) + + if p < 0 { + if xn.tail == '/' { + p = len(xsearch) + } else { + continue + } + } else if ntyp == ntRegexp && p == 0 { + continue + } + + if ntyp == ntRegexp && xn.rex != nil { + if !xn.rex.MatchString(xsearch[:p]) { + continue + } + } else if strings.IndexByte(xsearch[:p], '/') != -1 { + // avoid a match across path segments + continue + } + + prevlen := len(rctx.routeParams.Values) + rctx.routeParams.Values = append(rctx.routeParams.Values, xsearch[:p]) + xsearch = xsearch[p:] + + if len(xsearch) == 0 { + if xn.isLeaf() { + h := xn.endpoints[method] + if h != nil && h.handler != nil { + rctx.routeParams.Keys = append(rctx.routeParams.Keys, h.paramKeys...) + return xn + } + + for endpoints := range xn.endpoints { + if endpoints == mALL || endpoints == mSTUB { + continue + } + rctx.methodsAllowed = append(rctx.methodsAllowed, endpoints) + } + + // flag that the routing context found a route, but not a corresponding + // supported method + rctx.methodNotAllowed = true + } + } + + // recursively find the next node on this branch + fin := xn.findRoute(rctx, method, xsearch) + if fin != nil { + return fin + } + + // not found on this branch, reset vars + rctx.routeParams.Values = rctx.routeParams.Values[:prevlen] + xsearch = search + } + + rctx.routeParams.Values = append(rctx.routeParams.Values, "") + + default: + // catch-all nodes + rctx.routeParams.Values = append(rctx.routeParams.Values, search) + xn = nds[0] + xsearch = "" + } + + if xn == nil { + continue + } + + // did we find it yet? + if len(xsearch) == 0 { + if xn.isLeaf() { + h := xn.endpoints[method] + if h != nil && h.handler != nil { + rctx.routeParams.Keys = append(rctx.routeParams.Keys, h.paramKeys...) + return xn + } + + for endpoints := range xn.endpoints { + if endpoints == mALL || endpoints == mSTUB { + continue + } + rctx.methodsAllowed = append(rctx.methodsAllowed, endpoints) + } + + // flag that the routing context found a route, but not a corresponding + // supported method + rctx.methodNotAllowed = true + } + } + + // recursively find the next node.. + fin := xn.findRoute(rctx, method, xsearch) + if fin != nil { + return fin + } + + // Did not find final handler, let's remove the param here if it was set + if xn.typ > ntStatic { + if len(rctx.routeParams.Values) > 0 { + rctx.routeParams.Values = rctx.routeParams.Values[:len(rctx.routeParams.Values)-1] + } + } + + } + + return nil +} + +func (n *node) findEdge(ntyp nodeTyp, label byte) *node { + nds := n.children[ntyp] + num := len(nds) + idx := 0 + + switch ntyp { + case ntStatic, ntParam, ntRegexp: + i, j := 0, num-1 + for i <= j { + idx = i + (j-i)/2 + if label > nds[idx].label { + i = idx + 1 + } else if label < nds[idx].label { + j = idx - 1 + } else { + i = num // breaks cond + } + } + if nds[idx].label != label { + return nil + } + return nds[idx] + + default: // catch all + return nds[idx] + } +} + +func (n *node) isLeaf() bool { + return n.endpoints != nil +} + +func (n *node) findPattern(pattern string) bool { + nn := n + for _, nds := range nn.children { + if len(nds) == 0 { + continue + } + + n = nn.findEdge(nds[0].typ, pattern[0]) + if n == nil { + continue + } + + var idx int + var xpattern string + + switch n.typ { + case ntStatic: + idx = longestPrefix(pattern, n.prefix) + if idx < len(n.prefix) { + continue + } + + case ntParam, ntRegexp: + idx = strings.IndexByte(pattern, '}') + 1 + + case ntCatchAll: + idx = longestPrefix(pattern, "*") + + default: + panic("chi: unknown node type") + } + + xpattern = pattern[idx:] + if len(xpattern) == 0 { + return true + } + + return n.findPattern(xpattern) + } + return false +} + +func (n *node) routes() []Route { + rts := []Route{} + + n.walk(func(eps endpoints, subroutes Routes) bool { + if eps[mSTUB] != nil && eps[mSTUB].handler != nil && subroutes == nil { + return false + } + + // Group methodHandlers by unique patterns + pats := make(map[string]endpoints) + + for mt, h := range eps { + if h.pattern == "" { + continue + } + p, ok := pats[h.pattern] + if !ok { + p = endpoints{} + pats[h.pattern] = p + } + p[mt] = h + } + + for p, mh := range pats { + hs := make(map[string]http.Handler) + if mh[mALL] != nil && mh[mALL].handler != nil { + hs["*"] = mh[mALL].handler + } + + for mt, h := range mh { + if h.handler == nil { + continue + } + m := methodTypString(mt) + if m == "" { + continue + } + hs[m] = h.handler + } + + rt := Route{subroutes, hs, p} + rts = append(rts, rt) + } + + return false + }) + + return rts +} + +func (n *node) walk(fn func(eps endpoints, subroutes Routes) bool) bool { + // Visit the leaf values if any + if (n.endpoints != nil || n.subroutes != nil) && fn(n.endpoints, n.subroutes) { + return true + } + + // Recurse on the children + for _, ns := range n.children { + for _, cn := range ns { + if cn.walk(fn) { + return true + } + } + } + return false +} + +// patNextSegment returns the next segment details from a pattern: +// node type, param key, regexp string, param tail byte, param starting index, param ending index +func patNextSegment(pattern string) (nodeTyp, string, string, byte, int, int) { + ps := strings.Index(pattern, "{") + ws := strings.Index(pattern, "*") + + if ps < 0 && ws < 0 { + return ntStatic, "", "", 0, 0, len(pattern) // we return the entire thing + } + + // Sanity check + if ps >= 0 && ws >= 0 && ws < ps { + panic("chi: wildcard '*' must be the last pattern in a route, otherwise use a '{param}'") + } + + var tail byte = '/' // Default endpoint tail to / byte + + if ps >= 0 { + // Param/Regexp pattern is next + nt := ntParam + + // Read to closing } taking into account opens and closes in curl count (cc) + cc := 0 + pe := ps + for i, c := range pattern[ps:] { + if c == '{' { + cc++ + } else if c == '}' { + cc-- + if cc == 0 { + pe = ps + i + break + } + } + } + if pe == ps { + panic("chi: route param closing delimiter '}' is missing") + } + + key := pattern[ps+1 : pe] + pe++ // set end to next position + + if pe < len(pattern) { + tail = pattern[pe] + } + + var rexpat string + if idx := strings.Index(key, ":"); idx >= 0 { + nt = ntRegexp + rexpat = key[idx+1:] + key = key[:idx] + } + + if len(rexpat) > 0 { + if rexpat[0] != '^' { + rexpat = "^" + rexpat + } + if rexpat[len(rexpat)-1] != '$' { + rexpat += "$" + } + } + + return nt, key, rexpat, tail, ps, pe + } + + // Wildcard pattern as finale + if ws < len(pattern)-1 { + panic("chi: wildcard '*' must be the last value in a route. trim trailing text or use a '{param}' instead") + } + return ntCatchAll, "*", "", 0, ws, len(pattern) +} + +func patParamKeys(pattern string) []string { + pat := pattern + paramKeys := []string{} + for { + ptyp, paramKey, _, _, _, e := patNextSegment(pat) + if ptyp == ntStatic { + return paramKeys + } + for i := 0; i < len(paramKeys); i++ { + if paramKeys[i] == paramKey { + panic(fmt.Sprintf("chi: routing pattern '%s' contains duplicate param key, '%s'", pattern, paramKey)) + } + } + paramKeys = append(paramKeys, paramKey) + pat = pat[e:] + } +} + +// longestPrefix finds the length of the shared prefix +// of two strings +func longestPrefix(k1, k2 string) int { + max := len(k1) + if l := len(k2); l < max { + max = l + } + var i int + for i = 0; i < max; i++ { + if k1[i] != k2[i] { + break + } + } + return i +} + +func methodTypString(method methodTyp) string { + for s, t := range methodMap { + if method == t { + return s + } + } + return "" +} + +type nodes []*node + +// Sort the list of nodes by label +func (ns nodes) Sort() { sort.Sort(ns); ns.tailSort() } +func (ns nodes) Len() int { return len(ns) } +func (ns nodes) Swap(i, j int) { ns[i], ns[j] = ns[j], ns[i] } +func (ns nodes) Less(i, j int) bool { return ns[i].label < ns[j].label } + +// tailSort pushes nodes with '/' as the tail to the end of the list for param nodes. +// The list order determines the traversal order. +func (ns nodes) tailSort() { + for i := len(ns) - 1; i >= 0; i-- { + if ns[i].typ > ntStatic && ns[i].tail == '/' { + ns.Swap(i, len(ns)-1) + return + } + } +} + +func (ns nodes) findEdge(label byte) *node { + num := len(ns) + idx := 0 + i, j := 0, num-1 + for i <= j { + idx = i + (j-i)/2 + if label > ns[idx].label { + i = idx + 1 + } else if label < ns[idx].label { + j = idx - 1 + } else { + i = num // breaks cond + } + } + if ns[idx].label != label { + return nil + } + return ns[idx] +} + +// Route describes the details of a routing handler. +// Handlers map key is an HTTP method +type Route struct { + SubRoutes Routes + Handlers map[string]http.Handler + Pattern string +} + +// WalkFunc is the type of the function called for each method and route visited by Walk. +type WalkFunc func(method string, route string, handler http.Handler, middlewares ...func(http.Handler) http.Handler) error + +// Walk walks any router tree that implements Routes interface. +func Walk(r Routes, walkFn WalkFunc) error { + return walk(r, walkFn, "") +} + +func walk(r Routes, walkFn WalkFunc, parentRoute string, parentMw ...func(http.Handler) http.Handler) error { + for _, route := range r.Routes() { + mws := make([]func(http.Handler) http.Handler, len(parentMw)) + copy(mws, parentMw) + mws = append(mws, r.Middlewares()...) + + if route.SubRoutes != nil { + if err := walk(route.SubRoutes, walkFn, parentRoute+route.Pattern, mws...); err != nil { + return err + } + continue + } + + for method, handler := range route.Handlers { + if method == "*" { + // Ignore a "catchAll" method, since we pass down all the specific methods for each route. + continue + } + + fullRoute := parentRoute + route.Pattern + fullRoute = strings.Replace(fullRoute, "/*/", "/", -1) + + if chain, ok := handler.(*ChainHandler); ok { + if err := walkFn(method, fullRoute, chain.Endpoint, append(mws, chain.Middlewares...)...); err != nil { + return err + } + } else { + if err := walkFn(method, fullRoute, handler, mws...); err != nil { + return err + } + } + } + } + + return nil +} diff --git a/vendor/github.com/go-openapi/swag/util.go b/vendor/github.com/go-openapi/swag/util.go index f78ab684a0..d971fbe34b 100644 --- a/vendor/github.com/go-openapi/swag/util.go +++ b/vendor/github.com/go-openapi/swag/util.go @@ -341,12 +341,21 @@ type zeroable interface { // IsZero returns true when the value passed into the function is a zero value. // This allows for safer checking of interface values. func IsZero(data interface{}) bool { + v := reflect.ValueOf(data) + // check for nil data + switch v.Kind() { + case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: + if v.IsNil() { + return true + } + } + // check for things that have an IsZero method instead if vv, ok := data.(zeroable); ok { return vv.IsZero() } + // continue with slightly more complex reflection - v := reflect.ValueOf(data) switch v.Kind() { case reflect.String: return v.Len() == 0 @@ -358,14 +367,13 @@ func IsZero(data interface{}) bool { return v.Uint() == 0 case reflect.Float32, reflect.Float64: return v.Float() == 0 - case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: - return v.IsNil() case reflect.Struct, reflect.Array: return reflect.DeepEqual(data, reflect.Zero(v.Type()).Interface()) case reflect.Invalid: return true + default: + return false } - return false } // AddInitialisms add additional initialisms diff --git a/vendor/goa.design/goa/v3/codegen/cli/cli.go b/vendor/goa.design/goa/v3/codegen/cli/cli.go index 75541ffa03..3c3fc0f9c3 100644 --- a/vendor/goa.design/goa/v3/codegen/cli/cli.go +++ b/vendor/goa.design/goa/v3/codegen/cli/cli.go @@ -446,7 +446,7 @@ func jsonExample(v any) string { ex = string(b) } if strings.Contains(ex, "\n") { - ex = "'" + strings.Replace(ex, "'", "\\'", -1) + "'" + ex = "'" + strings.ReplaceAll(ex, "'", "\\'") + "'" } return ex } @@ -556,8 +556,8 @@ func goifyTerms(terms ...string) string { } func printDescription(desc string) string { - res := strings.Replace(desc, "`", "`+\"`\"+`", -1) - res = strings.Replace(res, "\n", "\n\t", -1) + res := strings.ReplaceAll(desc, "`", "`+\"`\"+`") + res = strings.ReplaceAll(res, "\n", "\n\t") return res } @@ -580,7 +580,7 @@ func fieldCode(init *PayloadInitData) string { // because the args cannot be user types. c, _, err := codegen.InitStructFields(init.Args, varn, "", init.ReturnTypePkg) if err != nil { - panic(err) //bug + panic(err) // bug } return c } diff --git a/vendor/goa.design/goa/v3/codegen/example/example_cli.go b/vendor/goa.design/goa/v3/codegen/example/example_cli.go index 05c28de597..ffef0f6015 100644 --- a/vendor/goa.design/goa/v3/codegen/example/example_cli.go +++ b/vendor/goa.design/goa/v3/codegen/example/example_cli.go @@ -23,7 +23,7 @@ func CLIFiles(genpkg string, root *expr.RootExpr) []*codegen.File { // exampleCLIMain returns an example client tool main implementation for the // given server expression. -func exampleCLIMain(genpkg string, root *expr.RootExpr, svr *expr.ServerExpr) *codegen.File { +func exampleCLIMain(_ string, root *expr.RootExpr, svr *expr.ServerExpr) *codegen.File { svrdata := Servers.Get(svr) path := filepath.Join("cmd", svrdata.Dir+"-cli", "main.go") diff --git a/vendor/goa.design/goa/v3/codegen/file.go b/vendor/goa.design/goa/v3/codegen/file.go index b58dd48d89..983aec10cd 100644 --- a/vendor/goa.design/goa/v3/codegen/file.go +++ b/vendor/goa.design/goa/v3/codegen/file.go @@ -82,14 +82,14 @@ func (f *File) Render(dir string) (string, error) { } } - if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil { + if err := os.MkdirAll(filepath.Dir(path), 0750); err != nil { return "", err } file, err := os.OpenFile( path, os.O_CREATE|os.O_APPEND|os.O_WRONLY, - 0644, + 0600, ) if err != nil { return "", err diff --git a/vendor/goa.design/goa/v3/codegen/funcs.go b/vendor/goa.design/goa/v3/codegen/funcs.go index 49ff5d49cc..48501c4a94 100644 --- a/vendor/goa.design/goa/v3/codegen/funcs.go +++ b/vendor/goa.design/goa/v3/codegen/funcs.go @@ -169,7 +169,7 @@ func CamelCase(name string, firstUpper bool, acronym bool) string { if w == 0 && !firstUpper { runes[w] = unicode.ToLower(runes[w]) } - //advance to next word + // advance to next word w = i } @@ -183,7 +183,7 @@ func CamelCase(name string, firstUpper bool, acronym bool) string { func SnakeCase(name string) string { // Special handling for single "words" starting with multiple upper case letters for u, l := range toLower { - name = strings.Replace(name, u, l, -1) + name = strings.ReplaceAll(name, u, l) } // Remove leading and trailing blank spaces and replace any blank spaces in @@ -191,7 +191,7 @@ func SnakeCase(name string) string { name = strings.Join(strings.Fields(name), "_") // Special handling for dashes to convert them into underscores - name = strings.Replace(name, "-", "_", -1) + name = strings.ReplaceAll(name, "-", "_") var b bytes.Buffer ln := len(name) @@ -200,7 +200,7 @@ func SnakeCase(name string) string { } n := rune(name[0]) b.WriteRune(unicode.ToLower(n)) - lastLower, isLower, lastUnder, isUnder := false, true, false, false + var lastLower, isLower, lastUnder, isUnder bool for i := 1; i < ln; i++ { r := rune(name[i]) isLower = unicode.IsLower(r) && unicode.IsLetter(r) || unicode.IsDigit(r) @@ -229,7 +229,7 @@ func KebabCase(name string) string { if name[ln-1] == '_' { name = name[:ln-1] } - return strings.Replace(name, "_", "-", -1) + return strings.ReplaceAll(name, "_", "-") } // WrapText produces lines with text capped at maxChars diff --git a/vendor/goa.design/goa/v3/codegen/generator/generate.go b/vendor/goa.design/goa/v3/codegen/generator/generate.go index d61710b00f..5252009276 100644 --- a/vendor/goa.design/goa/v3/codegen/generator/generate.go +++ b/vendor/goa.design/goa/v3/codegen/generator/generate.go @@ -30,7 +30,7 @@ func Generate(dir, cmd string) (outputs []string, err1 error) { return nil, err } path := filepath.Join(base, codegen.Gendir) - if err := os.MkdirAll(path, 0777); err != nil { + if err := os.MkdirAll(path, 0750); err != nil { return nil, err } diff --git a/vendor/goa.design/goa/v3/codegen/generator/service.go b/vendor/goa.design/goa/v3/codegen/generator/service.go index 331a9a1d28..7f7169c42e 100644 --- a/vendor/goa.design/goa/v3/codegen/generator/service.go +++ b/vendor/goa.design/goa/v3/codegen/generator/service.go @@ -14,30 +14,31 @@ func Service(genpkg string, roots []eval.Root) ([]*codegen.File, error) { var files []*codegen.File var userTypePkgs = make(map[string][]string) for _, root := range roots { - switch r := root.(type) { - case *expr.RootExpr: - for _, s := range r.Services { - // Make sure service is first so name scope is - // properly initialized. - files = append(files, service.Files(genpkg, s, userTypePkgs)...) - files = append(files, service.EndpointFile(genpkg, s)) - files = append(files, service.ClientFile(genpkg, s)) - if f := service.ViewsFile(genpkg, s); f != nil { - files = append(files, f) - } - for _, f := range files { - if len(f.SectionTemplates) > 0 { - service.AddServiceDataMetaTypeImports(f.SectionTemplates[0], s) - } - } - f, err := service.ConvertFile(r, s) - if err != nil { - return nil, err - } - if f != nil { - files = append(files, f) + r, ok := root.(*expr.RootExpr) + if !ok { + continue + } + for _, s := range r.Services { + // Make sure service is first so name scope is + // properly initialized. + files = append(files, service.Files(genpkg, s, userTypePkgs)...) + files = append(files, service.EndpointFile(genpkg, s)) + files = append(files, service.ClientFile(genpkg, s)) + if f := service.ViewsFile(genpkg, s); f != nil { + files = append(files, f) + } + for _, f := range files { + if len(f.SectionTemplates) > 0 { + service.AddServiceDataMetaTypeImports(f.SectionTemplates[0], s) } } + f, err := service.ConvertFile(r, s) + if err != nil { + return nil, err + } + if f != nil { + files = append(files, f) + } } } return files, nil diff --git a/vendor/goa.design/goa/v3/codegen/import.go b/vendor/goa.design/goa/v3/codegen/import.go index 3fe22cda18..7cd44fe552 100644 --- a/vendor/goa.design/goa/v3/codegen/import.go +++ b/vendor/goa.design/goa/v3/codegen/import.go @@ -178,8 +178,8 @@ func safelyGetMetaTypeImports(att *expr.AttributeExpr, seen map[string]struct{}) } for imp := range uniqueImports { // Copy loop variable into body so next iteration doesn't overwrite its address https://stackoverflow.com/questions/27610039/golang-appending-leaves-only-last-element - copy := imp - imports = append(imports, ©) + cp := imp + imports = append(imports, &cp) } return imports } diff --git a/vendor/goa.design/goa/v3/codegen/scope.go b/vendor/goa.design/goa/v3/codegen/scope.go index ac6cb09764..d3c34b679a 100644 --- a/vendor/goa.design/goa/v3/codegen/scope.go +++ b/vendor/goa.design/goa/v3/codegen/scope.go @@ -175,7 +175,7 @@ func (s *NameScope) goTypeDef(att *expr.AttributeExpr, ptr, useDefault bool, pkg // GoVar returns the Go code that returns the address of a variable of the Go type // which matches the given attribute type. -func (s *NameScope) GoVar(varName string, dt expr.DataType) string { +func (*NameScope) GoVar(varName string, dt expr.DataType) string { // For a raw struct, no need to indirecting if isRawStruct(dt) { return varName diff --git a/vendor/goa.design/goa/v3/codegen/service/client.go b/vendor/goa.design/goa/v3/codegen/service/client.go index 56313d7b9e..d1e308cd1f 100644 --- a/vendor/goa.design/goa/v3/codegen/service/client.go +++ b/vendor/goa.design/goa/v3/codegen/service/client.go @@ -13,7 +13,7 @@ const ( ) // ClientFile returns the client file for the given service. -func ClientFile(genpkg string, service *expr.ServiceExpr) *codegen.File { +func ClientFile(_ string, service *expr.ServiceExpr) *codegen.File { svc := Services.Get(service.Name) data := endpointData(service) path := filepath.Join(codegen.Gendir, svc.PathName, "client.go") diff --git a/vendor/goa.design/goa/v3/codegen/service/convert.go b/vendor/goa.design/goa/v3/codegen/service/convert.go index 1ff45861b4..0070e34d35 100644 --- a/vendor/goa.design/goa/v3/codegen/service/convert.go +++ b/vendor/goa.design/goa/v3/codegen/service/convert.go @@ -342,7 +342,7 @@ type dtRec struct { seen map[string]expr.DataType } -func (r dtRec) append(p string) dtRec { +func appendPath(r dtRec, p string) dtRec { r.path += p return r } @@ -414,7 +414,7 @@ func buildDesignType(dt *expr.DataType, t reflect.Type, ref expr.DataType, recs eref = expr.AsArray(ref).ElemType.Type } var elem expr.DataType - if err := buildDesignType(&elem, e, eref, rec.append("[0]")); err != nil { + if err := buildDesignType(&elem, e, eref, appendPath(rec, "[0]")); err != nil { return fmt.Errorf("%s", err) } *dt = &expr.Array{ElemType: &expr.AttributeExpr{Type: elem}} @@ -427,11 +427,11 @@ func buildDesignType(dt *expr.DataType, t reflect.Type, ref expr.DataType, recs vref = m.ElemType.Type } var kt expr.DataType - if err := buildDesignType(&kt, t.Key(), kref, rec.append(".key")); err != nil { + if err := buildDesignType(&kt, t.Key(), kref, appendPath(rec, ".key")); err != nil { return fmt.Errorf("%s", err) } var vt expr.DataType - if err := buildDesignType(&vt, t.Elem(), vref, rec.append(".value")); err != nil { + if err := buildDesignType(&vt, t.Elem(), vref, appendPath(rec, ".value")); err != nil { return fmt.Errorf("%s", err) } *dt = &expr.Map{KeyType: &expr.AttributeExpr{Type: kt}, ElemType: &expr.AttributeExpr{Type: vt}} @@ -475,7 +475,7 @@ func buildDesignType(dt *expr.DataType, t reflect.Type, ref expr.DataType, recs rec.seen[t.Name()] = ut var required []string for i, f := range fields { - recf := rec.append("." + f.Name) + recf := appendPath(rec, "."+f.Name) atn, fn := attributeName(oref, f.Name) var aref expr.DataType if oref != nil { @@ -500,7 +500,7 @@ func buildDesignType(dt *expr.DataType, t reflect.Type, ref expr.DataType, recs if isPrimitive(f.Type) { required = append(required, atn) } - if err := buildDesignType(&fdt, f.Type, aref, rec.append("."+f.Name)); err != nil { + if err := buildDesignType(&fdt, f.Type, aref, appendPath(rec, "."+f.Name)); err != nil { return fmt.Errorf("%q.%s: %s", t.Name(), f.Name, err) } } @@ -625,7 +625,7 @@ type compRec struct { seen map[string]struct{} } -func (r compRec) append(p string) compRec { +func appendCompPath(r compRec, p string) compRec { r.path += p return r } @@ -662,7 +662,7 @@ func compatible(from expr.DataType, to reflect.Type, recs ...compRec) error { return compatible( expr.AsArray(from).ElemType.Type, to.Elem(), - rec.append("[0]"), + appendCompPath(rec, "[0]"), ) } @@ -673,14 +673,14 @@ func compatible(from expr.DataType, to reflect.Type, recs ...compRec) error { if err := compatible( expr.AsMap(from).ElemType.Type, to.Elem(), - rec.append(".value"), + appendCompPath(rec, ".value"), ); err != nil { return err } return compatible( expr.AsMap(from).KeyType.Type, to.Key(), - rec.append(".key"), + appendCompPath(rec, ".key"), ) } @@ -722,7 +722,7 @@ func compatible(from expr.DataType, to reflect.Type, recs ...compRec) error { err := compatible( nat.Attribute.Type, field.Type, - rec.append("."+fname), + appendCompPath(rec, "."+fname), ) if err != nil { return err diff --git a/vendor/goa.design/goa/v3/codegen/service/example_svc.go b/vendor/goa.design/goa/v3/codegen/service/example_svc.go index e556ddd3af..98648e0962 100644 --- a/vendor/goa.design/goa/v3/codegen/service/example_svc.go +++ b/vendor/goa.design/goa/v3/codegen/service/example_svc.go @@ -58,7 +58,7 @@ func ExampleServiceFiles(genpkg string, root *expr.RootExpr) []*codegen.File { } // exampleServiceFile returns a basic implementation of the given service. -func exampleServiceFile(genpkg string, root *expr.RootExpr, svc *expr.ServiceExpr, apipkg string) *codegen.File { +func exampleServiceFile(genpkg string, _ *expr.RootExpr, svc *expr.ServiceExpr, apipkg string) *codegen.File { data := Services.Get(svc.Name) svcName := data.PathName fpath := svcName + ".go" diff --git a/vendor/goa.design/goa/v3/codegen/service/views.go b/vendor/goa.design/goa/v3/codegen/service/views.go index f7d20de327..de03ddc5ac 100644 --- a/vendor/goa.design/goa/v3/codegen/service/views.go +++ b/vendor/goa.design/goa/v3/codegen/service/views.go @@ -16,7 +16,7 @@ type viewedType struct { // ViewsFile returns the views file for the given service which contains // logic to render result types using the defined views. -func ViewsFile(genpkg string, service *expr.ServiceExpr) *codegen.File { +func ViewsFile(_ string, service *expr.ServiceExpr) *codegen.File { svc := Services.Get(service.Name) if len(svc.projectedTypes) == 0 { return nil diff --git a/vendor/goa.design/goa/v3/codegen/testing.go b/vendor/goa.design/goa/v3/codegen/testing.go index 6d5cea5157..058447b36f 100644 --- a/vendor/goa.design/goa/v3/codegen/testing.go +++ b/vendor/goa.design/goa/v3/codegen/testing.go @@ -20,8 +20,12 @@ func RunDSL(t *testing.T, dsl func()) *expr.RootExpr { eval.Reset() expr.Root = new(expr.RootExpr) expr.Root.GeneratedTypes = &expr.GeneratedRoot{} - eval.Register(expr.Root) - eval.Register(expr.Root.GeneratedTypes) + if err := eval.Register(expr.Root); err != nil { + t.Fatal(err) + } + if err := eval.Register(expr.Root.GeneratedTypes); err != nil { + t.Fatal(err) + } expr.Root.API = expr.NewAPIExpr("test api", func() {}) expr.Root.API.Servers = []*expr.ServerExpr{expr.Root.API.DefaultServer()} if !eval.Execute(dsl, nil) { @@ -105,7 +109,7 @@ func Diff(t *testing.T, s1, s2 string) string { defer os.Remove(right) cmd := exec.Command("diff", left, right) diffb, _ := cmd.CombinedOutput() - return strings.Replace(string(diffb), "\t", " ␉ ", -1) + return strings.ReplaceAll(string(diffb), "\t", " ␉ ") } // CreateTempFile creates a temporary file and writes the given content. diff --git a/vendor/goa.design/goa/v3/codegen/transformer.go b/vendor/goa.design/goa/v3/codegen/transformer.go index db319742d3..f4e0ba8787 100644 --- a/vendor/goa.design/goa/v3/codegen/transformer.go +++ b/vendor/goa.design/goa/v3/codegen/transformer.go @@ -251,7 +251,7 @@ func (a *AttributeScope) Ref(att *expr.AttributeExpr, pkg string) string { } // Field returns a valid Go struct field name. -func (a *AttributeScope) Field(att *expr.AttributeExpr, name string, firstUpper bool) string { +func (*AttributeScope) Field(att *expr.AttributeExpr, name string, firstUpper bool) string { return GoifyAtt(att, name, firstUpper) } diff --git a/vendor/goa.design/goa/v3/codegen/types.go b/vendor/goa.design/goa/v3/codegen/types.go index 9734c2f7f8..e02921865f 100644 --- a/vendor/goa.design/goa/v3/codegen/types.go +++ b/vendor/goa.design/goa/v3/codegen/types.go @@ -42,7 +42,7 @@ func GoNativeTypeName(t expr.DataType) string { } // AttributeTags computes the struct field tags from its metadata if any. -func AttributeTags(parent, att *expr.AttributeExpr) string { +func AttributeTags(_, att *expr.AttributeExpr) string { var elems []string keys := make([]string, len(att.Meta)) i := 0 diff --git a/vendor/goa.design/goa/v3/codegen/validation.go b/vendor/goa.design/goa/v3/codegen/validation.go index 864d69eebe..2ff933cd00 100644 --- a/vendor/goa.design/goa/v3/codegen/validation.go +++ b/vendor/goa.design/goa/v3/codegen/validation.go @@ -365,7 +365,7 @@ func hasValidations(attCtx *AttributeContext, ut expr.UserType) bool { // generated to avoid infinite recursions. res := false done := errors.New("done") - Walk(ut.Attribute(), func(a *expr.AttributeExpr) error { + Walk(ut.Attribute(), func(a *expr.AttributeExpr) error { // nolint: errcheck if a.Validation == nil { return nil } diff --git a/vendor/goa.design/goa/v3/eval/eval.go b/vendor/goa.design/goa/v3/eval/eval.go index 83277e5047..d8876760ae 100644 --- a/vendor/goa.design/goa/v3/eval/eval.go +++ b/vendor/goa.design/goa/v3/eval/eval.go @@ -169,7 +169,7 @@ func (verr *ValidationErrors) AddError(def Expression, err error) { // runSet executes the DSL for all expressions in the given set. The expression // DSLs may append to the set as they execute. -func runSet(set ExpressionSet) error { +func runSet(set ExpressionSet) { executed := 0 recursed := 0 for executed < len(set) { @@ -184,15 +184,15 @@ func runSet(set ExpressionSet) error { } } if recursed > 100 { - return fmt.Errorf("too many generated expressions, infinite loop?") + Context.Record(&Error{GoError: fmt.Errorf("too many generated expressions, infinite loop?")}) + return } } - return nil } // prepareSet runs the pre validation steps on all the set expressions that // define one. -func prepareSet(set ExpressionSet) error { +func prepareSet(set ExpressionSet) { for _, def := range set { if def == nil { continue @@ -201,11 +201,10 @@ func prepareSet(set ExpressionSet) error { p.Prepare() } } - return nil } // validateSet runs the validation on all the set expressions that define one. -func validateSet(set ExpressionSet) error { +func validateSet(set ExpressionSet) { errors := &ValidationErrors{} for _, def := range set { if def == nil { @@ -220,11 +219,10 @@ func validateSet(set ExpressionSet) error { if len(errors.Errors) > 0 { Context.Record(&Error{GoError: errors}) } - return Context.Errors } // finalizeSet runs the finalizer on all the set expressions that define one. -func finalizeSet(set ExpressionSet) error { +func finalizeSet(set ExpressionSet) { for _, def := range set { if def == nil { continue @@ -233,7 +231,6 @@ func finalizeSet(set ExpressionSet) error { f.Finalize() } } - return nil } // caller returns the name of calling function. diff --git a/vendor/goa.design/goa/v3/eval/expression.go b/vendor/goa.design/goa/v3/eval/expression.go index e44841ade3..d50ecbe79e 100644 --- a/vendor/goa.design/goa/v3/eval/expression.go +++ b/vendor/goa.design/goa/v3/eval/expression.go @@ -84,7 +84,7 @@ type ( // SetWalker is the function signature used to iterate over expression sets // with WalkSets. - SetWalker func(s ExpressionSet) error + SetWalker func(s ExpressionSet) ) // Top is the expression returned by Current when the execution stack is empty. diff --git a/vendor/goa.design/goa/v3/expr/attribute.go b/vendor/goa.design/goa/v3/expr/attribute.go index d1296907e9..8ebcc03951 100644 --- a/vendor/goa.design/goa/v3/expr/attribute.go +++ b/vendor/goa.design/goa/v3/expr/attribute.go @@ -149,7 +149,7 @@ const ( ) // EvalName returns the name used by the DSL evaluation. -func (a *AttributeExpr) EvalName() string { +func (*AttributeExpr) EvalName() string { return "attribute" } @@ -925,7 +925,7 @@ func (v *ValidationExpr) Debug(title, prefix, indent string) { } // IsSupportedValidationFormat checks if the validation format is supported by goa. -func (a *AttributeExpr) IsSupportedValidationFormat(vf ValidationFormat) bool { +func (*AttributeExpr) IsSupportedValidationFormat(vf ValidationFormat) bool { switch vf { case FormatDate: return true diff --git a/vendor/goa.design/goa/v3/expr/example.go b/vendor/goa.design/goa/v3/expr/example.go index 1b0e44cd6a..b3f3dab4f1 100644 --- a/vendor/goa.design/goa/v3/expr/example.go +++ b/vendor/goa.design/goa/v3/expr/example.go @@ -26,6 +26,10 @@ func (a *AttributeExpr) Example(r *ExampleGenerator) any { return ex[len(ex)-1].Value } + if r.Randomizer == nil { + return nil + } + value, ok := a.Meta.Last("openapi:example") if !ok { value, ok = a.Meta.Last("swagger:example") @@ -240,7 +244,7 @@ func byMinMax(a *AttributeExpr, r *ExampleGenerator) any { return nil } var ( - min = math.Inf(-1) + min float64 max = math.Inf(1) sign = 1 ) diff --git a/vendor/goa.design/goa/v3/expr/generated.go b/vendor/goa.design/goa/v3/expr/generated.go index 15f5648a79..e0bad4fda0 100644 --- a/vendor/goa.design/goa/v3/expr/generated.go +++ b/vendor/goa.design/goa/v3/expr/generated.go @@ -9,7 +9,7 @@ type ( ) // EvalName is the name of the expression used by eval. -func (r *GeneratedRoot) EvalName() string { +func (*GeneratedRoot) EvalName() string { return "generated result types" } @@ -28,12 +28,12 @@ func (r *GeneratedRoot) WalkSets(w eval.SetWalker) { } // DependsOn ensures that Root executes first. -func (r *GeneratedRoot) DependsOn() []eval.Root { +func (*GeneratedRoot) DependsOn() []eval.Root { return []eval.Root{Root} } // Packages returns the Go import path to this and the dsl packages. -func (r *GeneratedRoot) Packages() []string { +func (*GeneratedRoot) Packages() []string { return []string{ "goa.design/goa/v3/expr", "goa.design/goa/v3/dsl", diff --git a/vendor/goa.design/goa/v3/expr/grpc.go b/vendor/goa.design/goa/v3/expr/grpc.go index ad7bc299eb..db5c3c245b 100644 --- a/vendor/goa.design/goa/v3/expr/grpc.go +++ b/vendor/goa.design/goa/v3/expr/grpc.go @@ -34,6 +34,6 @@ func (g *GRPCExpr) ServiceFor(s *ServiceExpr) *GRPCServiceExpr { } // EvalName returns the name printed in case of evaluation error. -func (g *GRPCExpr) EvalName() string { +func (*GRPCExpr) EvalName() string { return "API GRPC" } diff --git a/vendor/goa.design/goa/v3/expr/grpc_endpoint.go b/vendor/goa.design/goa/v3/expr/grpc_endpoint.go index d752bf02b7..5e75fbb8d1 100644 --- a/vendor/goa.design/goa/v3/expr/grpc_endpoint.go +++ b/vendor/goa.design/goa/v3/expr/grpc_endpoint.go @@ -215,10 +215,8 @@ func (e *GRPCEndpointExpr) Validate() error { verr.Merge(validateRPCTags(msgFields, e)) } } - } else { - if hasMessage && hasMetadata { - verr.Add(e, "Both request message and metadata are defined, but payload is not an object. Define either metadata or message or make payload an object type.") - } + } else if hasMessage && hasMetadata { + verr.Add(e, "Both request message and metadata are defined, but payload is not an object. Define either metadata or message or make payload an object type.") } // Validate response @@ -489,7 +487,8 @@ func validateMetadata(metAtt *MappedAttributeExpr, serviceAtt *AttributeExpr, e // getSecurityAttributes returns the attributes that describes a security // scheme from a method expression. func getSecurityAttributes(m *MethodExpr) []string { - secAttrs := []string{} + var secAttrs []string + for _, req := range m.Requirements { for _, sch := range req.Schemes { switch sch.Kind { diff --git a/vendor/goa.design/goa/v3/expr/http.go b/vendor/goa.design/goa/v3/expr/http.go index 23a418997f..557adb64e4 100644 --- a/vendor/goa.design/goa/v3/expr/http.go +++ b/vendor/goa.design/goa/v3/expr/http.go @@ -71,7 +71,7 @@ func (h *HTTPExpr) ServiceFor(s *ServiceExpr) *HTTPServiceExpr { } // EvalName returns the name printed in case of evaluation error. -func (h *HTTPExpr) EvalName() string { +func (*HTTPExpr) EvalName() string { return "API HTTP" } diff --git a/vendor/goa.design/goa/v3/expr/http_endpoint.go b/vendor/goa.design/goa/v3/expr/http_endpoint.go index 16ace3eb61..9f84995116 100644 --- a/vendor/goa.design/goa/v3/expr/http_endpoint.go +++ b/vendor/goa.design/goa/v3/expr/http_endpoint.go @@ -216,7 +216,7 @@ func (e *HTTPEndpointExpr) Prepare() { params.Merge(cpp) // Inherit attributes for path params from parent service - WalkMappedAttr(cpp, func(name, _ string, _ *AttributeExpr) error { + WalkMappedAttr(cpp, func(name, _ string, _ *AttributeExpr) error { // nolint: errcheck if att := c.MethodExpr.Payload.Find(name); att != nil { if e.MethodExpr.Payload.Type == Empty { e.MethodExpr.Payload.Type = &Object{} @@ -745,7 +745,7 @@ func (e *HTTPEndpointExpr) validateParams() *eval.ValidationErrors { verr.Add(e, "path parameter %s cannot be an object, path parameter types must be primitive, array or map (query string only)", name) } verr := new(eval.ValidationErrors) - WalkMappedAttr(pparams, func(name, _ string, a *AttributeExpr) error { + WalkMappedAttr(pparams, func(name, _ string, a *AttributeExpr) error { // nolint: errcheck switch { case IsObject(a.Type), IsMap(a.Type), IsUnion(a.Type): invalidTypeErr(verr, e, name) @@ -760,7 +760,7 @@ func (e *HTTPEndpointExpr) validateParams() *eval.ValidationErrors { } return nil }) - WalkMappedAttr(qparams, func(name, _ string, a *AttributeExpr) error { + WalkMappedAttr(qparams, func(name, _ string, a *AttributeExpr) error { // nolint: errcheck switch { case IsObject(a.Type), IsUnion(a.Type): invalidTypeErr(verr, e, name) @@ -778,13 +778,13 @@ func (e *HTTPEndpointExpr) validateParams() *eval.ValidationErrors { if e.MethodExpr.Payload != nil { switch e.MethodExpr.Payload.Type.(type) { case *Object, UserType: - WalkMappedAttr(pparams, func(name, _ string, a *AttributeExpr) error { + WalkMappedAttr(pparams, func(name, _ string, _ *AttributeExpr) error { // nolint: errcheck if e.MethodExpr.Payload.Find(name) == nil { verr.Add(e, "Path parameter %q not found in payload.", name) } return nil }) - WalkMappedAttr(qparams, func(name, _ string, a *AttributeExpr) error { + WalkMappedAttr(qparams, func(name, _ string, _ *AttributeExpr) error { // nolint: errcheck if e.MethodExpr.Payload.Find(name) == nil { verr.Add(e, "Query string parameter %q not found in payload.", name) } @@ -815,7 +815,7 @@ func (e *HTTPEndpointExpr) validateHeadersAndCookies() *eval.ValidationErrors { cookies := DupMappedAtt(e.Cookies) initAttr(headers, e.MethodExpr.Payload) initAttr(cookies, e.MethodExpr.Payload) - WalkMappedAttr(headers, func(name, _ string, a *AttributeExpr) error { + WalkMappedAttr(headers, func(name, _ string, a *AttributeExpr) error { // nolint: errcheck switch { case IsObject(a.Type), IsUnion(a.Type): verr.Add(e, "header %q must be primitive or array", name) @@ -830,7 +830,7 @@ func (e *HTTPEndpointExpr) validateHeadersAndCookies() *eval.ValidationErrors { } return nil }) - WalkMappedAttr(cookies, func(name, _ string, a *AttributeExpr) error { + WalkMappedAttr(cookies, func(name, _ string, a *AttributeExpr) error { // nolint: errcheck switch { case IsObject(a.Type), IsUnion(a.Type), IsArray(a.Type): verr.Add(e, "cookie %q must be primitive", name) @@ -843,7 +843,7 @@ func (e *HTTPEndpointExpr) validateHeadersAndCookies() *eval.ValidationErrors { switch e.MethodExpr.Payload.Type.(type) { case *Object, UserType: hasBasicAuth := TaggedAttribute(e.MethodExpr.Payload, "security:username") != "" - WalkMappedAttr(headers, func(name, elem string, a *AttributeExpr) error { + WalkMappedAttr(headers, func(name, elem string, _ *AttributeExpr) error { // nolint: errcheck if e.MethodExpr.Payload.Find(name) == nil { verr.Add(e, "header %q not found in payload.", name) } @@ -855,7 +855,7 @@ func (e *HTTPEndpointExpr) validateHeadersAndCookies() *eval.ValidationErrors { } return nil }) - WalkMappedAttr(cookies, func(name, elem string, a *AttributeExpr) error { + WalkMappedAttr(cookies, func(name, _ string, _ *AttributeExpr) error { // nolint: errcheck if e.MethodExpr.Payload.Find(name) == nil { verr.Add(e, "cookie %q not found in payload.", name) } diff --git a/vendor/goa.design/goa/v3/expr/method.go b/vendor/goa.design/goa/v3/expr/method.go index 95d5715665..902a84c713 100644 --- a/vendor/goa.design/goa/v3/expr/method.go +++ b/vendor/goa.design/goa/v3/expr/method.go @@ -201,7 +201,7 @@ func (m *MethodExpr) Validate() error { // presence of struct:error:name meta in the object type. if i != j && e.Type == e2.Type && IsObject(e.Type) { var found bool - walkAttribute(e.AttributeExpr, func(name string, att *AttributeExpr) error { + walkAttribute(e.AttributeExpr, func(_ string, att *AttributeExpr) error { // nolint: errcheck if _, ok := att.Meta["struct:error:name"]; ok { found = true return fmt.Errorf("struct:error:name found: stop iteration") diff --git a/vendor/goa.design/goa/v3/expr/random.go b/vendor/goa.design/goa/v3/expr/random.go index 0a390de04f..d718895348 100644 --- a/vendor/goa.design/goa/v3/expr/random.go +++ b/vendor/goa.design/goa/v3/expr/random.go @@ -14,6 +14,8 @@ import ( // // The random values should be consistent in that given the same seed the same // random values get generated. +// +// Setting the randomizer to nil disables example generation. type Randomizer interface { // ArrayLength decides how long an example array will be ArrayLength() int diff --git a/vendor/goa.design/goa/v3/expr/result_type.go b/vendor/goa.design/goa/v3/expr/result_type.go index b0d6c89a5e..882900f09a 100644 --- a/vendor/goa.design/goa/v3/expr/result_type.go +++ b/vendor/goa.design/goa/v3/expr/result_type.go @@ -126,7 +126,7 @@ func CanonicalIdentifier(identifier string) string { } // Kind implements DataKind. -func (m *ResultTypeExpr) Kind() Kind { return ResultTypeKind } +func (*ResultTypeExpr) Kind() Kind { return ResultTypeKind } // Dup creates a deep copy of the result type given a deep copy of its attribute. func (m *ResultTypeExpr) Dup(att *AttributeExpr) UserType { @@ -178,7 +178,7 @@ func (m *ResultTypeExpr) Finalize() { } m.UserTypeExpr.Finalize() seen := make(map[string]struct{}) - walkAttribute(m.AttributeExpr, func(_ string, att *AttributeExpr) error { + walkAttribute(m.AttributeExpr, func(_ string, att *AttributeExpr) error { // nolint: errcheck if rt, ok := att.Type.(*ResultTypeExpr); ok { if _, ok := seen[rt.Identifier]; !ok { seen[rt.Identifier] = struct{}{} diff --git a/vendor/goa.design/goa/v3/expr/root.go b/vendor/goa.design/goa/v3/expr/root.go index 591b65b488..6cc0a74a7e 100644 --- a/vendor/goa.design/goa/v3/expr/root.go +++ b/vendor/goa.design/goa/v3/expr/root.go @@ -130,10 +130,10 @@ func (r *RootExpr) WalkSets(walk eval.SetWalker) { } // DependsOn returns nil, the core DSL has no dependency. -func (r *RootExpr) DependsOn() []eval.Root { return nil } +func (*RootExpr) DependsOn() []eval.Root { return nil } // Packages returns the Go import path to this and the dsl packages. -func (r *RootExpr) Packages() []string { +func (*RootExpr) Packages() []string { return []string{ "goa.design/goa/v3/expr", "goa.design/goa/v3/dsl", @@ -213,7 +213,7 @@ func (r *RootExpr) HTTPServiceFor(s *ServiceExpr) *HTTPServiceExpr { } // EvalName is the name of the DSL. -func (r *RootExpr) EvalName() string { +func (*RootExpr) EvalName() string { return "design" } diff --git a/vendor/goa.design/goa/v3/expr/server.go b/vendor/goa.design/goa/v3/expr/server.go index aa08d8c097..cf5f742acc 100644 --- a/vendor/goa.design/goa/v3/expr/server.go +++ b/vendor/goa.design/goa/v3/expr/server.go @@ -247,7 +247,7 @@ func (h *HostExpr) URIString(u URIExpr) (string, error) { if def == nil { def = v.Attribute.Validation.Values[0] } - uri = strings.Replace(uri, fmt.Sprintf("{%s}", p), fmt.Sprintf("%v", def), -1) + uri = strings.ReplaceAll(uri, fmt.Sprintf("{%s}", p), fmt.Sprintf("%v", def)) } } } diff --git a/vendor/goa.design/goa/v3/expr/service.go b/vendor/goa.design/goa/v3/expr/service.go index b78ba0751a..dd8f726d2c 100644 --- a/vendor/goa.design/goa/v3/expr/service.go +++ b/vendor/goa.design/goa/v3/expr/service.go @@ -100,7 +100,7 @@ func (s *ServiceExpr) Finalize() { func (e *ErrorExpr) Validate() error { verr := new(eval.ValidationErrors) var errField string - walkAttribute(e.AttributeExpr, func(name string, att *AttributeExpr) error { + walkAttribute(e.AttributeExpr, func(name string, att *AttributeExpr) error { // nolint: errcheck if _, ok := att.Meta["struct:error:name"]; ok { if errField != "" { verr.Add(e, "duplicate error names in type %q", e.AttributeExpr.Type.Name()) diff --git a/vendor/goa.design/goa/v3/expr/testing.go b/vendor/goa.design/goa/v3/expr/testing.go index f88c599b14..609cd18fad 100644 --- a/vendor/goa.design/goa/v3/expr/testing.go +++ b/vendor/goa.design/goa/v3/expr/testing.go @@ -68,7 +68,7 @@ func Diff(t *testing.T, s1, s2 string) string { defer os.Remove(right) cmd := exec.Command("diff", left, right) diffb, _ := cmd.CombinedOutput() - return strings.Replace(string(diffb), "\t", " ␉ ", -1) + return strings.ReplaceAll(string(diffb), "\t", " ␉ ") } // CreateTempFile creates a temporary file and writes the given content. @@ -95,8 +95,12 @@ func setupDSLRun() { eval.Reset() Root = new(RootExpr) Root.GeneratedTypes = &GeneratedRoot{} - eval.Register(Root) - eval.Register(Root.GeneratedTypes) + if err := eval.Register(Root); err != nil { + panic(err) + } + if err := eval.Register(Root.GeneratedTypes); err != nil { + panic(err) + } Root.API = NewAPIExpr("test api", func() {}) Root.API.Servers = []*ServerExpr{Root.API.DefaultServer()} } diff --git a/vendor/goa.design/goa/v3/expr/types.go b/vendor/goa.design/goa/v3/expr/types.go index c0795086f1..eccbad5784 100644 --- a/vendor/goa.design/goa/v3/expr/types.go +++ b/vendor/goa.design/goa/v3/expr/types.go @@ -271,10 +271,10 @@ func IsAlias(dt DataType) bool { // Equal compares the types recursively and returns true if they are equal. Two // types are equal if: // -// - both types have the same kind -// - array types have elements whose types are equal -// - map types have keys and elements whose types are equal -// - objects have the same attribute names and the attribute types are equal +// - both types have the same kind +// - array types have elements whose types are equal +// - map types have keys and elements whose types are equal +// - objects have the same attribute names and the attribute types are equal // // Note: calling Equal is not equivalent to evaluating dt.Hash() == dt2.Hash() // as the former may return true for two user types with different names and @@ -381,10 +381,10 @@ func (p Primitive) Hash() string { } // Kind implements DataKind. -func (a *Array) Kind() Kind { return ArrayKind } +func (*Array) Kind() Kind { return ArrayKind } // Name returns the type name. -func (a *Array) Name() string { +func (*Array) Name() string { return "array" } @@ -502,10 +502,10 @@ func (o *Object) Rename(n, m string) { } // Kind implements DataKind. -func (o *Object) Kind() Kind { return ObjectKind } +func (*Object) Kind() Kind { return ObjectKind } // Name returns the type name. -func (o *Object) Name() string { return "object" } +func (*Object) Name() string { return "object" } // Hash returns a unique hash value for o. func (o *Object) Hash() string { @@ -524,7 +524,7 @@ func (o *Object) Merge(other *Object) *Object { } // IsCompatible returns true if o describes the (Go) type of val. -func (o *Object) IsCompatible(val any) bool { +func (*Object) IsCompatible(val any) bool { k := reflect.TypeOf(val).Kind() return k == reflect.Map || k == reflect.Struct } @@ -541,10 +541,10 @@ func (o *Object) Example(r *ExampleGenerator) any { } // Kind implements DataKind. -func (m *Map) Kind() Kind { return MapKind } +func (*Map) Kind() Kind { return MapKind } // Name returns the type name. -func (m *Map) Name() string { return "map" } +func (*Map) Name() string { return "map" } // Hash returns a unique hash value for m. func (m *Map) Hash() string { @@ -614,7 +614,7 @@ func (m MapVal) ToMap() map[any]any { } // Kind implements DataKind. -func (u *Union) Kind() Kind { return UnionKind } +func (*Union) Kind() Kind { return UnionKind } // Name returns the type name. func (u *Union) Name() string { return u.TypeName } @@ -647,10 +647,9 @@ func (u *Union) Example(r *ExampleGenerator) any { // array or map types. This is useful in reporting types in error messages, // examples of qualified type names: // -// "array" -// "map" -// "map>" -// +// "array" +// "map" +// "map>" func QualifiedTypeName(t DataType) string { switch t.Kind() { case ArrayKind: diff --git a/vendor/goa.design/goa/v3/expr/user_type.go b/vendor/goa.design/goa/v3/expr/user_type.go index 6aea812879..33c37785f2 100644 --- a/vendor/goa.design/goa/v3/expr/user_type.go +++ b/vendor/goa.design/goa/v3/expr/user_type.go @@ -26,7 +26,7 @@ func (u *UserTypeExpr) ID() string { } // Kind implements DataKind. -func (u *UserTypeExpr) Kind() Kind { return UserTypeKind } +func (*UserTypeExpr) Kind() Kind { return UserTypeKind } // Name returns the type name. func (u *UserTypeExpr) Name() string { diff --git a/vendor/goa.design/goa/v3/grpc/codegen/client_types.go b/vendor/goa.design/goa/v3/grpc/codegen/client_types.go index 0546aa6d97..0874a4f1fd 100644 --- a/vendor/goa.design/goa/v3/grpc/codegen/client_types.go +++ b/vendor/goa.design/goa/v3/grpc/codegen/client_types.go @@ -11,8 +11,8 @@ import ( // ClientTypeFiles returns the types file for every gRPC service that contain // constructors to transform: // -// * service payload types into protocol buffer request message types -// * protocol buffer response message types into service result types +// - service payload types into protocol buffer request message types +// - protocol buffer response message types into service result types func ClientTypeFiles(genpkg string, root *expr.RootExpr) []*codegen.File { fw := make([]*codegen.File, len(root.API.GRPC.Services)) seen := make(map[string]struct{}) @@ -28,7 +28,7 @@ func ClientTypeFiles(genpkg string, root *expr.RootExpr) []*codegen.File { // // seen keeps track of the constructor names that have already been generated // to prevent duplicate code generation. -func clientType(genpkg string, svc *expr.GRPCServiceExpr, seen map[string]struct{}) *codegen.File { +func clientType(genpkg string, svc *expr.GRPCServiceExpr, _ map[string]struct{}) *codegen.File { var ( initData []*InitData diff --git a/vendor/goa.design/goa/v3/grpc/codegen/proto.go b/vendor/goa.design/goa/v3/grpc/codegen/proto.go index 1fa34aaefe..ed126bc473 100644 --- a/vendor/goa.design/goa/v3/grpc/codegen/proto.go +++ b/vendor/goa.design/goa/v3/grpc/codegen/proto.go @@ -5,6 +5,7 @@ import ( "os" "os/exec" "path/filepath" + "strings" "goa.design/goa/v3/codegen" "goa.design/goa/v3/expr" @@ -14,6 +15,9 @@ import ( const ( // ProtoVersion is the protocol buffer version used to generate .proto files ProtoVersion = "proto3" + + // ProtoPrefix is the prefix added to the proto package name. + ProtoPrefix = "goagen" ) // ProtoFiles returns a *.proto file for each gRPC service. @@ -28,7 +32,16 @@ func ProtoFiles(genpkg string, root *expr.RootExpr) []*codegen.File { func protoFile(genpkg string, svc *expr.GRPCServiceExpr) *codegen.File { data := GRPCServices.Get(svc.Name()) svcName := data.Service.PathName - path := filepath.Join(codegen.Gendir, "grpc", svcName, pbPkgName, "goadesign_goagen_"+svcName+".proto") + parts := strings.Split(genpkg, "/") + var repoName string + if len(parts) > 1 { + repoName = parts[len(parts)-2] + } else { + repoName = parts[0] + } + // the filename is used by protoc to set the namespace so try to make it unique + fname := fmt.Sprintf("%s_%s_%s.proto", ProtoPrefix, repoName, svcName) + path := filepath.Join(codegen.Gendir, "grpc", svcName, pbPkgName, fname) sections := []*codegen.SectionTemplate{ // header comments @@ -85,7 +98,9 @@ func pkgName(svc *expr.GRPCServiceExpr, svcName string) string { func protoc(path string, includes []string) error { dir := filepath.Dir(path) - os.MkdirAll(dir, 0777) + if err := os.MkdirAll(dir, 0777); err != nil { + return err + } args := []string{ path, diff --git a/vendor/goa.design/goa/v3/grpc/codegen/protobuf.go b/vendor/goa.design/goa/v3/grpc/codegen/protobuf.go index 417b5e67f7..d35e4ac6f8 100644 --- a/vendor/goa.design/goa/v3/grpc/codegen/protobuf.go +++ b/vendor/goa.design/goa/v3/grpc/codegen/protobuf.go @@ -19,7 +19,7 @@ type ( ) // Name returns the protocol buffer type name. -func (p *protoBufScope) Name(att *expr.AttributeExpr, pkg string, ptr, useDefault bool) string { +func (p *protoBufScope) Name(att *expr.AttributeExpr, pkg string, _, _ bool) string { return protoBufGoFullTypeName(att, pkg, p.scope) } @@ -31,7 +31,7 @@ func (p *protoBufScope) Ref(att *expr.AttributeExpr, pkg string) string { // Field returns the field name as generated by protocol buffer compiler. // NOTE: protoc does not care about common initialisms like api -> API so we // first transform the name into snake case to end up with Api. -func (p *protoBufScope) Field(att *expr.AttributeExpr, name string, firstUpper bool) string { +func (*protoBufScope) Field(att *expr.AttributeExpr, name string, firstUpper bool) string { return protoBufifyAtt(att, codegen.SnakeCase(name), firstUpper) } diff --git a/vendor/goa.design/goa/v3/grpc/codegen/protobuf_transform.go b/vendor/goa.design/goa/v3/grpc/codegen/protobuf_transform.go index 0736323913..90b362f0b6 100644 --- a/vendor/goa.design/goa/v3/grpc/codegen/protobuf_transform.go +++ b/vendor/goa.design/goa/v3/grpc/codegen/protobuf_transform.go @@ -638,7 +638,7 @@ func convertType(src, tgt *expr.AttributeExpr, srcPtr bool, tgtPtr bool, srcVar // representation to another. // NOTE: For Int and UInt kinds, protocol buffer Go compiler generates // int32 and uint32 respectively whereas Goa generates int and uint. -func convertPrimitiveToProto(src, tgt *expr.AttributeExpr, srcPtr, tgtPtr bool, srcVar string, ta *transformAttrs) string { +func convertPrimitiveToProto(_, tgt *expr.AttributeExpr, srcPtr, _ bool, srcVar string, _ *transformAttrs) string { tgtType := protoBufNativeGoTypeName(tgt.Type) if srcPtr { srcVar = "*" + srcVar @@ -646,7 +646,7 @@ func convertPrimitiveToProto(src, tgt *expr.AttributeExpr, srcPtr, tgtPtr bool, return fmt.Sprintf("%s(%s)", tgtType, srcVar) } -func convertPrimitiveFromProto(src, tgt *expr.AttributeExpr, srcPtr, tgtPtr bool, srcVar string, ta *transformAttrs) string { +func convertPrimitiveFromProto(_, tgt *expr.AttributeExpr, srcPtr, _ bool, srcVar string, ta *transformAttrs) string { tgtType, _ := codegen.GetMetaType(tgt) if tgtType == "" { tgtType = ta.TargetCtx.Scope.Ref(tgt, ta.TargetCtx.Pkg(tgt)) @@ -909,13 +909,13 @@ func transformHelperName(source, target *expr.AttributeExpr, ta *transformAttrs) // Do not consider package overrides for protogen generated types if ta.proto { target = expr.DupAtt(target) - codegen.Walk(target, func(att *expr.AttributeExpr) error { + codegen.Walk(target, func(att *expr.AttributeExpr) error { // nolint: errcheck delete(att.Meta, "struct:pkg:path") return nil }) } else { source = expr.DupAtt(source) - codegen.Walk(source, func(att *expr.AttributeExpr) error { + codegen.Walk(source, func(att *expr.AttributeExpr) error { // nolint: errcheck delete(att.Meta, "struct:pkg:path") return nil }) diff --git a/vendor/goa.design/goa/v3/grpc/codegen/server_types.go b/vendor/goa.design/goa/v3/grpc/codegen/server_types.go index 40102b3798..86983ad7df 100644 --- a/vendor/goa.design/goa/v3/grpc/codegen/server_types.go +++ b/vendor/goa.design/goa/v3/grpc/codegen/server_types.go @@ -11,8 +11,8 @@ import ( // ServerTypeFiles returns the types file for every gRPC service that contain // constructors to transform: // -// * protocol buffer request message types into service payload types -// * service result types into protocol buffer response message types +// - protocol buffer request message types into service payload types +// - service result types into protocol buffer response message types func ServerTypeFiles(genpkg string, root *expr.RootExpr) []*codegen.File { fw := make([]*codegen.File, len(root.API.GRPC.Services)) seen := make(map[string]struct{}) @@ -28,7 +28,7 @@ func ServerTypeFiles(genpkg string, root *expr.RootExpr) []*codegen.File { // // seen keeps track of the constructor names that have already been generated // to prevent duplicate code generation. -func serverType(genpkg string, svc *expr.GRPCServiceExpr, seen map[string]struct{}) *codegen.File { +func serverType(genpkg string, svc *expr.GRPCServiceExpr, _ map[string]struct{}) *codegen.File { var ( initData []*InitData diff --git a/vendor/goa.design/goa/v3/grpc/codegen/service_data.go b/vendor/goa.design/goa/v3/grpc/codegen/service_data.go index 9bbc4677a2..ced49fb447 100644 --- a/vendor/goa.design/goa/v3/grpc/codegen/service_data.go +++ b/vendor/goa.design/goa/v3/grpc/codegen/service_data.go @@ -426,7 +426,7 @@ func (sd *ServiceData) HasStreamingEndpoint() bool { } // analyze creates the data necessary to render the code of the given service. -func (d ServicesData) analyze(gs *expr.GRPCServiceExpr) *ServiceData { +func (ServicesData) analyze(gs *expr.GRPCServiceExpr) *ServiceData { var ( sd *ServiceData seen, imported map[string]struct{} @@ -1000,7 +1000,7 @@ func buildResponseConvertData(response, result *expr.AttributeExpr, svcCtx *code // svcCtx is the attribute context for service type // proto if true indicates the target type is a protocol buffer type // svr if true indicates the code is generated for conversion server side -func buildInitData(source, target *expr.AttributeExpr, sourceVar, targetVar string, svcCtx *codegen.AttributeContext, proto, svr, usesrc bool, sd *ServiceData) *InitData { +func buildInitData(source, target *expr.AttributeExpr, sourceVar, targetVar string, svcCtx *codegen.AttributeContext, proto, _, usesrc bool, sd *ServiceData) *InitData { var ( name string isStruct bool @@ -1256,7 +1256,7 @@ func buildStreamData(e *expr.GRPCEndpointExpr, sd *ServiceData, svr bool) *Strea func extractMetadata(a *expr.MappedAttributeExpr, service *expr.AttributeExpr, scope *codegen.NameScope) []*MetadataData { var metadata []*MetadataData ctx := serviceTypeContext("", scope) - codegen.WalkMappedAttr(a, func(name, elem string, required bool, c *expr.AttributeExpr) error { + codegen.WalkMappedAttr(a, func(name, elem string, required bool, c *expr.AttributeExpr) error { // nolint: errcheck var ( varn string fieldName string diff --git a/vendor/goa.design/goa/v3/http/client.go b/vendor/goa.design/goa/v3/http/client.go index d257893a49..2779a4bb36 100644 --- a/vendor/goa.design/goa/v3/http/client.go +++ b/vendor/goa.design/goa/v3/http/client.go @@ -100,7 +100,7 @@ func (dd *debugDoer) Fprint(w io.Writer) { return } buf := &bytes.Buffer{} - buf.WriteString(fmt.Sprintf("> %s %s", dd.Request.Method, dd.Request.URL.String())) + buf.WriteString(fmt.Sprintf("> %s %s", dd.Request.Method, dd.Request.URL.String())) // nolint: errcheck keys := make([]string, len(dd.Request.Header)) i := 0 @@ -110,18 +110,18 @@ func (dd *debugDoer) Fprint(w io.Writer) { } sort.Strings(keys) for _, k := range keys { - buf.WriteString(fmt.Sprintf("\n> %s: %s", k, strings.Join(dd.Request.Header[k], ", "))) + buf.WriteString(fmt.Sprintf("\n> %s: %s", k, strings.Join(dd.Request.Header[k], ", "))) // nolint: errcheck } b, _ := io.ReadAll(dd.Request.Body) if len(b) > 0 { dd.Request.Body = io.NopCloser(bytes.NewBuffer(b)) // reset the request body - buf.WriteByte('\n') - buf.Write(b) + buf.WriteByte('\n') // nolint: errcheck + buf.Write(b) // nolint: errcheck } if dd.Response == nil { - w.Write(buf.Bytes()) + w.Write(buf.Bytes()) // nolint: errcheck return } buf.WriteString(fmt.Sprintf("\n< %s", dd.Response.Status)) @@ -134,21 +134,21 @@ func (dd *debugDoer) Fprint(w io.Writer) { } sort.Strings(keys) for _, k := range keys { - buf.WriteString(fmt.Sprintf("\n< %s: %s", k, strings.Join(dd.Response.Header[k], ", "))) + buf.WriteString(fmt.Sprintf("\n< %s: %s", k, strings.Join(dd.Response.Header[k], ", "))) // nolint: errcheck } rb, _ := io.ReadAll(dd.Response.Body) // this is reading from a memory buffer so safe to ignore errors if len(rb) > 0 { dd.Response.Body = io.NopCloser(bytes.NewBuffer(rb)) // reset the response body - buf.WriteByte('\n') - buf.Write(rb) + buf.WriteByte('\n') // nolint: errcheck + buf.Write(rb) // nolint: errcheck } - w.Write(buf.Bytes()) - w.Write([]byte{'\n'}) + w.Write(buf.Bytes()) // nolint: errcheck + w.Write([]byte{'\n'}) // nolint: errcheck } // Error builds an error message. -func (c *ClientError) Error() string { +func (c ClientError) Error() string { return fmt.Sprintf("[%s %s]: %s", c.Service, c.Method, c.Message) } diff --git a/vendor/goa.design/goa/v3/http/codegen/openapi/v2/builder.go b/vendor/goa.design/goa/v3/http/codegen/openapi/v2/builder.go index e47e510972..359e2a8a7f 100644 --- a/vendor/goa.design/goa/v3/http/codegen/openapi/v2/builder.go +++ b/vendor/goa.design/goa/v3/http/codegen/openapi/v2/builder.go @@ -131,7 +131,8 @@ func mustGenerate(meta expr.MetaExpr) bool { // addScopeDescription generates and adds required scopes to the scheme's description. func addScopeDescription(scopes []*expr.ScopeExpr, sd *SecurityDefinition) { // Generate scopes to add to description - lines := []string{} + var lines []string + for _, scope := range scopes { lines = append(lines, fmt.Sprintf(" * `%s`: %s", scope.Name, scope.Description)) } @@ -274,7 +275,7 @@ func paramsFromExpr(params *expr.MappedAttributeExpr, path string) []*Parameter res []*Parameter wildcards = expr.ExtractHTTPWildcards(path) ) - codegen.WalkMappedAttr(params, func(n, pn string, required bool, at *expr.AttributeExpr) error { + codegen.WalkMappedAttr(params, func(n, pn string, required bool, at *expr.AttributeExpr) error { // nolint: errcheck in := "query" for _, w := range wildcards { if n == w { @@ -291,7 +292,8 @@ func paramsFromExpr(params *expr.MappedAttributeExpr, path string) []*Parameter } func paramsFromHeaders(endpoint *expr.HTTPEndpointExpr) []*Parameter { - params := []*Parameter{} + var params []*Parameter + var ( rma = endpoint.Service.Params ma = endpoint.Headers @@ -372,9 +374,9 @@ func paramFor(at *expr.AttributeExpr, name, in string, required bool) *Parameter func itemsFromExpr(at *expr.AttributeExpr) *Items { items := &Items{Type: at.Type.Name()} - switch actual := at.Type.(type) { - case expr.Primitive: - switch actual.Kind() { + p, ok := at.Type.(expr.Primitive) + if ok { + switch p.Kind() { case expr.IntKind, expr.Int64Kind, expr.UIntKind, expr.UInt64Kind, expr.Int32Kind, expr.UInt32Kind: items.Type = "integer" case expr.Float32Kind, expr.Float64Kind: @@ -390,7 +392,7 @@ func itemsFromExpr(at *expr.AttributeExpr) *Items { return items } -func responseSpecFromExpr(s *V2, root *expr.RootExpr, r *expr.HTTPResponseExpr, typeNamePrefix string) *Response { +func responseSpecFromExpr(_ *V2, root *expr.RootExpr, r *expr.HTTPResponseExpr, typeNamePrefix string) *Response { var schema *openapi.Schema if mt, ok := r.Body.Type.(*expr.ResultTypeExpr); ok { view := expr.DefaultView @@ -423,7 +425,7 @@ func headersFromExpr(headers *expr.MappedAttributeExpr) map[string]*Header { return nil } res := make(map[string]*Header) - codegen.WalkMappedAttr(headers, func(_, n string, required bool, at *expr.AttributeExpr) error { + codegen.WalkMappedAttr(headers, func(_, n string, _ bool, at *expr.AttributeExpr) error { // nolint: errcheck header := &Header{ Default: at.DefaultValue, Description: at.Description, @@ -521,7 +523,8 @@ func buildPathFromExpr(s *V2, root *expr.RootExpr, h *expr.HostExpr, route *expr key = expr.HTTPWildcardRegex.ReplaceAllString(key, "/{$1}") params := paramsFromExpr(endpoint.Params, key) params = append(params, paramsFromHeaders(endpoint)...) - produces := []string{} + var produces []string + responses := make(map[string]*Response, len(endpoint.Responses)) for _, r := range endpoint.Responses { if endpoint.MethodExpr.IsStreaming() { diff --git a/vendor/goa.design/goa/v3/http/codegen/openapi/v3/builder.go b/vendor/goa.design/goa/v3/http/codegen/openapi/v3/builder.go index 205d03ba79..5fbf287af8 100644 --- a/vendor/goa.design/goa/v3/http/codegen/openapi/v3/builder.go +++ b/vendor/goa.design/goa/v3/http/codegen/openapi/v3/builder.go @@ -30,6 +30,14 @@ func New(root *expr.RootExpr) *OpenAPI { return nil } + m, ok := root.API.Meta.Last("openapi:example") + if !ok { + m, ok = root.API.Meta.Last("swagger:example") + } + if ok && m == "false" { + root.API.ExampleGenerator.Randomizer = nil + } + var ( bodies, types = buildBodyTypes(root.API) diff --git a/vendor/goa.design/goa/v3/http/codegen/openapi/v3/openapi.go b/vendor/goa.design/goa/v3/http/codegen/openapi/v3/openapi.go index 1581438b79..e9aa193145 100644 --- a/vendor/goa.design/goa/v3/http/codegen/openapi/v3/openapi.go +++ b/vendor/goa.design/goa/v3/http/codegen/openapi/v3/openapi.go @@ -284,8 +284,8 @@ func (o Operation) MarshalJSON() ([]byte, error) { } // MarshalJSON returns the JSON encoding of p. -func (p Parameter) MarshalJSON() ([]byte, error) { - return openapi.MarshalJSON(_Parameter(p), p.Extensions) +func (p *Parameter) MarshalJSON() ([]byte, error) { + return openapi.MarshalJSON((*_Parameter)(p), p.Extensions) } // MarshalJSON returns the JSON encoding of r. @@ -314,8 +314,8 @@ func (o Operation) MarshalYAML() (any, error) { } // MarshalYAML returns value which marshaled in place of the original value -func (p Parameter) MarshalYAML() (any, error) { - return openapi.MarshalYAML(_Parameter(p), p.Extensions) +func (p *Parameter) MarshalYAML() (any, error) { + return openapi.MarshalYAML((*_Parameter)(p), p.Extensions) } // MarshalYAML returns value which marshaled in place of the original value diff --git a/vendor/goa.design/goa/v3/http/codegen/openapi/v3/parameters.go b/vendor/goa.design/goa/v3/http/codegen/openapi/v3/parameters.go index e39960cdc7..9f4ab33639 100644 --- a/vendor/goa.design/goa/v3/http/codegen/openapi/v3/parameters.go +++ b/vendor/goa.design/goa/v3/http/codegen/openapi/v3/parameters.go @@ -15,7 +15,7 @@ func paramsFromPath(params *expr.MappedAttributeExpr, path string, rand *expr.Ex res []*Parameter wildcards = expr.ExtractHTTPWildcards(path) ) - codegen.WalkMappedAttr(params, func(n, pn string, required bool, at *expr.AttributeExpr) error { + codegen.WalkMappedAttr(params, func(n, pn string, required bool, at *expr.AttributeExpr) error { // nolint: errcheck in := "query" for _, w := range wildcards { if n == w { @@ -33,8 +33,9 @@ func paramsFromPath(params *expr.MappedAttributeExpr, path string, rand *expr.Ex // paramsFromHeadersAndCookies computes the OpenAPI spec parameters for the // given endpoint HTTP headers and cookies. func paramsFromHeadersAndCookies(endpoint *expr.HTTPEndpointExpr, rand *expr.ExampleGenerator) []*Parameter { - params := []*Parameter{} - expr.WalkMappedAttr(endpoint.Headers, func(name, elem string, att *expr.AttributeExpr) error { + var params []*Parameter + + expr.WalkMappedAttr(endpoint.Headers, func(name, elem string, att *expr.AttributeExpr) error { // nolint: errcheck if strings.ToLower(elem) == "authorization" { // Headers named "Authorization" are ignored by OpenAPI v3. // Instead it uses the security and securitySchemes sections to @@ -45,7 +46,7 @@ func paramsFromHeadersAndCookies(endpoint *expr.HTTPEndpointExpr, rand *expr.Exa params = append(params, paramFor(att, elem, "header", required, rand)) return nil }) - expr.WalkMappedAttr(endpoint.Cookies, func(name, elem string, att *expr.AttributeExpr) error { + expr.WalkMappedAttr(endpoint.Cookies, func(name, elem string, att *expr.AttributeExpr) error { // nolint: errcheck required := endpoint.Cookies.IsRequiredNoDefault(name) params = append(params, paramFor(att, elem, "cookie", required, rand)) return nil diff --git a/vendor/goa.design/goa/v3/http/codegen/openapi/v3/response.go b/vendor/goa.design/goa/v3/http/codegen/openapi/v3/response.go index dad77bf9a0..103a07176d 100644 --- a/vendor/goa.design/goa/v3/http/codegen/openapi/v3/response.go +++ b/vendor/goa.design/goa/v3/http/codegen/openapi/v3/response.go @@ -23,7 +23,7 @@ func responseFromExpr(r *expr.HTTPResponseExpr, bodies map[int][]*openapi.Schema o := expr.AsObject(r.Headers.Type) if len(*o) > 0 { headers = make(map[string]*HeaderRef, len(*o)) - expr.WalkMappedAttr(r.Headers, func(name, elem string, attr *expr.AttributeExpr) error { + expr.WalkMappedAttr(r.Headers, func(name, elem string, attr *expr.AttributeExpr) error { // nolint: errcheck header := &Header{ Description: attr.Description, Required: r.Headers.IsRequiredNoDefault(name), diff --git a/vendor/goa.design/goa/v3/http/codegen/openapi/v3/types.go b/vendor/goa.design/goa/v3/http/codegen/openapi/v3/types.go index ad570927c1..9d4bed73a7 100644 --- a/vendor/goa.design/goa/v3/http/codegen/openapi/v3/types.go +++ b/vendor/goa.design/goa/v3/http/codegen/openapi/v3/types.go @@ -362,7 +362,7 @@ func toString(val any) string { // structurally equivalent element types, maps with structurally equivalent key // and value types or object with identical attribute names and structurally // equivalent types and identical set of required attributes. -func (sf *schemafier) hashAttribute(att *expr.AttributeExpr, h hash.Hash64) uint64 { +func (*schemafier) hashAttribute(att *expr.AttributeExpr, h hash.Hash64) uint64 { return *hashAttribute(att, h, make(map[string]*uint64)) } diff --git a/vendor/goa.design/goa/v3/http/codegen/server.go b/vendor/goa.design/goa/v3/http/codegen/server.go index 3ba6275f07..63f5b47ebb 100644 --- a/vendor/goa.design/goa/v3/http/codegen/server.go +++ b/vendor/goa.design/goa/v3/http/codegen/server.go @@ -35,7 +35,7 @@ func serverFile(genpkg string, svc *expr.HTTPServiceExpr) *codegen.File { path := filepath.Join(codegen.Gendir, "http", svcName, "server", "server.go") title := fmt.Sprintf("%s HTTP server", svc.Name()) funcs := map[string]any{ - "join": func(ss []string, s string) string { return strings.Join(ss, s) }, + "join": strings.Join, "hasWebSocket": hasWebSocket, "isWebSocketEndpoint": isWebSocketEndpoint, "viewedServerBody": viewedServerBody, diff --git a/vendor/goa.design/goa/v3/http/codegen/server_types.go b/vendor/goa.design/goa/v3/http/codegen/server_types.go index 0e7155b033..8237f484b6 100644 --- a/vendor/goa.design/goa/v3/http/codegen/server_types.go +++ b/vendor/goa.design/goa/v3/http/codegen/server_types.go @@ -26,23 +26,22 @@ func ServerTypeFiles(genpkg string, root *expr.RootExpr) []*codegen.File { // slices, maps or objects always use pointers either implicitly - slices and // maps - or explicitly - objects. // -// * The payload struct fields (if a struct) hold pointers when not required +// - The payload struct fields (if a struct) hold pointers when not required // and have no default value. // -// * Request body fields (if the body is a struct) always hold pointers to +// - Request body fields (if the body is a struct) always hold pointers to // allow for explicit validation. // -// * Request header, path and query string parameter variables hold pointers +// - Request header, path and query string parameter variables hold pointers // when not required. Request header, body fields and param variables that // have default values are never required (enforced by DSL engine). // -// * The result struct fields (if a struct) hold pointers when not required +// - The result struct fields (if a struct) hold pointers when not required // or have a default value (so generated code can set when null) // -// * Response body fields (if the body is a struct) and header variables hold +// - Response body fields (if the body is a struct) and header variables hold // pointers when not required and have no default value. -// -func serverType(genpkg string, svc *expr.HTTPServiceExpr, seen map[string]struct{}) *codegen.File { +func serverType(genpkg string, svc *expr.HTTPServiceExpr, _ map[string]struct{}) *codegen.File { var ( path string data = HTTPServices.Get(svc.Name()) @@ -230,7 +229,7 @@ func fieldCode(init *InitData, typ string) string { // because the headers and params cannot be user types. c, _, err := codegen.InitStructFields(initArgs, varn, "", init.ReturnTypePkg) if err != nil { - panic(err) //bug + panic(err) // bug } return c } diff --git a/vendor/goa.design/goa/v3/http/codegen/service_data.go b/vendor/goa.design/goa/v3/http/codegen/service_data.go index 74a9f7ff29..deb078447b 100644 --- a/vendor/goa.design/goa/v3/http/codegen/service_data.go +++ b/vendor/goa.design/goa/v3/http/codegen/service_data.go @@ -580,7 +580,7 @@ func (svc *ServiceData) Endpoint(name string) *EndpointData { // analyze creates the data necessary to render the code of the given service. // It records the user types needed by the service definition in userTypes. -func (d ServicesData) analyze(hs *expr.HTTPServiceExpr) *ServiceData { +func (ServicesData) analyze(hs *expr.HTTPServiceExpr) *ServiceData { svc := service.Services.Get(hs.ServiceExpr.Name) scope := codegen.NewNameScope() scope.Unique("c") // 'c' is reserved as the client's receiver name. @@ -2314,7 +2314,7 @@ func buildResponseBodyType(body, att *expr.AttributeExpr, loc *codegen.Location, func extractPathParams(a *expr.MappedAttributeExpr, service *expr.AttributeExpr, scope *codegen.NameScope) []*ParamData { var params []*ParamData - codegen.WalkMappedAttr(a, func(name, elem string, _ bool, c *expr.AttributeExpr) error { + codegen.WalkMappedAttr(a, func(name, elem string, _ bool, c *expr.AttributeExpr) error { // nolint: errcheck // The StringSlice field of ParamData must be false for aliased primitive types var stringSlice bool if arr := expr.AsArray(c.Type); arr != nil { @@ -2371,7 +2371,7 @@ func extractPathParams(a *expr.MappedAttributeExpr, service *expr.AttributeExpr, func extractQueryParams(a *expr.MappedAttributeExpr, service *expr.AttributeExpr, scope *codegen.NameScope) []*ParamData { var params []*ParamData - codegen.WalkMappedAttr(a, func(name, elem string, required bool, c *expr.AttributeExpr) error { + codegen.WalkMappedAttr(a, func(name, elem string, required bool, c *expr.AttributeExpr) error { // nolint: errcheck // The StringSlice field of ParamData must be false for aliased primitive types var stringSlice bool if arr := expr.AsArray(c.Type); arr != nil { @@ -2390,7 +2390,8 @@ func extractQueryParams(a *expr.MappedAttributeExpr, service *expr.AttributeExpr pointer bool fptr bool ) - if pointer = a.IsPrimitivePointer(name, true); pointer { + pointer = a.IsPrimitivePointer(name, true) + if pointer { typeRef = "*" + typeRef } fieldName := codegen.Goify(name, true) @@ -2437,7 +2438,7 @@ func extractQueryParams(a *expr.MappedAttributeExpr, service *expr.AttributeExpr func extractHeaders(a *expr.MappedAttributeExpr, svcAtt *expr.AttributeExpr, svcCtx *codegen.AttributeContext, scope *codegen.NameScope) []*HeaderData { var headers []*HeaderData - codegen.WalkMappedAttr(a, func(name, elem string, required bool, _ *expr.AttributeExpr) error { + codegen.WalkMappedAttr(a, func(name, elem string, required bool, _ *expr.AttributeExpr) error { // nolint: errcheck var attr *expr.AttributeExpr if attr = svcAtt.Find(name); attr == nil { attr = svcAtt @@ -2504,7 +2505,7 @@ func extractHeaders(a *expr.MappedAttributeExpr, svcAtt *expr.AttributeExpr, svc func extractCookies(a *expr.MappedAttributeExpr, svcAtt *expr.AttributeExpr, svcCtx *codegen.AttributeContext, scope *codegen.NameScope) []*CookieData { var cookies []*CookieData - codegen.WalkMappedAttr(a, func(name, elem string, required bool, _ *expr.AttributeExpr) error { + codegen.WalkMappedAttr(a, func(name, elem string, required bool, _ *expr.AttributeExpr) error { // nolint: errcheck var hattr *expr.AttributeExpr { if hattr = svcAtt.Find(name); hattr == nil { diff --git a/vendor/goa.design/goa/v3/http/codegen/typedef.go b/vendor/goa.design/goa/v3/http/codegen/typedef.go index 65af318a51..19d1602143 100644 --- a/vendor/goa.design/goa/v3/http/codegen/typedef.go +++ b/vendor/goa.design/goa/v3/http/codegen/typedef.go @@ -12,11 +12,11 @@ import ( // It differs from the function defined in the codegen package in the following // ways: // -// - It defines marshaler tags on each fields using the HTTP element names. +// - It defines marshaler tags on each fields using the HTTP element names. // -// - It produced fields with pointers even if the corresponding attribute is -// required when ptr is true so that the generated code may validate -// explicitly. +// - It produced fields with pointers even if the corresponding attribute is +// required when ptr is true so that the generated code may validate +// explicitly. // // useDefault directs whether fields holding primitive types with default values // should hold pointers when ptr is false. If it is true then the fields are @@ -51,7 +51,7 @@ func goTypeDef(scope *codegen.NameScope, att *expr.AttributeExpr, ptr, useDefaul ss = append(ss, "struct {") ma := expr.NewMappedAttributeExpr(att) mat := ma.Attribute() - codegen.WalkMappedAttr(ma, func(name, elem string, required bool, at *expr.AttributeExpr) error { + codegen.WalkMappedAttr(ma, func(name, elem string, _ bool, at *expr.AttributeExpr) error { // nolint: errcheck var ( fn string tdef string diff --git a/vendor/goa.design/goa/v3/http/middleware/debug.go b/vendor/goa.design/goa/v3/http/middleware/debug.go index 37c7ad6fd8..ad7c530333 100644 --- a/vendor/goa.design/goa/v3/http/middleware/debug.go +++ b/vendor/goa.design/goa/v3/http/middleware/debug.go @@ -100,7 +100,7 @@ func Debug(mux goahttp.Muxer, w io.Writer) func(http.Handler) http.Handler { } } buf.WriteByte('\n') - w.Write(buf.Bytes()) + w.Write(buf.Bytes()) // nolint: errcheck }) } } @@ -129,6 +129,6 @@ func (r *responseDupper) Hijack() (net.Conn, *bufio.ReadWriter, error) { // Do not use as a reliable way to get unique IDs, instead use for things like logging. func shortID() string { b := make([]byte, 6) - io.ReadFull(rand.Reader, b) + io.ReadFull(rand.Reader, b) // nolint: errcheck return base64.RawURLEncoding.EncodeToString(b) } diff --git a/vendor/goa.design/goa/v3/http/middleware/log.go b/vendor/goa.design/goa/v3/http/middleware/log.go index 510a2e78ef..b8ad5a7d20 100644 --- a/vendor/goa.design/goa/v3/http/middleware/log.go +++ b/vendor/goa.design/goa/v3/http/middleware/log.go @@ -51,14 +51,14 @@ func log(l middleware.Logger, r *http.Request, w http.ResponseWriter, next http. } started := time.Now() - l.Log("id", reqID, + l.Log("id", reqID, // nolint: errcheck "req", r.Method+" "+r.URL.String(), "from", from(r)) rw := CaptureResponse(w) next.ServeHTTP(rw, r) - l.Log("id", reqID, + l.Log("id", reqID, // nolint: errcheck "status", rw.StatusCode, "bytes", rw.ContentLength, "time", time.Since(started).String()) diff --git a/vendor/goa.design/goa/v3/http/middleware/requestid.go b/vendor/goa.design/goa/v3/http/middleware/requestid.go index 0754364471..d5897f1532 100644 --- a/vendor/goa.design/goa/v3/http/middleware/requestid.go +++ b/vendor/goa.design/goa/v3/http/middleware/requestid.go @@ -32,7 +32,7 @@ func RequestID(options ...middleware.RequestIDOption) func(http.Handler) http.Ha ctx := r.Context() if useReqID { if id := r.Header.Get(reqIDHeader); id != "" { - ctx = context.WithValue(ctx, middleware.RequestIDKey, id) + ctx = context.WithValue(ctx, middleware.RequestIDKey, id) // nolint: staticcheck } } ctx = middleware.GenerateRequestID(ctx, o) diff --git a/vendor/goa.design/goa/v3/http/mux.go b/vendor/goa.design/goa/v3/http/mux.go index 1b5074faba..abf536816b 100644 --- a/vendor/goa.design/goa/v3/http/mux.go +++ b/vendor/goa.design/goa/v3/http/mux.go @@ -6,7 +6,7 @@ import ( "net/http" "regexp" - "github.com/dimfeld/httptreemux/v5" + chi "github.com/go-chi/chi/v5" ) type ( @@ -59,49 +59,59 @@ type ( Use(func(http.Handler) http.Handler) } - // mux is the default Muxer implementation. It leverages the - // httptreemux router and simply substitutes the syntax used to define - // wildcards from ":wildcard" and "*wildcard" to "{wildcard}" and - // "{*wildcard}" respectively. + // mux is the default Muxer implementation. mux struct { - *httptreemux.ContextMux + chi.Router + wildcard string } ) -// NewMuxer returns a Muxer implementation based on the httptreemux router. +// NewMuxer returns a Muxer implementation based on a Chi router. func NewMuxer() MiddlewareMuxer { - r := httptreemux.NewContextMux() - r.EscapeAddedRoutes = true - r.NotFoundHandler = func(w http.ResponseWriter, req *http.Request) { + r := chi.NewRouter() + r.NotFound(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { ctx := context.WithValue(req.Context(), AcceptTypeKey, req.Header.Get("Accept")) enc := ResponseEncoder(ctx, w) w.WriteHeader(http.StatusNotFound) - enc.Encode(NewErrorResponse(ctx, fmt.Errorf("404 page not found"))) - } - return &mux{r} + enc.Encode(NewErrorResponse(ctx, fmt.Errorf("404 page not found"))) // nolint:errcheck + })) + return &mux{Router: r} } -// Handle maps the wildcard format used by goa to the one used by httptreemux. +// wildPath matches a wildcard path segment. +var wildPath = regexp.MustCompile(`/{\*([a-zA-Z0-9_]+)}`) + +// Handle registers the handler function for the given method and pattern. func (m *mux) Handle(method, pattern string, handler http.HandlerFunc) { - m.ContextMux.Handle(method, treemuxify(pattern), handler) + if wildcards := wildPath.FindStringSubmatch(pattern); len(wildcards) > 0 { + if len(wildcards) > 2 { + panic("too many wildcards") + } + m.wildcard = wildcards[1] + pattern = wildPath.ReplaceAllString(pattern, "/*") + } + m.Method(method, pattern, handler) } // Vars extracts the path variables from the request context. func (m *mux) Vars(r *http.Request) map[string]string { - return httptreemux.ContextParams(r.Context()) + params := chi.RouteContext(r.Context()).URLParams + if len(params.Keys) == 0 { + return nil + } + vars := make(map[string]string, len(params.Keys)) + for i, k := range params.Keys { + if k == "*" { + vars[m.wildcard] = params.Values[i] + continue + } + vars[k] = params.Values[i] + } + return vars } // Use appends a middleware to the list of middlewares to be applied // downstream the Muxer. func (m *mux) Use(f func(http.Handler) http.Handler) { - m.ContextMux.UseHandler(f) -} - -var wildSeg = regexp.MustCompile(`/{([a-zA-Z0-9_]+)}`) -var wildPath = regexp.MustCompile(`/{\*([a-zA-Z0-9_]+)}`) - -func treemuxify(pattern string) string { - pattern = wildSeg.ReplaceAllString(pattern, "/:$1") - pattern = wildPath.ReplaceAllString(pattern, "/*$1") - return pattern + m.Router.Use(f) } diff --git a/vendor/goa.design/goa/v3/middleware/requestid.go b/vendor/goa.design/goa/v3/middleware/requestid.go index 557a9ba9e5..bfb37059fc 100644 --- a/vendor/goa.design/goa/v3/middleware/requestid.go +++ b/vendor/goa.design/goa/v3/middleware/requestid.go @@ -53,7 +53,7 @@ func GenerateRequestID(ctx context.Context, o *RequestIDOptions) context.Context id = shortID() } } - return context.WithValue(ctx, RequestIDKey, id) + return context.WithValue(ctx, RequestIDKey, id) // nolint: staticcheck } // UseRequestIDOption enables/disables using RequestID context key to store @@ -99,6 +99,6 @@ func (o *RequestIDOptions) RequestIDHeader() string { // Do not use as a reliable way to get unique IDs, instead use for things like logging. func shortID() string { b := make([]byte, 6) - io.ReadFull(rand.Reader, b) + io.ReadFull(rand.Reader, b) // nolint: errcheck return base64.RawURLEncoding.EncodeToString(b) } diff --git a/vendor/goa.design/goa/v3/middleware/trace.go b/vendor/goa.design/goa/v3/middleware/trace.go index c41df30209..1840a5a5ce 100644 --- a/vendor/goa.design/goa/v3/middleware/trace.go +++ b/vendor/goa.design/goa/v3/middleware/trace.go @@ -156,10 +156,10 @@ func DiscardFromTrace(discard *regexp.Regexp) TraceOption { // IDs. func WithSpan(ctx context.Context, traceID, spanID, parentID string) context.Context { if parentID != "" { - ctx = context.WithValue(ctx, TraceParentSpanIDKey, parentID) + ctx = context.WithValue(ctx, TraceParentSpanIDKey, parentID) // nolint: staticcheck } - ctx = context.WithValue(ctx, TraceIDKey, traceID) - ctx = context.WithValue(ctx, TraceSpanIDKey, spanID) + ctx = context.WithValue(ctx, TraceIDKey, traceID) // nolint: staticcheck + ctx = context.WithValue(ctx, TraceSpanIDKey, spanID) // nolint: staticcheck return ctx } @@ -172,10 +172,10 @@ func WrapLogger(l Logger, traceID string) Logger { // Log logs the trace ID when present then the values passed as argument. func (l *tracedLogger) Log(keyvals ...any) error { if l.traceID == "" { - l.logger.Log(keyvals...) + l.logger.Log(keyvals...) // nolint: errcheck return nil } keyvals = append([]any{"trace", l.traceID}, keyvals...) - l.logger.Log(keyvals) + l.logger.Log(keyvals) // nolint: errcheck return nil } diff --git a/vendor/goa.design/goa/v3/pkg/error.go b/vendor/goa.design/goa/v3/pkg/error.go index 5649cb7748..03f1378e65 100644 --- a/vendor/goa.design/goa/v3/pkg/error.go +++ b/vendor/goa.design/goa/v3/pkg/error.go @@ -191,7 +191,7 @@ func NewErrorID() string { // trade-off between probability of clashes and length of ID (6 * 4/3 = // 8 chars) since clashes are not catastrophic. b := make([]byte, 6) - io.ReadFull(rand.Reader, b) + io.ReadFull(rand.Reader, b) // nolint: errcheck return base64.RawURLEncoding.EncodeToString(b) } diff --git a/vendor/goa.design/goa/v3/pkg/version.go b/vendor/goa.design/goa/v3/pkg/version.go index 62c11cc655..beca2ca9fa 100644 --- a/vendor/goa.design/goa/v3/pkg/version.go +++ b/vendor/goa.design/goa/v3/pkg/version.go @@ -10,9 +10,9 @@ const ( // Major version number Major = 3 // Minor version number - Minor = 12 + Minor = 13 // Build number - Build = 4 + Build = 0 // Suffix - set to empty string in release tag commits. Suffix = "" ) diff --git a/vendor/modules.txt b/vendor/modules.txt index 05c9eab046..6ee019c3dd 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -85,9 +85,6 @@ github.com/davecgh/go-spew/spew # github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 ## explicit github.com/dimfeld/httppath -# github.com/dimfeld/httptreemux/v5 v5.5.0 -## explicit; go 1.9 -github.com/dimfeld/httptreemux/v5 # github.com/docker/cli v24.0.0+incompatible ## explicit github.com/docker/cli/cli/config @@ -123,6 +120,9 @@ github.com/felixge/httpsnoop # github.com/fsnotify/fsnotify v1.6.0 ## explicit; go 1.16 github.com/fsnotify/fsnotify +# github.com/go-chi/chi/v5 v5.0.10 +## explicit; go 1.14 +github.com/go-chi/chi/v5 # github.com/go-co-op/gocron v1.33.1 ## explicit; go 1.16 github.com/go-co-op/gocron @@ -152,7 +152,7 @@ github.com/go-openapi/jsonpointer ## explicit; go 1.13 github.com/go-openapi/jsonreference github.com/go-openapi/jsonreference/internal -# github.com/go-openapi/swag v0.22.3 +# github.com/go-openapi/swag v0.22.4 ## explicit; go 1.18 github.com/go-openapi/swag # github.com/go-testfixtures/testfixtures/v3 v3.9.0 @@ -676,7 +676,7 @@ go.uber.org/zap/internal/pool go.uber.org/zap/internal/ztest go.uber.org/zap/zapcore go.uber.org/zap/zaptest -# goa.design/goa/v3 v3.12.4 +# goa.design/goa/v3 v3.13.0 ## explicit; go 1.20 goa.design/goa/v3/codegen goa.design/goa/v3/codegen/cli