From ed3fb0dad329331b7eb2c1490e189bfff92bf79e Mon Sep 17 00:00:00 2001 From: ruflin Date: Wed, 3 Jun 2020 11:16:28 +0200 Subject: [PATCH 1/3] Add basic openapi definition file This is a very basic file to document the package-registry API with the OpenAPI spec. Many things like example events or schemas were left out. The goal is to have a simple foundation in and iterate on top of it. --- openapi.yml | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 openapi.yml diff --git a/openapi.yml b/openapi.yml new file mode 100644 index 000000000..d36379fab --- /dev/null +++ b/openapi.yml @@ -0,0 +1,100 @@ +openapi: 3.0.0 +info: + title: EPR + version: '1.0' + license: + name: Elastic-License + url: 'https://github.com/elastic/package-registry/blob/master/LICENSE.txt' + description: Elastic Package Registry + contact: + name: Nicolas Ruflin + email: spam@ruflin.com +servers: + - url: 'https://epr.elastic.co' + description: public + - url: 'https://epr-staging.elastic.co' + description: staging + - url: 'http://localhost:8080' + description: local +paths: + /: + get: + summary: GET info + tags: [] + responses: + '200': + description: OK + content: + application/json: + operationId: get + description: Info about the registry + /categories: + get: + summary: GET categories + tags: [] + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Category' + examples: + example-1: + value: + - id: logs + title: Logs + count: 20 + - id: metrics + title: Metrics + count: 17 + operationId: get-categories + description: List of the existing package categories and how many packages are in each category + /search: + get: + summary: Search packages + tags: [] + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + operationId: get-search + description: Search for packages. By default returns all the most recent packages available. + parameters: + - schema: + type: string + in: query + name: kibana + description: 'Filters out all the packages which are not compatible with the given Kibana version. If it is set to 7.3.1 and a package requires 7.4, the package will not be returned or an older compatible package will be shown. By default this endpoint always returns only the newest compatible package.' + - schema: + type: string + in: query + name: category + description: Filters the package by the given category. Available categories can be seend when going to /categories endpoint. + - schema: + type: string + in: query + name: package + description: 'Filters by a specific package name, for example mysql. In contrast to the other endpoints, it will return by default all versions of this package.' + - schema: + type: string + in: query + name: internal + description: 'This can be set to true, to also list internal packages. This is set to false by default.' + /package: + get: + summary: GET package info + tags: [] + responses: + '200': + description: OK + content: + application/json: + operationId: get-package + description: Info about a package + securitySchemes: {} From 059a25c0ebde08f8492347a1a62efcbb4bcfcbe1 Mon Sep 17 00:00:00 2001 From: ruflin Date: Wed, 3 Jun 2020 11:26:06 +0200 Subject: [PATCH 2/3] add object types --- openapi.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/openapi.yml b/openapi.yml index d36379fab..9173647b9 100644 --- a/openapi.yml +++ b/openapi.yml @@ -26,6 +26,8 @@ paths: description: OK content: application/json: + schema: + type: object operationId: get description: Info about the registry /categories: @@ -39,8 +41,6 @@ paths: application/json: schema: type: array - items: - $ref: '#/components/schemas/Category' examples: example-1: value: @@ -95,6 +95,7 @@ paths: description: OK content: application/json: + schema: + type: object operationId: get-package description: Info about a package - securitySchemes: {} From 5138c98e19d2e018d60408945c52c8a2053dc038 Mon Sep 17 00:00:00 2001 From: ruflin Date: Wed, 3 Jun 2020 11:48:28 +0200 Subject: [PATCH 3/3] add details for package paths --- openapi.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/openapi.yml b/openapi.yml index 9173647b9..5fa3aec4f 100644 --- a/openapi.yml +++ b/openapi.yml @@ -86,7 +86,7 @@ paths: in: query name: internal description: 'This can be set to true, to also list internal packages. This is set to false by default.' - /package: + '/package/{package}/{version}': get: summary: GET package info tags: [] @@ -99,3 +99,16 @@ paths: type: object operationId: get-package description: Info about a package + parameters: + - schema: + type: string + name: package + in: path + description: Name of the package + required: true + - schema: + type: string + name: version + in: path + required: true + description: Version of the package