From 2ecff847f8f02dd236728dafef750f1cf8e1d8f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20SZKIBA?= Date: Tue, 3 Sep 2024 13:36:49 +0200 Subject: [PATCH 01/12] feat: not k6registry's responsibility --- docs/example-api/openapi.yaml | 310 ------------------------------- docs/openapi.yaml | 310 ------------------------------- docs/registry.schema.yaml | 340 ---------------------------------- 3 files changed, 960 deletions(-) delete mode 100644 docs/example-api/openapi.yaml delete mode 100644 docs/openapi.yaml delete mode 100644 docs/registry.schema.yaml diff --git a/docs/example-api/openapi.yaml b/docs/example-api/openapi.yaml deleted file mode 100644 index 5191f38..0000000 --- a/docs/example-api/openapi.yaml +++ /dev/null @@ -1,310 +0,0 @@ -openapi: "3.1.0" -info: - version: "0.1.0" - title: Grafana k6 Extension Registry Service - description: | - The **Grafana k6 Extension Registry Service** enables read-only access to the Grafana k6 extension registry. - - Information about modifying the registry (register new extensions, modify or delete existing registrations) can be found in the [grafana/k6-extension-registry](https://github.com/grafana/k6-extension-registry) GitHub repository. - termsOfService: https://grafana.com/legal/terms/ - license: - name: AGPL-3.0-only - url: https://www.gnu.org/licenses/agpl-3.0.html -externalDocs: - description: Find out more about Grafana k6 extensions - url: https://grafana.com/docs/k6/latest/extensions/ -servers: - - url: https://registry.k6.io -tags: - - name: global - description: Access to the entire registry - - name: module - description: Query a specific extension - - name: catalog - description: Extension catalog queries - - name: subset - description: Query subsets of the registry -paths: - /registry.json: - get: - tags: - - global - summary: Download the entire registry - description: Download the entire registry as a single JSON file - operationId: downloadRegistry - responses: - "200": - description: successful operation - content: - application/json: - schema: - $ref: "registry.schema.json#/$defs/registry" - /catalog.json: - get: - tags: - - catalog - summary: Download the entire catalog - description: Download the entire catalog as a single JSON file - operationId: downloadCatalog - responses: - "200": - description: successful operation - content: - application/json: - schema: - $ref: "registry.schema.json#/$defs/catalog" - /module/{module}/extension.json: - get: - tags: - - module - summary: Query the data of a specific extension - description: Query the data of a specific extension as a single JSON file - operationId: getExtension - parameters: - - $ref: "#/components/parameters/module" - responses: - "200": - description: successful operation - content: - application/json: - schema: - $ref: "registry.schema.json#/$defs/extension" - "404": - description: module not found - /module/{module}/badge.svg: - get: - tags: - - module - summary: Download extension badge - description: Download an extension's badge as an SVG image - operationId: getBadge - parameters: - - $ref: "#/components/parameters/module" - produces: - - image/svg+xml - responses: - "200": - description: successful operation - "404": - description: module not found - /product/{product}.json: - get: - tags: - - subset - summary: Query extensions available in a product - description: Querying the subset of the registry containing the extensions available in the product specified in the parameter - operationId: queryByProduct - parameters: - - $ref: "#/components/parameters/product" - responses: - "200": - description: successful operation - content: - application/json: - schema: - $ref: "registry.schema.json#/$defs/registry" - "404": - description: product not found - /product/{product}-catalog.json: - get: - tags: - - catalog - summary: Catalog by product - description: Query the catalog containing extensions available in a given product. - operationId: catalogByProduct - parameters: - - $ref: "#/components/parameters/product" - responses: - "200": - description: successful operation - content: - application/json: - schema: - $ref: "registry.schema.json#/$defs/catalog" - "404": - description: product not found - /tier/{tier}.json: - get: - tags: - - subset - summary: Query extensions by source of support - description: Querying the subset of the registry containing the extensions with support specified in the parameter - operationId: queryByTier - parameters: - - $ref: "#/components/parameters/tier" - responses: - "200": - description: successful operation - content: - application/json: - schema: - $ref: "registry.schema.json#/$defs/registry" - "404": - description: tier not found - /tier/{tier}-catalog.json: - get: - tags: - - catalog - summary: Catalog by support - description: Query the catalog containing extensions available with a given support. - operationId: catalogByTier - parameters: - - $ref: "#/components/parameters/tier" - responses: - "200": - description: successful operation - content: - application/json: - schema: - $ref: "registry.schema.json#/$defs/catalog" - "404": - description: tier not found - /tier/at-least/{tier}.json: - get: - tags: - - subset - summary: Query extensions by specifying minimum support - description: Query the subset of the registry that contains the extensions whose support is at least the level specified as a parameter. - operationId: queryAtLeastTier - parameters: - - $ref: "#/components/parameters/tier" - responses: - "200": - description: successful operation - content: - application/json: - schema: - $ref: "registry.schema.json#/$defs/registry" - "404": - description: tier not found - /tier/at-least/{tier}-catalog.json: - get: - tags: - - catalog - summary: Catalog by specifying minimum support - description: Query the catalog containing extensions available with at least the support specified as a parameter. - operationId: catalogAtLeastTier - parameters: - - $ref: "#/components/parameters/tier" - responses: - "200": - description: successful operation - content: - application/json: - schema: - $ref: "registry.schema.json#/$defs/catalog" - "404": - description: tier not found - /category/{category}.json: - get: - tags: - - subset - summary: Query extensions by category - description: Querying the subset of the registry containing extensions belonging to the category specified in the parameter - operationId: queryByCategory - parameters: - - $ref: "#/components/parameters/category" - responses: - "200": - description: successful operation - content: - application/json: - schema: - $ref: "registry.schema.json#/$defs/registry" - "404": - description: category not found - /grade/{grade}.json: - get: - tags: - - subset - summary: Query extensions by grade - description: Querying the subset of the registry containing the extensions with the compliance grade specified in the parameter - operationId: queryByGrade - parameters: - - $ref: "#/components/parameters/grade" - responses: - "200": - description: successful operation - content: - application/json: - schema: - $ref: "registry.schema.json#/$defs/registry" - "404": - description: grade not found - /grade/at-least/{grade}.json: - get: - tags: - - subset - summary: Query extensions by passing grade - description: Querying the subset of the registry containing extensions with at least compliance grade specified in the parameter - operationId: queryByPassingGrade - parameters: - - $ref: "#/components/parameters/grade" - responses: - "200": - description: successful operation - content: - application/json: - schema: - $ref: "registry.schema.json#/$defs/registry" - "404": - description: grade not found - -components: - parameters: - module: - in: path - name: module - required: true - description: go module path of the extension - examples: - xk6-dashboard: - value: "github.com/grafana/xk6-dashboard" - xk6-sql: - value: "github.com/grafana/xk6-sql" - schema: - type: string - grade: - in: path - name: grade - required: true - description: grade to be queried - examples: - A: - value: "A" - C: - value: "C" - schema: - $ref: "registry.schema.json#/$defs/grade" - category: - in: path - name: category - required: true - description: category to be queried - example: "data" - schema: - $ref: "registry.schema.json#/$defs/category" - tier: - in: path - name: tier - required: true - description: tier to be queried - examples: - official: - value: "official" - community: - value: "community" - schema: - $ref: "registry.schema.json#/$defs/tier" - product: - in: path - name: product - required: true - description: product to be queried - examples: - oss: - value: "oss" - cloud: - value: "cloud" - schema: - $ref: "registry.schema.json#/$defs/product" diff --git a/docs/openapi.yaml b/docs/openapi.yaml deleted file mode 100644 index 5191f38..0000000 --- a/docs/openapi.yaml +++ /dev/null @@ -1,310 +0,0 @@ -openapi: "3.1.0" -info: - version: "0.1.0" - title: Grafana k6 Extension Registry Service - description: | - The **Grafana k6 Extension Registry Service** enables read-only access to the Grafana k6 extension registry. - - Information about modifying the registry (register new extensions, modify or delete existing registrations) can be found in the [grafana/k6-extension-registry](https://github.com/grafana/k6-extension-registry) GitHub repository. - termsOfService: https://grafana.com/legal/terms/ - license: - name: AGPL-3.0-only - url: https://www.gnu.org/licenses/agpl-3.0.html -externalDocs: - description: Find out more about Grafana k6 extensions - url: https://grafana.com/docs/k6/latest/extensions/ -servers: - - url: https://registry.k6.io -tags: - - name: global - description: Access to the entire registry - - name: module - description: Query a specific extension - - name: catalog - description: Extension catalog queries - - name: subset - description: Query subsets of the registry -paths: - /registry.json: - get: - tags: - - global - summary: Download the entire registry - description: Download the entire registry as a single JSON file - operationId: downloadRegistry - responses: - "200": - description: successful operation - content: - application/json: - schema: - $ref: "registry.schema.json#/$defs/registry" - /catalog.json: - get: - tags: - - catalog - summary: Download the entire catalog - description: Download the entire catalog as a single JSON file - operationId: downloadCatalog - responses: - "200": - description: successful operation - content: - application/json: - schema: - $ref: "registry.schema.json#/$defs/catalog" - /module/{module}/extension.json: - get: - tags: - - module - summary: Query the data of a specific extension - description: Query the data of a specific extension as a single JSON file - operationId: getExtension - parameters: - - $ref: "#/components/parameters/module" - responses: - "200": - description: successful operation - content: - application/json: - schema: - $ref: "registry.schema.json#/$defs/extension" - "404": - description: module not found - /module/{module}/badge.svg: - get: - tags: - - module - summary: Download extension badge - description: Download an extension's badge as an SVG image - operationId: getBadge - parameters: - - $ref: "#/components/parameters/module" - produces: - - image/svg+xml - responses: - "200": - description: successful operation - "404": - description: module not found - /product/{product}.json: - get: - tags: - - subset - summary: Query extensions available in a product - description: Querying the subset of the registry containing the extensions available in the product specified in the parameter - operationId: queryByProduct - parameters: - - $ref: "#/components/parameters/product" - responses: - "200": - description: successful operation - content: - application/json: - schema: - $ref: "registry.schema.json#/$defs/registry" - "404": - description: product not found - /product/{product}-catalog.json: - get: - tags: - - catalog - summary: Catalog by product - description: Query the catalog containing extensions available in a given product. - operationId: catalogByProduct - parameters: - - $ref: "#/components/parameters/product" - responses: - "200": - description: successful operation - content: - application/json: - schema: - $ref: "registry.schema.json#/$defs/catalog" - "404": - description: product not found - /tier/{tier}.json: - get: - tags: - - subset - summary: Query extensions by source of support - description: Querying the subset of the registry containing the extensions with support specified in the parameter - operationId: queryByTier - parameters: - - $ref: "#/components/parameters/tier" - responses: - "200": - description: successful operation - content: - application/json: - schema: - $ref: "registry.schema.json#/$defs/registry" - "404": - description: tier not found - /tier/{tier}-catalog.json: - get: - tags: - - catalog - summary: Catalog by support - description: Query the catalog containing extensions available with a given support. - operationId: catalogByTier - parameters: - - $ref: "#/components/parameters/tier" - responses: - "200": - description: successful operation - content: - application/json: - schema: - $ref: "registry.schema.json#/$defs/catalog" - "404": - description: tier not found - /tier/at-least/{tier}.json: - get: - tags: - - subset - summary: Query extensions by specifying minimum support - description: Query the subset of the registry that contains the extensions whose support is at least the level specified as a parameter. - operationId: queryAtLeastTier - parameters: - - $ref: "#/components/parameters/tier" - responses: - "200": - description: successful operation - content: - application/json: - schema: - $ref: "registry.schema.json#/$defs/registry" - "404": - description: tier not found - /tier/at-least/{tier}-catalog.json: - get: - tags: - - catalog - summary: Catalog by specifying minimum support - description: Query the catalog containing extensions available with at least the support specified as a parameter. - operationId: catalogAtLeastTier - parameters: - - $ref: "#/components/parameters/tier" - responses: - "200": - description: successful operation - content: - application/json: - schema: - $ref: "registry.schema.json#/$defs/catalog" - "404": - description: tier not found - /category/{category}.json: - get: - tags: - - subset - summary: Query extensions by category - description: Querying the subset of the registry containing extensions belonging to the category specified in the parameter - operationId: queryByCategory - parameters: - - $ref: "#/components/parameters/category" - responses: - "200": - description: successful operation - content: - application/json: - schema: - $ref: "registry.schema.json#/$defs/registry" - "404": - description: category not found - /grade/{grade}.json: - get: - tags: - - subset - summary: Query extensions by grade - description: Querying the subset of the registry containing the extensions with the compliance grade specified in the parameter - operationId: queryByGrade - parameters: - - $ref: "#/components/parameters/grade" - responses: - "200": - description: successful operation - content: - application/json: - schema: - $ref: "registry.schema.json#/$defs/registry" - "404": - description: grade not found - /grade/at-least/{grade}.json: - get: - tags: - - subset - summary: Query extensions by passing grade - description: Querying the subset of the registry containing extensions with at least compliance grade specified in the parameter - operationId: queryByPassingGrade - parameters: - - $ref: "#/components/parameters/grade" - responses: - "200": - description: successful operation - content: - application/json: - schema: - $ref: "registry.schema.json#/$defs/registry" - "404": - description: grade not found - -components: - parameters: - module: - in: path - name: module - required: true - description: go module path of the extension - examples: - xk6-dashboard: - value: "github.com/grafana/xk6-dashboard" - xk6-sql: - value: "github.com/grafana/xk6-sql" - schema: - type: string - grade: - in: path - name: grade - required: true - description: grade to be queried - examples: - A: - value: "A" - C: - value: "C" - schema: - $ref: "registry.schema.json#/$defs/grade" - category: - in: path - name: category - required: true - description: category to be queried - example: "data" - schema: - $ref: "registry.schema.json#/$defs/category" - tier: - in: path - name: tier - required: true - description: tier to be queried - examples: - official: - value: "official" - community: - value: "community" - schema: - $ref: "registry.schema.json#/$defs/tier" - product: - in: path - name: product - required: true - description: product to be queried - examples: - oss: - value: "oss" - cloud: - value: "cloud" - schema: - $ref: "registry.schema.json#/$defs/product" diff --git a/docs/registry.schema.yaml b/docs/registry.schema.yaml deleted file mode 100644 index 92ac8c5..0000000 --- a/docs/registry.schema.yaml +++ /dev/null @@ -1,340 +0,0 @@ -$id: https://grafana.github.io/k6registry/registry.schema.json -$ref: "#/$defs/registry" -$defs: - registry: - description: | - k6 Extension Registry. - - The k6 extension registry contains the most important properties of registered extensions. - type: array - items: - $ref: "#/$defs/extension" - additionalProperties: false - catalog: - description: | - k6 Extension Catalog. - - The k6 extension catalog is an alternative representation of the k6 extension registry. - The catalog stores the extension data in an associative array (object), - where the key is the imprt path for JavaScript extensions, and the output name for output extensions. - This data structure is optimized to resolve extensions as dependencies. - type: object - additionalProperties: - $ref: "#/$defs/extension" - extension: - type: object - description: | - Properties of the registered k6 extension. - - Only those properties of the extensions are registered, which either cannot be detected automatically, or delegation to the extension is not allowed. - - Properties that are available using the repository manager API are intentionally not registered. - - The string like properties that are included in the generated Grafana documentation are intentionally not accessed via the API of the repository manager. It is not allowed to inject arbitrary text into the Grafana documentation site without approval. Therefore, these properties are registered (eg `description`) - properties: - module: - type: string - description: | - The extension's go module path. - - This is the unique identifier of the extension. - More info about module paths: https://go.dev/ref/mod#module-path - - The extension has no name property, the module path or part of it can be used as the extension name. For example, using the first two elements of the module path after the host name, the name `grafana/xk6-dashboard` can be formed from the module path `github.com/grafana/xk6-dashboard`. This is typically the repository owner name and the repository name in the repository manager. - - The extension has no URL property, a URL can be created from the module path that refers to the extension within the repository manager. - examples: - - github.com/grafana/xk6-dashboard - - github.com/szkiba/xk6-top - imports: - type: array - items: - type: string - pattern: "^k6/x/" - description: | - List of JavaScript import paths registered by the extension. - - Currently, paths must start with the prefix `k6/x/`. - - The extensions used by k6 scripts are automatically detected based on the values specified here, therefore it is important that the values used here are consistent with the values registered by the extension at runtime. - examples: - - ["k6/x/csv", "k6/x/csv/stream"] - - ["k6/x/toml"] - outputs: - type: array - items: - type: string - description: | - List of output names registered by the extension. - - The extensions used by k6 scripts are automatically detected based on the values specified here, therefore it is important that the values used here are consistent with the values registered by the extension at runtime. - examples: - - ["dashboard"] - - ["plugin"] - description: - type: string - description: | - Brief description of the extension. - versions: - type: array - items: - type: string - description: | - List of supported versions. - - Versions are tags whose format meets the requirements of semantic versioning. Version tags often start with the letter `v`, which is not part of the semantic version. - examples: - - ["v0.1.0", "v0.2.0", "v0.2.1"] - repo: - $ref: "#/$defs/repository" - description: | - Repository metadata. - - Metadata provided by the extension's git repository manager. Repository metadata are not registered, they are queried at runtime using the repository manager API. - tier: - $ref: "#/$defs/tier" - default: "community" - description: | - Maintainer of the extension. - - Possible values: - - - official: Extensions owned, maintained, and designated by Grafana as "official" - - partner: Extensions written, maintained, validated, and published by third-party companies against their own projects. - - community: Extensions are listed on the Registry by individual maintainers, groups of maintainers, or other members of the k6 community. - - Extensions owned by the `grafana` GitHub organization are not officially supported by Grafana by default. - There are several k6 extensions owned by the `grafana` GitHub organization, which were created for experimental or example purposes only. - The `official` tier value is needed so that officially supported extensions can be distinguished from them. - - If it is missing from the registry source, it will be set with the default "community" value during generation. - - products: - type: array - items: - $ref: "#/$defs/product" - description: | - Products in which the extension can be used. - - Some extensions are not available in all k6 products. - This may be for a technological or business reason, or the functionality of the extension may not make sense in the given product. - - Possible values: - - - oss: Extensions are available in k6 OSS - - cloud: Extensions are available in Grafana Cloud k6 - - If the property is missing or empty in the source of the registry, it means that the extension is only available in the k6 OSS product. - In this case, the registry will be filled in accordingly during generation. - - categories: - type: array - items: - $ref: "#/$defs/category" - description: | - The categories to which the extension belongs. - - If the property is missing or empty in the registry source, the default value is "misc". - - Possible values: - - - authentication - - browser - - data - - kubernetes - - messaging - - misc - - observability - - protocol - - reporting - compliance: - $ref: "#/$defs/compliance" - description: | - The result of the extension's k6 compliance checks. - required: - - module - - description - additionalProperties: false - compliance: - description: | - The result of the extension's k6 compliance checks. - type: object - required: - - grade - - level - properties: - level: - description: | - Compliance expressed as a percentage. - - The `level` property contains a percentage of how well the extension complies with best practices. - The value of the `level` can be between `0-100` and is determined by the weighted and normalized sum of the scores of the compliance checks. - grade: - $ref: "#/$defs/grade" - description: | - Compliance expressed as a grade. - - The `grade` property contains a grade (A-F) of how well the extension complies with best practices. - The value of the `grade` can be `A`,`B`,`C`,`D`,`E`,`F` and is calculated from the `level` property. - type: integer - additionalProperties: false - grade: - description: | - The results of the checks are in the form of a grade. - type: string - enum: ["A", "B", "C", "D", "E", "F", "G"] - repository: - type: object - description: | - Repository metadata. - - Metadata provided by the extension's git repository manager. Repository metadata are not registered, they are queried at runtime using the repository manager API. - required: - - name - - owner - - url - properties: - name: - type: string - description: | - The name of the repository. - owner: - type: string - description: | - The owner of the repository. - url: - type: string - description: | - URL of the repository. - - The URL is provided by the repository manager and can be displayed in a browser. - homepage: - type: string - default: "" - description: | - The URL to the project homepage. - - If no homepage is set, the value is the same as the url property. - description: - type: string - default: "" - description: | - Repository description. - stars: - type: integer - default: "0" - description: | - The number of stars in the extension's repository. - - The extension's popularity is indicated by how many users have starred the extension's repository. - topics: - type: array - items: - type: string - description: | - Repository topics. - - Topics make it easier to find the repository. It is recommended to set the xk6 topic to the extensions repository. - public: - type: boolean - default: "false" - description: | - Public repository flag. - - A `true` value indicates that the repository is public, available to anyone. - license: - type: string - default: "" - description: | - The SPDX ID of the extension's license. - - For more information about SPDX, visit https://spdx.org/licenses/ - archived: - type: boolean - default: "false" - description: | - Archived repository flag. - - A `true` value indicates that the repository is archived, read only. - - If a repository is archived, it usually means that the owner has no intention of maintaining it. Such extensions should be removed from the registry. - timestamp: - type: number - default: 0 - description: | - Last modification timestamp. - - The timestamp property contains the timestamp of the last modification of the repository in UNIX time format (the number of non-leap seconds that have elapsed since 00:00:00 UTC on 1st January 1970). - Its value depends on the repository manager, in the case of GitHub it contains the time of the last push operation, in the case of GitLab the time of the last repository activity. - clone_url: - type: string - format: uri - default: "" - description: | - URL for the git clone operation. - - The clone_url property contains a (typically HTTP) URL, which is used to clone the repository. - tier: - type: string - enum: ["official", "partner", "community"] - description: | - Maintainer of the extension. - - Extensions can be classified according to who maintains the extension. - This usually also specifies who the user can get support from. - - Possible values: - - - official: Extensions owned, maintained, and designated by Grafana as "official" - - partner: Extensions written, maintained, validated, and published by third-party companies against their own projects. - - community: Extensions are listed on the Registry by individual maintainers, groups of maintainers, or other members of the k6 community. - - Extensions owned by the `grafana` GitHub organization are not officially supported by Grafana by default. - There are several k6 extensions owned by the `grafana` GitHub organization, which were created for experimental or example purposes only. - The `official` tier value is needed so that officially supported extensions can be distinguished from them. - - If it is missing from the registry source, it will be set with the default "community" value during generation. - product: - type: string - enum: ["oss", "cloud"] - description: | - Products in which the extension can be used. - - Some extensions are not available in all k6 products. - This may be for a technological or business reason, or the functionality of the extension may not make sense in the given product. - - Possible values: - - - oss: Extensions are available in k6 OSS - - cloud: Extensions are available in Grafana Cloud k6 - - If the property is missing or empty in the source of the registry, it means that the extension is only available in the k6 OSS product. - In this case, the registry will be filled in accordingly during generation. - category: - type: string - enum: - - authentication - - browser - - data - - kubernetes - - messaging - - misc - - observability - - protocol - - reporting - description: | - The categories to which the extension belongs. - - If the property is missing or empty in the registry source, the default value is "misc". - - Possible values: - - - authentication - - browser - - data - - kubernetes - - messaging - - misc - - observability - - protocol - - reporting From 67a5cf04277d421a803e1328fffd91ffc2f70d06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20SZKIBA?= Date: Tue, 3 Sep 2024 13:37:20 +0200 Subject: [PATCH 02/12] schema updated --- docs/registry.schema.json | 152 +++++++++++++++++++++++++++++++++----- registry_gen.go | 4 +- 2 files changed, 133 insertions(+), 23 deletions(-) diff --git a/docs/registry.schema.json b/docs/registry.schema.json index 14edef4..267a764 100644 --- a/docs/registry.schema.json +++ b/docs/registry.schema.json @@ -63,7 +63,8 @@ }, "description": { "type": "string", - "description": "Brief description of the extension.\n" + "description": "Brief description of the extension.\n", + "example": "This is a very cool extension, it displays the message 'Hello World!'\n" }, "versions": { "type": "array", @@ -86,21 +87,47 @@ "tier": { "$ref": "#/$defs/tier", "default": "community", - "description": "Maintainer of the extension.\n\nPossible values:\n\n - official: Extensions owned, maintained, and designated by Grafana as \"official\"\n - partner: Extensions written, maintained, validated, and published by third-party companies against their own projects.\n - community: Extensions are listed on the Registry by individual maintainers, groups of maintainers, or other members of the k6 community.\n\nExtensions owned by the `grafana` GitHub organization are not officially supported by Grafana by default.\nThere are several k6 extensions owned by the `grafana` GitHub organization, which were created for experimental or example purposes only.\nThe `official` tier value is needed so that officially supported extensions can be distinguished from them.\n\nIf it is missing from the registry source, it will be set with the default \"community\" value during generation.\n" + "description": "Maintainer of the extension.\n\nPossible values:\n\n - official: Extensions owned, maintained, and designated by Grafana as \"official\"\n - partner: Extensions written, maintained, validated, and published by third-party companies against their own projects.\n - community: Extensions are listed on the Registry by individual maintainers, groups of maintainers, or other members of the k6 community.\n\nExtensions owned by the `grafana` GitHub organization are not officially supported by Grafana by default.\nThere are several k6 extensions owned by the `grafana` GitHub organization, which were created for experimental or example purposes only.\nThe `official` tier value is needed so that officially supported extensions can be distinguished from them.\n\nIf it is missing from the registry source, it will be set with the default \"community\" value during generation.\n", + "examples": [ + "community", + "official" + ] }, "products": { "type": "array", "items": { "$ref": "#/$defs/product" }, - "description": "Products in which the extension can be used.\n\nSome extensions are not available in all k6 products.\nThis may be for a technological or business reason, or the functionality of the extension may not make sense in the given product.\n\nPossible values:\n\n - oss: Extensions are available in k6 OSS\n - cloud: Extensions are available in Grafana Cloud k6\n\nIf the property is missing or empty in the source of the registry, it means that the extension is only available in the k6 OSS product.\nIn this case, the registry will be filled in accordingly during generation.\n" + "description": "Products in which the extension can be used.\n\nSome extensions are not available in all k6 products.\nThis may be for a technological or business reason, or the functionality of the extension may not make sense in the given product.\n\nPossible values:\n\n - oss: Extensions are available in k6 OSS\n - cloud: Extensions are available in Grafana Cloud k6\n\nIf the property is missing or empty in the source of the registry, it means that the extension is only available in the k6 OSS product.\nIn this case, the registry will be filled in accordingly during generation.\n", + "examples": [ + [ + "cloud", + "oss" + ], + [ + "cloud" + ], + [ + "oss" + ] + ] }, "categories": { "type": "array", "items": { "$ref": "#/$defs/category" }, - "description": "The categories to which the extension belongs.\n\nIf the property is missing or empty in the registry source, the default value is \"misc\".\n\nPossible values:\n\n - authentication\n - browser\n - data\n - kubernetes\n - messaging\n - misc\n - observability\n - protocol\n - reporting\n" + "description": "The categories to which the extension belongs.\n\nIf the property is missing or empty in the registry source, the default value is \"misc\".\n\nPossible values:\n\n - authentication\n - browser\n - data\n - kubernetes\n - messaging\n - misc\n - observability\n - protocol\n - reporting\n", + "examples": [ + [ + "data", + "reporting" + ], + [ + "observability", + "protocol" + ] + ] }, "compliance": { "$ref": "#/$defs/compliance", @@ -122,12 +149,23 @@ ], "properties": { "level": { - "description": "Compliance expressed as a percentage.\n\nThe `level` property contains a percentage of how well the extension complies with best practices.\nThe value of the `level` can be between `0-100` and is determined by the weighted and normalized sum of the scores of the compliance checks.\n" + "description": "Compliance expressed as a percentage.\n\nThe `level` property contains a percentage of how well the extension complies with best practices.\nThe value of the `level` can be between `0-100` and is determined by the weighted and normalized sum of the scores of the compliance checks.\n", + "examples": [ + 87, + 34, + 100 + ], + "type": "integer", + "minimum": 0, + "maximum": 100 }, "grade": { "$ref": "#/$defs/grade", "description": "Compliance expressed as a grade.\n\nThe `grade` property contains a grade (A-F) of how well the extension complies with best practices.\nThe value of the `grade` can be `A`,`B`,`C`,`D`,`E`,`F` and is calculated from the `level` property.\n", - "type": "integer" + "examples": [ + "C", + "A" + ] } }, "additionalProperties": false @@ -143,6 +181,10 @@ "E", "F", "G" + ], + "examples": [ + "C", + "A" ] }, "repository": { @@ -156,47 +198,83 @@ "properties": { "name": { "type": "string", - "description": "The name of the repository.\n" + "description": "The name of the repository.\n", + "examples": [ + "xk6-dashboard", + "xk6-sql" + ] }, "owner": { "type": "string", - "description": "The owner of the repository.\n" + "description": "The owner of the repository.\n", + "examples": [ + "grafana" + ] }, "url": { "type": "string", - "description": "URL of the repository.\n\nThe URL is provided by the repository manager and can be displayed in a browser.\n" + "description": "URL of the repository.\n\nThe URL is provided by the repository manager and can be displayed in a browser.\n", + "examples": [ + "https://github.com/grafana/xk6-dashboard" + ] }, "homepage": { "type": "string", "default": "", - "description": "The URL to the project homepage.\n\nIf no homepage is set, the value is the same as the url property.\n" + "description": "The URL to the project homepage.\n\nIf no homepage is set, the value is the same as the url property.\n", + "examples": [ + "https://github.com/grafana/xk6-dashboard" + ] }, "description": { "type": "string", "default": "", - "description": "Repository description.\n" + "description": "Repository description.\n", + "examples": [ + "This is a wonderful extension, it says 'Hello Wonderful World!'" + ] }, "stars": { "type": "integer", "default": "0", - "description": "The number of stars in the extension's repository.\n\nThe extension's popularity is indicated by how many users have starred the extension's repository.\n" + "description": "The number of stars in the extension's repository.\n\nThe extension's popularity is indicated by how many users have starred the extension's repository.\n", + "examples": [ + 365, + 202 + ] }, "topics": { "type": "array", "items": { "type": "string" }, - "description": "Repository topics.\n\nTopics make it easier to find the repository. It is recommended to set the xk6 topic to the extensions repository.\n" + "description": "Repository topics.\n\nTopics make it easier to find the repository. It is recommended to set the xk6 topic to the extensions repository.\n", + "examples": [ + [ + "xk6", + "testing" + ], + [ + "xk6" + ] + ] }, "public": { "type": "boolean", "default": "false", - "description": "Public repository flag.\n\nA `true` value indicates that the repository is public, available to anyone.\n" + "description": "Public repository flag.\n\nA `true` value indicates that the repository is public, available to anyone.\n", + "examples": [ + true + ] }, "license": { "type": "string", "default": "", - "description": "The SPDX ID of the extension's license.\n\nFor more information about SPDX, visit https://spdx.org/licenses/\n" + "description": "The SPDX ID of the extension's license.\n\nFor more information about SPDX, visit https://spdx.org/licenses/\n", + "examples": [ + "AGPL-3.0-only", + "MIT" + ] }, "archived": { "type": "boolean", @@ -206,13 +284,21 @@ "timestamp": { "type": "number", "default": 0, - "description": "Last modification timestamp.\n\nThe timestamp property contains the timestamp of the last modification of the repository in UNIX time format (the number of non-leap seconds that have elapsed since 00:00:00 UTC on 1st January 1970).\nIts value depends on the repository manager, in the case of GitHub it contains the time of the last push operation, in the case of GitLab the time of the last repository activity.\n" + "description": "Last modification timestamp.\n\nThe timestamp property contains the timestamp of the last modification of the repository in UNIX time format (the number of non-leap seconds that have elapsed since 00:00:00 UTC on 1st January 1970).\nIts value depends on the repository manager, in the case of GitHub it contains the time of the last push operation, in the case of GitLab the time of the last repository activity.\n", + "examples": [ + 1725277028, + 1690893368 + ] }, "clone_url": { "type": "string", "format": "uri", "default": "", - "description": "URL for the git clone operation.\n\nThe clone_url property contains a (typically HTTP) URL, which is used to clone the repository.\n" + "description": "URL for the git clone operation.\n\nThe clone_url property contains a (typically HTTP) URL, which is used to clone the repository.\n", + "examples": [ + "https://github.com/grafana/xk6-dashboard.git", + "https://github.com/grafana/xk6-sql.git" + ] } } }, @@ -223,7 +309,11 @@ "partner", "community" ], - "description": "Maintainer of the extension.\n\nExtensions can be classified according to who maintains the extension.\nThis usually also specifies who the user can get support from.\n\nPossible values:\n\n - official: Extensions owned, maintained, and designated by Grafana as \"official\"\n - partner: Extensions written, maintained, validated, and published by third-party companies against their own projects.\n - community: Extensions are listed on the Registry by individual maintainers, groups of maintainers, or other members of the k6 community.\n\nExtensions owned by the `grafana` GitHub organization are not officially supported by Grafana by default.\nThere are several k6 extensions owned by the `grafana` GitHub organization, which were created for experimental or example purposes only.\nThe `official` tier value is needed so that officially supported extensions can be distinguished from them.\n\nIf it is missing from the registry source, it will be set with the default \"community\" value during generation.\n" + "description": "Maintainer of the extension.\n\nExtensions can be classified according to who maintains the extension.\nThis usually also specifies who the user can get support from.\n\nPossible values:\n\n - official: Extensions owned, maintained, and designated by Grafana as \"official\"\n - partner: Extensions written, maintained, validated, and published by third-party companies against their own projects.\n - community: Extensions are listed on the Registry by individual maintainers, groups of maintainers, or other members of the k6 community.\n\nExtensions owned by the `grafana` GitHub organization are not officially supported by Grafana by default.\nThere are several k6 extensions owned by the `grafana` GitHub organization, which were created for experimental or example purposes only.\nThe `official` tier value is needed so that officially supported extensions can be distinguished from them.\n\nIf it is missing from the registry source, it will be set with the default \"community\" value during generation.\n", + "examples": [ + "community", + "official" + ] }, "product": { "type": "string", @@ -231,7 +321,19 @@ "oss", "cloud" ], - "description": "Products in which the extension can be used.\n\nSome extensions are not available in all k6 products.\nThis may be for a technological or business reason, or the functionality of the extension may not make sense in the given product.\n\nPossible values:\n\n - oss: Extensions are available in k6 OSS\n - cloud: Extensions are available in Grafana Cloud k6\n\nIf the property is missing or empty in the source of the registry, it means that the extension is only available in the k6 OSS product.\nIn this case, the registry will be filled in accordingly during generation.\n" + "description": "Products in which the extension can be used.\n\nSome extensions are not available in all k6 products.\nThis may be for a technological or business reason, or the functionality of the extension may not make sense in the given product.\n\nPossible values:\n\n - oss: Extensions are available in k6 OSS\n - cloud: Extensions are available in Grafana Cloud k6\n\nIf the property is missing or empty in the source of the registry, it means that the extension is only available in the k6 OSS product.\nIn this case, the registry will be filled in accordingly during generation.\n", + "examples": [ + [ + "cloud", + "oss" + ], + [ + "cloud" + ], + [ + "oss" + ] + ] }, "category": { "type": "string", @@ -246,7 +348,17 @@ "protocol", "reporting" ], - "description": "The categories to which the extension belongs.\n\nIf the property is missing or empty in the registry source, the default value is \"misc\".\n\nPossible values:\n\n - authentication\n - browser\n - data\n - kubernetes\n - messaging\n - misc\n - observability\n - protocol\n - reporting\n" + "description": "The categories to which the extension belongs.\n\nIf the property is missing or empty in the registry source, the default value is \"misc\".\n\nPossible values:\n\n - authentication\n - browser\n - data\n - kubernetes\n - messaging\n - misc\n - observability\n - protocol\n - reporting\n", + "examples": [ + [ + "data", + "reporting" + ], + [ + "observability", + "protocol" + ] + ] } } } diff --git a/registry_gen.go b/registry_gen.go index 9056223..d9a9407 100644 --- a/registry_gen.go +++ b/registry_gen.go @@ -42,7 +42,7 @@ type Compliance struct { // The value of the `level` can be between `0-100` and is determined by the // weighted and normalized sum of the scores of the compliance checks. // - Level interface{} `json:"level" yaml:"level" mapstructure:"level"` + Level int `json:"level" yaml:"level" mapstructure:"level"` } // Properties of the registered k6 extension. @@ -135,7 +135,6 @@ type Extension struct { // that the extension is only available in the k6 OSS product. // In this case, the registry will be filled in accordingly during generation. // - // Products []Product `json:"products,omitempty" yaml:"products,omitempty" mapstructure:"products,omitempty"` // Repository metadata. @@ -167,7 +166,6 @@ type Extension struct { // If it is missing from the registry source, it will be set with the default // "community" value during generation. // - // Tier Tier `json:"tier,omitempty" yaml:"tier,omitempty" mapstructure:"tier,omitempty"` // List of supported versions. From a39d9249f20c753ebeb75d31aa4a4dcf44321564 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20SZKIBA?= Date: Tue, 3 Sep 2024 13:37:58 +0200 Subject: [PATCH 03/12] feat: not k6registry's responsibility --- docs/example-api/registry.schema.json | 252 -------------------------- 1 file changed, 252 deletions(-) delete mode 100644 docs/example-api/registry.schema.json diff --git a/docs/example-api/registry.schema.json b/docs/example-api/registry.schema.json deleted file mode 100644 index 14edef4..0000000 --- a/docs/example-api/registry.schema.json +++ /dev/null @@ -1,252 +0,0 @@ -{ - "$id": "https://grafana.github.io/k6registry/registry.schema.json", - "$ref": "#/$defs/registry", - "$defs": { - "registry": { - "description": "k6 Extension Registry.\n\nThe k6 extension registry contains the most important properties of registered extensions.\n", - "type": "array", - "items": { - "$ref": "#/$defs/extension" - }, - "additionalProperties": false - }, - "catalog": { - "description": "k6 Extension Catalog.\n\nThe k6 extension catalog is an alternative representation of the k6 extension registry.\nThe catalog stores the extension data in an associative array (object),\nwhere the key is the imprt path for JavaScript extensions, and the output name for output extensions.\nThis data structure is optimized to resolve extensions as dependencies.\n", - "type": "object", - "additionalProperties": { - "$ref": "#/$defs/extension" - } - }, - "extension": { - "type": "object", - "description": "Properties of the registered k6 extension.\n\nOnly those properties of the extensions are registered, which either cannot be detected automatically, or delegation to the extension is not allowed.\n\nProperties that are available using the repository manager API are intentionally not registered.\n\nThe string like properties that are included in the generated Grafana documentation are intentionally not accessed via the API of the repository manager. It is not allowed to inject arbitrary text into the Grafana documentation site without approval. Therefore, these properties are registered (eg `description`)\n", - "properties": { - "module": { - "type": "string", - "description": "The extension's go module path.\n\nThis is the unique identifier of the extension.\nMore info about module paths: https://go.dev/ref/mod#module-path\n\nThe extension has no name property, the module path or part of it can be used as the extension name. For example, using the first two elements of the module path after the host name, the name `grafana/xk6-dashboard` can be formed from the module path `github.com/grafana/xk6-dashboard`. This is typically the repository owner name and the repository name in the repository manager.\n\nThe extension has no URL property, a URL can be created from the module path that refers to the extension within the repository manager.\n", - "examples": [ - "github.com/grafana/xk6-dashboard", - "github.com/szkiba/xk6-top" - ] - }, - "imports": { - "type": "array", - "items": { - "type": "string", - "pattern": "^k6/x/" - }, - "description": "List of JavaScript import paths registered by the extension.\n\nCurrently, paths must start with the prefix `k6/x/`.\n\nThe extensions used by k6 scripts are automatically detected based on the values specified here, therefore it is important that the values used here are consistent with the values registered by the extension at runtime.\n", - "examples": [ - [ - "k6/x/csv", - "k6/x/csv/stream" - ], - [ - "k6/x/toml" - ] - ] - }, - "outputs": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of output names registered by the extension.\n\nThe extensions used by k6 scripts are automatically detected based on the values specified here, therefore it is important that the values used here are consistent with the values registered by the extension at runtime.\n", - "examples": [ - [ - "dashboard" - ], - [ - "plugin" - ] - ] - }, - "description": { - "type": "string", - "description": "Brief description of the extension.\n" - }, - "versions": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of supported versions.\n\nVersions are tags whose format meets the requirements of semantic versioning. Version tags often start with the letter `v`, which is not part of the semantic version.\n", - "examples": [ - [ - "v0.1.0", - "v0.2.0", - "v0.2.1" - ] - ] - }, - "repo": { - "$ref": "#/$defs/repository", - "description": "Repository metadata.\n\nMetadata provided by the extension's git repository manager. Repository metadata are not registered, they are queried at runtime using the repository manager API.\n" - }, - "tier": { - "$ref": "#/$defs/tier", - "default": "community", - "description": "Maintainer of the extension.\n\nPossible values:\n\n - official: Extensions owned, maintained, and designated by Grafana as \"official\"\n - partner: Extensions written, maintained, validated, and published by third-party companies against their own projects.\n - community: Extensions are listed on the Registry by individual maintainers, groups of maintainers, or other members of the k6 community.\n\nExtensions owned by the `grafana` GitHub organization are not officially supported by Grafana by default.\nThere are several k6 extensions owned by the `grafana` GitHub organization, which were created for experimental or example purposes only.\nThe `official` tier value is needed so that officially supported extensions can be distinguished from them.\n\nIf it is missing from the registry source, it will be set with the default \"community\" value during generation.\n" - }, - "products": { - "type": "array", - "items": { - "$ref": "#/$defs/product" - }, - "description": "Products in which the extension can be used.\n\nSome extensions are not available in all k6 products.\nThis may be for a technological or business reason, or the functionality of the extension may not make sense in the given product.\n\nPossible values:\n\n - oss: Extensions are available in k6 OSS\n - cloud: Extensions are available in Grafana Cloud k6\n\nIf the property is missing or empty in the source of the registry, it means that the extension is only available in the k6 OSS product.\nIn this case, the registry will be filled in accordingly during generation.\n" - }, - "categories": { - "type": "array", - "items": { - "$ref": "#/$defs/category" - }, - "description": "The categories to which the extension belongs.\n\nIf the property is missing or empty in the registry source, the default value is \"misc\".\n\nPossible values:\n\n - authentication\n - browser\n - data\n - kubernetes\n - messaging\n - misc\n - observability\n - protocol\n - reporting\n" - }, - "compliance": { - "$ref": "#/$defs/compliance", - "description": "The result of the extension's k6 compliance checks.\n" - } - }, - "required": [ - "module", - "description" - ], - "additionalProperties": false - }, - "compliance": { - "description": "The result of the extension's k6 compliance checks.\n", - "type": "object", - "required": [ - "grade", - "level" - ], - "properties": { - "level": { - "description": "Compliance expressed as a percentage.\n\nThe `level` property contains a percentage of how well the extension complies with best practices.\nThe value of the `level` can be between `0-100` and is determined by the weighted and normalized sum of the scores of the compliance checks.\n" - }, - "grade": { - "$ref": "#/$defs/grade", - "description": "Compliance expressed as a grade.\n\nThe `grade` property contains a grade (A-F) of how well the extension complies with best practices.\nThe value of the `grade` can be `A`,`B`,`C`,`D`,`E`,`F` and is calculated from the `level` property.\n", - "type": "integer" - } - }, - "additionalProperties": false - }, - "grade": { - "description": "The results of the checks are in the form of a grade.\n", - "type": "string", - "enum": [ - "A", - "B", - "C", - "D", - "E", - "F", - "G" - ] - }, - "repository": { - "type": "object", - "description": "Repository metadata.\n\nMetadata provided by the extension's git repository manager. Repository metadata are not registered, they are queried at runtime using the repository manager API.\n", - "required": [ - "name", - "owner", - "url" - ], - "properties": { - "name": { - "type": "string", - "description": "The name of the repository.\n" - }, - "owner": { - "type": "string", - "description": "The owner of the repository.\n" - }, - "url": { - "type": "string", - "description": "URL of the repository.\n\nThe URL is provided by the repository manager and can be displayed in a browser.\n" - }, - "homepage": { - "type": "string", - "default": "", - "description": "The URL to the project homepage.\n\nIf no homepage is set, the value is the same as the url property.\n" - }, - "description": { - "type": "string", - "default": "", - "description": "Repository description.\n" - }, - "stars": { - "type": "integer", - "default": "0", - "description": "The number of stars in the extension's repository.\n\nThe extension's popularity is indicated by how many users have starred the extension's repository.\n" - }, - "topics": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Repository topics.\n\nTopics make it easier to find the repository. It is recommended to set the xk6 topic to the extensions repository.\n" - }, - "public": { - "type": "boolean", - "default": "false", - "description": "Public repository flag.\n\nA `true` value indicates that the repository is public, available to anyone.\n" - }, - "license": { - "type": "string", - "default": "", - "description": "The SPDX ID of the extension's license.\n\nFor more information about SPDX, visit https://spdx.org/licenses/\n" - }, - "archived": { - "type": "boolean", - "default": "false", - "description": "Archived repository flag.\n\nA `true` value indicates that the repository is archived, read only.\n\nIf a repository is archived, it usually means that the owner has no intention of maintaining it. Such extensions should be removed from the registry.\n" - }, - "timestamp": { - "type": "number", - "default": 0, - "description": "Last modification timestamp.\n\nThe timestamp property contains the timestamp of the last modification of the repository in UNIX time format (the number of non-leap seconds that have elapsed since 00:00:00 UTC on 1st January 1970).\nIts value depends on the repository manager, in the case of GitHub it contains the time of the last push operation, in the case of GitLab the time of the last repository activity.\n" - }, - "clone_url": { - "type": "string", - "format": "uri", - "default": "", - "description": "URL for the git clone operation.\n\nThe clone_url property contains a (typically HTTP) URL, which is used to clone the repository.\n" - } - } - }, - "tier": { - "type": "string", - "enum": [ - "official", - "partner", - "community" - ], - "description": "Maintainer of the extension.\n\nExtensions can be classified according to who maintains the extension.\nThis usually also specifies who the user can get support from.\n\nPossible values:\n\n - official: Extensions owned, maintained, and designated by Grafana as \"official\"\n - partner: Extensions written, maintained, validated, and published by third-party companies against their own projects.\n - community: Extensions are listed on the Registry by individual maintainers, groups of maintainers, or other members of the k6 community.\n\nExtensions owned by the `grafana` GitHub organization are not officially supported by Grafana by default.\nThere are several k6 extensions owned by the `grafana` GitHub organization, which were created for experimental or example purposes only.\nThe `official` tier value is needed so that officially supported extensions can be distinguished from them.\n\nIf it is missing from the registry source, it will be set with the default \"community\" value during generation.\n" - }, - "product": { - "type": "string", - "enum": [ - "oss", - "cloud" - ], - "description": "Products in which the extension can be used.\n\nSome extensions are not available in all k6 products.\nThis may be for a technological or business reason, or the functionality of the extension may not make sense in the given product.\n\nPossible values:\n\n - oss: Extensions are available in k6 OSS\n - cloud: Extensions are available in Grafana Cloud k6\n\nIf the property is missing or empty in the source of the registry, it means that the extension is only available in the k6 OSS product.\nIn this case, the registry will be filled in accordingly during generation.\n" - }, - "category": { - "type": "string", - "enum": [ - "authentication", - "browser", - "data", - "kubernetes", - "messaging", - "misc", - "observability", - "protocol", - "reporting" - ], - "description": "The categories to which the extension belongs.\n\nIf the property is missing or empty in the registry source, the default value is \"misc\".\n\nPossible values:\n\n - authentication\n - browser\n - data\n - kubernetes\n - messaging\n - misc\n - observability\n - protocol\n - reporting\n" - } - } -} From 2389828664dd123a210d8983a8f8af7a1c5d5c72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20SZKIBA?= Date: Tue, 3 Sep 2024 13:45:42 +0200 Subject: [PATCH 04/12] feat: openapi.yaml and registry.schema.json not k6registry-s responsibility --- cmd/api.go | 8 -------- registry.go | 5 ----- 2 files changed, 13 deletions(-) diff --git a/cmd/api.go b/cmd/api.go index dd673d0..d277c0a 100644 --- a/cmd/api.go +++ b/cmd/api.go @@ -46,14 +46,6 @@ func writeJSON(filename string, source interface{}) error { } func writeAPIGroupGlobal(registry k6registry.Registry, target string) error { - if err := writeData(filepath.Join(target, "registry.schema.json"), k6registry.Schema); err != nil { - return err - } - - if err := writeData(filepath.Join(target, "openapi.yaml"), k6registry.OpenAPI); err != nil { - return err - } - if err := writeJSON(filepath.Join(target, "registry.json"), registry); err != nil { return err } diff --git a/registry.go b/registry.go index a968d99..cfdefa4 100644 --- a/registry.go +++ b/registry.go @@ -10,11 +10,6 @@ import ( //go:embed docs/registry.schema.json var Schema []byte -// OpenAPI contains YAML format OpenAPI definition of Grafana k6 Extension Registry Service. -// -//go:embed docs/openapi.yaml -var OpenAPI []byte - //nolint:gochecknoglobals var ( // Categories contains possible values for Category From 57a83f87f75102d1baa128cd3e1affe112f223de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20SZKIBA?= Date: Tue, 3 Sep 2024 13:45:56 +0200 Subject: [PATCH 05/12] docs: updated examples --- README.md | 4 +--- docs/example-api.txt | 2 -- docs/example-api/catalog.json | 2 +- docs/example-api/category/observability.json | 2 +- docs/example-api/category/reporting.json | 2 +- docs/example-api/grade/C.json | 2 +- docs/example-api/grade/at-least/C.json | 2 +- docs/example-api/grade/at-least/D.json | 2 +- docs/example-api/grade/at-least/E.json | 2 +- docs/example-api/grade/at-least/F.json | 2 +- .../module/github.com/grafana/xk6-dashboard/extension.json | 2 +- docs/example-api/product/oss-catalog.json | 2 +- docs/example-api/product/oss.json | 2 +- docs/example-api/registry.json | 2 +- docs/example-api/tier/at-least/community-catalog.json | 2 +- docs/example-api/tier/at-least/community.json | 2 +- docs/example-api/tier/at-least/official-catalog.json | 2 +- docs/example-api/tier/at-least/official.json | 2 +- docs/example-api/tier/at-least/partner-catalog.json | 2 +- docs/example-api/tier/at-least/partner.json | 2 +- docs/example-api/tier/official-catalog.json | 2 +- docs/example-api/tier/official.json | 2 +- docs/example-catalog.json | 2 +- docs/example.json | 2 +- 24 files changed, 23 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 9e474d9..09824b1 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ Registry generated from the source above. "name": "xk6-dashboard", "owner": "grafana", "public": true, - "stars": 327, + "stars": 328, "timestamp": 1719907965, "topics": [ "xk6", @@ -551,9 +551,7 @@ By using the `--api` flag, files are created with relative paths in a base direc ```ascii file=docs/example-api.txt docs/example-api ├── catalog.json -├── openapi.yaml ├── registry.json -├── registry.schema.json ├── category │   ├── authentication.json │   ├── browser.json diff --git a/docs/example-api.txt b/docs/example-api.txt index bb37956..7d4ff42 100644 --- a/docs/example-api.txt +++ b/docs/example-api.txt @@ -1,8 +1,6 @@ docs/example-api ├── catalog.json -├── openapi.yaml ├── registry.json -├── registry.schema.json ├── category │   ├── authentication.json │   ├── browser.json diff --git a/docs/example-api/catalog.json b/docs/example-api/catalog.json index 6b66ab1..2c8c90a 100644 --- a/docs/example-api/catalog.json +++ b/docs/example-api/catalog.json @@ -24,7 +24,7 @@ "name": "xk6-dashboard", "owner": "grafana", "public": true, - "stars": 327, + "stars": 328, "timestamp": 1719907965, "topics": [ "xk6", diff --git a/docs/example-api/category/observability.json b/docs/example-api/category/observability.json index 7228071..44723a5 100644 --- a/docs/example-api/category/observability.json +++ b/docs/example-api/category/observability.json @@ -24,7 +24,7 @@ "name": "xk6-dashboard", "owner": "grafana", "public": true, - "stars": 327, + "stars": 328, "timestamp": 1719907965, "topics": [ "xk6", diff --git a/docs/example-api/category/reporting.json b/docs/example-api/category/reporting.json index 7228071..44723a5 100644 --- a/docs/example-api/category/reporting.json +++ b/docs/example-api/category/reporting.json @@ -24,7 +24,7 @@ "name": "xk6-dashboard", "owner": "grafana", "public": true, - "stars": 327, + "stars": 328, "timestamp": 1719907965, "topics": [ "xk6", diff --git a/docs/example-api/grade/C.json b/docs/example-api/grade/C.json index 20e8402..76ae224 100644 --- a/docs/example-api/grade/C.json +++ b/docs/example-api/grade/C.json @@ -24,7 +24,7 @@ "name": "xk6-dashboard", "owner": "grafana", "public": true, - "stars": 327, + "stars": 328, "timestamp": 1719907965, "topics": [ "xk6", diff --git a/docs/example-api/grade/at-least/C.json b/docs/example-api/grade/at-least/C.json index 857d5f3..4f8eb4c 100644 --- a/docs/example-api/grade/at-least/C.json +++ b/docs/example-api/grade/at-least/C.json @@ -24,7 +24,7 @@ "name": "xk6-dashboard", "owner": "grafana", "public": true, - "stars": 327, + "stars": 328, "timestamp": 1719907965, "topics": [ "xk6", diff --git a/docs/example-api/grade/at-least/D.json b/docs/example-api/grade/at-least/D.json index 857d5f3..4f8eb4c 100644 --- a/docs/example-api/grade/at-least/D.json +++ b/docs/example-api/grade/at-least/D.json @@ -24,7 +24,7 @@ "name": "xk6-dashboard", "owner": "grafana", "public": true, - "stars": 327, + "stars": 328, "timestamp": 1719907965, "topics": [ "xk6", diff --git a/docs/example-api/grade/at-least/E.json b/docs/example-api/grade/at-least/E.json index 857d5f3..4f8eb4c 100644 --- a/docs/example-api/grade/at-least/E.json +++ b/docs/example-api/grade/at-least/E.json @@ -24,7 +24,7 @@ "name": "xk6-dashboard", "owner": "grafana", "public": true, - "stars": 327, + "stars": 328, "timestamp": 1719907965, "topics": [ "xk6", diff --git a/docs/example-api/grade/at-least/F.json b/docs/example-api/grade/at-least/F.json index 857d5f3..4f8eb4c 100644 --- a/docs/example-api/grade/at-least/F.json +++ b/docs/example-api/grade/at-least/F.json @@ -24,7 +24,7 @@ "name": "xk6-dashboard", "owner": "grafana", "public": true, - "stars": 327, + "stars": 328, "timestamp": 1719907965, "topics": [ "xk6", diff --git a/docs/example-api/module/github.com/grafana/xk6-dashboard/extension.json b/docs/example-api/module/github.com/grafana/xk6-dashboard/extension.json index cc3ebf1..2239ea9 100644 --- a/docs/example-api/module/github.com/grafana/xk6-dashboard/extension.json +++ b/docs/example-api/module/github.com/grafana/xk6-dashboard/extension.json @@ -23,7 +23,7 @@ "name": "xk6-dashboard", "owner": "grafana", "public": true, - "stars": 327, + "stars": 328, "timestamp": 1719907965, "topics": [ "xk6", diff --git a/docs/example-api/product/oss-catalog.json b/docs/example-api/product/oss-catalog.json index 6b66ab1..2c8c90a 100644 --- a/docs/example-api/product/oss-catalog.json +++ b/docs/example-api/product/oss-catalog.json @@ -24,7 +24,7 @@ "name": "xk6-dashboard", "owner": "grafana", "public": true, - "stars": 327, + "stars": 328, "timestamp": 1719907965, "topics": [ "xk6", diff --git a/docs/example-api/product/oss.json b/docs/example-api/product/oss.json index 17b7be6..73d867d 100644 --- a/docs/example-api/product/oss.json +++ b/docs/example-api/product/oss.json @@ -24,7 +24,7 @@ "name": "xk6-dashboard", "owner": "grafana", "public": true, - "stars": 327, + "stars": 328, "timestamp": 1719907965, "topics": [ "xk6", diff --git a/docs/example-api/registry.json b/docs/example-api/registry.json index 17b7be6..73d867d 100644 --- a/docs/example-api/registry.json +++ b/docs/example-api/registry.json @@ -24,7 +24,7 @@ "name": "xk6-dashboard", "owner": "grafana", "public": true, - "stars": 327, + "stars": 328, "timestamp": 1719907965, "topics": [ "xk6", diff --git a/docs/example-api/tier/at-least/community-catalog.json b/docs/example-api/tier/at-least/community-catalog.json index 6b66ab1..2c8c90a 100644 --- a/docs/example-api/tier/at-least/community-catalog.json +++ b/docs/example-api/tier/at-least/community-catalog.json @@ -24,7 +24,7 @@ "name": "xk6-dashboard", "owner": "grafana", "public": true, - "stars": 327, + "stars": 328, "timestamp": 1719907965, "topics": [ "xk6", diff --git a/docs/example-api/tier/at-least/community.json b/docs/example-api/tier/at-least/community.json index 17b7be6..73d867d 100644 --- a/docs/example-api/tier/at-least/community.json +++ b/docs/example-api/tier/at-least/community.json @@ -24,7 +24,7 @@ "name": "xk6-dashboard", "owner": "grafana", "public": true, - "stars": 327, + "stars": 328, "timestamp": 1719907965, "topics": [ "xk6", diff --git a/docs/example-api/tier/at-least/official-catalog.json b/docs/example-api/tier/at-least/official-catalog.json index 803f965..c6fe3d0 100644 --- a/docs/example-api/tier/at-least/official-catalog.json +++ b/docs/example-api/tier/at-least/official-catalog.json @@ -24,7 +24,7 @@ "name": "xk6-dashboard", "owner": "grafana", "public": true, - "stars": 327, + "stars": 328, "timestamp": 1719907965, "topics": [ "xk6", diff --git a/docs/example-api/tier/at-least/official.json b/docs/example-api/tier/at-least/official.json index 9e819e9..1f17389 100644 --- a/docs/example-api/tier/at-least/official.json +++ b/docs/example-api/tier/at-least/official.json @@ -24,7 +24,7 @@ "name": "xk6-dashboard", "owner": "grafana", "public": true, - "stars": 327, + "stars": 328, "timestamp": 1719907965, "topics": [ "xk6", diff --git a/docs/example-api/tier/at-least/partner-catalog.json b/docs/example-api/tier/at-least/partner-catalog.json index 803f965..c6fe3d0 100644 --- a/docs/example-api/tier/at-least/partner-catalog.json +++ b/docs/example-api/tier/at-least/partner-catalog.json @@ -24,7 +24,7 @@ "name": "xk6-dashboard", "owner": "grafana", "public": true, - "stars": 327, + "stars": 328, "timestamp": 1719907965, "topics": [ "xk6", diff --git a/docs/example-api/tier/at-least/partner.json b/docs/example-api/tier/at-least/partner.json index 9e819e9..1f17389 100644 --- a/docs/example-api/tier/at-least/partner.json +++ b/docs/example-api/tier/at-least/partner.json @@ -24,7 +24,7 @@ "name": "xk6-dashboard", "owner": "grafana", "public": true, - "stars": 327, + "stars": 328, "timestamp": 1719907965, "topics": [ "xk6", diff --git a/docs/example-api/tier/official-catalog.json b/docs/example-api/tier/official-catalog.json index 803f965..c6fe3d0 100644 --- a/docs/example-api/tier/official-catalog.json +++ b/docs/example-api/tier/official-catalog.json @@ -24,7 +24,7 @@ "name": "xk6-dashboard", "owner": "grafana", "public": true, - "stars": 327, + "stars": 328, "timestamp": 1719907965, "topics": [ "xk6", diff --git a/docs/example-api/tier/official.json b/docs/example-api/tier/official.json index 9e819e9..1f17389 100644 --- a/docs/example-api/tier/official.json +++ b/docs/example-api/tier/official.json @@ -24,7 +24,7 @@ "name": "xk6-dashboard", "owner": "grafana", "public": true, - "stars": 327, + "stars": 328, "timestamp": 1719907965, "topics": [ "xk6", diff --git a/docs/example-catalog.json b/docs/example-catalog.json index 8622afb..24203af 100644 --- a/docs/example-catalog.json +++ b/docs/example-catalog.json @@ -24,7 +24,7 @@ "name": "xk6-dashboard", "owner": "grafana", "public": true, - "stars": 327, + "stars": 328, "timestamp": 1719907965, "topics": [ "xk6", diff --git a/docs/example.json b/docs/example.json index fe41db6..ec5e2af 100644 --- a/docs/example.json +++ b/docs/example.json @@ -24,7 +24,7 @@ "name": "xk6-dashboard", "owner": "grafana", "public": true, - "stars": 327, + "stars": 328, "timestamp": 1719907965, "topics": [ "xk6", From 137509297fbe5d5c7987eba274ae1f7f84c38122 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20SZKIBA?= Date: Tue, 3 Sep 2024 17:20:00 +0200 Subject: [PATCH 06/12] fix: added missing 'catalog' parameter handling --- action.yml | 6 +++++- cmd/k6registry/main.go | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index eeb6951..cda5f6d 100644 --- a/action.yml +++ b/action.yml @@ -19,7 +19,7 @@ inputs: description: api directory name required: false - mute: + quiet: description: no output, only validation required: false @@ -35,6 +35,10 @@ inputs: description: compact instead of pretty-printed output required: false + catalog: + description: generate catalog instead of registry + required: false + ref: description: reference output URL for change detection required: false diff --git a/cmd/k6registry/main.go b/cmd/k6registry/main.go index 7e7cdd1..32b5b52 100644 --- a/cmd/k6registry/main.go +++ b/cmd/k6registry/main.go @@ -55,8 +55,8 @@ func getArgs() []string { var args []string - if getenv("INPUT_MUTE", "false") == "true" { - args = append(args, "--mute") + if getenv("INPUT_QUIET", "false") == "true" { + args = append(args, "--quiet") } if getenv("INPUT_LOOSE", "false") == "true" { @@ -71,6 +71,10 @@ func getArgs() []string { args = append(args, "--compact") } + if getenv("INPUT_CATALOG", "false") == "true" { + args = append(args, "--catalog") + } + if api := getenv("INPUT_API", ""); len(api) != 0 { args = append(args, "--api", api) } From 86c8151ff96df928977b5ae7cc25a0f2c810b773 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20SZKIBA?= Date: Tue, 3 Sep 2024 17:20:24 +0200 Subject: [PATCH 07/12] docs: improve documentation --- README.md | 38 +++++++++++++++++++------------------- cmd/cmd.go | 2 +- cmd/help.md | 10 +++++----- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 09824b1..a5c308c 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,14 @@

k6registry

-**Data model and tooling for the k6 extension registry** +**k6 Extension Registry Generator** -This repository contains the [JSON schema](docs/registry.schema.json) of the k6 extension registry and the [`k6registry`](#k6registry) command line tool for generating registry from source. The command line tool can also be used as a [GitHub Action](#github-action). +k6registry is a CLI tool and a GitHub Action that enables the generation of the k6 extension registry. The generation source is a YAML (or JSON) file that contains the most important properties of extensions. The generator generates the missing properties from the repository metadata. Repository metadata is collected using the repository manager APIs. GitHub and GitLab APIs are currently supported. + +The generator also performs static analysis of extensions. The result of the analysis is the level of compliance with best practices (0-100%). A compliance grade (A-F) is calculated from the compliance level. The compliance level and grade are stored in the registry for each extension. Based on the compliance grade, an SVG compliance badge is created for each extension. Example badge: + +![xk6-sql](https://registry.k6.io/module/github.com/grafana/xk6-sql/badge.svg) + +The k6 Extension Catalog is an alternative representation of the k6 Extension Registry. The output of the generation can be in k6 Extension Catalog format. This format is optimized to resolve extensions as dependencies. Check [k6 Extension Registry Concept](docs/registry.md) for information on design considerations. @@ -455,15 +461,7 @@ go install github.com/grafana/k6registry/cmd/k6registry@latest ## GitHub Action -`grafana/k6registry` is a GitHub Action that enables k6 extension registry processing and the generation of customized JSON output for different applications. Processing is based on popular `jq` expressions using an embedded `jq` implementation. - -The jq filter expression can be specified in the `filter` parameter. - -The extension registry is read from the YAML format file specified in the `in` parameter. - -Repository metadata is collected using the repository manager APIs. Currently only the GitHub API is supported. - -The output of the processing will be written to the standard output by default. The output can be saved to a file using the `out` parameter. +`grafana/k6registry` is a GitHub Action that enables k6 Extension Registry and Catalog generation. **Inputs** @@ -472,10 +470,11 @@ name | reqired | default | description in | yes | | input file name out | no | stdout | output file name api | no | | output directory name -mute | no | `false` | no output, only validation +quiet | no | `false` | no output, only validation loose | no | `false` | skip JSON schema validation lint | no | `false` | enable built-in linter compact| no | `false` | compact instead of pretty-printed output +catalog| no | `false` | generate catalog instead of registry ref | no | | reference output URL for change detection In GitHub action mode, the change can be indicated by comparing the output to a reference output. The reference output URL can be passed in the `ref` action parameter. The `changed` output variable will be `true` or `false` depending on whether the output has changed or not compared to the reference output. @@ -491,8 +490,8 @@ changed | `true` if the output has changed compared to `ref`, otherwise `false` **Example usage** ```yaml -- name: Generate registry in JSON format - uses: grafana/k6registry@v0.1.10 +- name: Generate extension registry + uses: grafana/k6registry@v0.1.18 with: in: "registry.yaml" out: "registry.json" @@ -504,22 +503,23 @@ changed | `true` if the output has changed compared to `ref`, otherwise `false` ## k6registry -k6 extension registry generator +k6 Extension Registry Generator ### Synopsis -Command line k6 extension registry generator. +Generate k6 extension registry/catalog from source. -The source of the extension registry contains only the most important properties of the extensions. The rest of the properties are collected by k6registry using the API of the extensions' git repository managers. +The generation source is a YAML (or JSON) file that contains the most important properties of extensions. The generator generates the missing properties from the repository metadata. Repository metadata is collected using the repository manager APIs. GitHub and GitLab APIs are currently supported. -The source of the extension registry is read from the YAML (or JSON) format file specified as command line argument. If it is missing, the source is read from the standard input. +The generator also performs static analysis of extensions. The result of the analysis is the level of compliance with best practices (0-100%). A compliance grade (A-F) is calculated from the compliance level. The compliance level and grade are stored in the registry for each extension. Based on the compliance grade, an SVG compliance badge is created for each extension. -Repository metadata is collected using the API of the extensions' git repository managers. Currently only the GitHub API is supported. +The source is read from file specified as command line argument. If it is missing, the source is read from the standard input. The output of the generation will be written to the standard output by default. The output can be saved to a file using the `-o/--out` flag. The `--api` flag can be used to specify a directory to which the outputs will be written. The `registry.json` file is placed in the root directory. The `extension.json` file and the `badge.svg` file (if the `--lint` flag is used) are placed in a directory with the same name as the extension's go module path. + ``` k6registry [flags] [source-file] ``` diff --git a/cmd/cmd.go b/cmd/cmd.go index d82b21c..8c89cac 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -35,7 +35,7 @@ func New() (*cobra.Command, error) { root := &cobra.Command{ Use: "k6registry [flags] [source-file]", - Short: "k6 extension registry generator", + Short: "k6 Extension Registry Generator", Long: help, SilenceUsage: true, SilenceErrors: true, diff --git a/cmd/help.md b/cmd/help.md index 88bddd6..ad1d0b1 100644 --- a/cmd/help.md +++ b/cmd/help.md @@ -1,11 +1,11 @@ -Command line k6 extension registry generator. +Generate k6 extension registry/catalog from source. -The source of the extension registry contains only the most important properties of the extensions. The rest of the properties are collected by k6registry using the API of the extensions' git repository managers. +The generation source is a YAML (or JSON) file that contains the most important properties of extensions. The generator generates the missing properties from the repository metadata. Repository metadata is collected using the repository manager APIs. GitHub and GitLab APIs are currently supported. -The source of the extension registry is read from the YAML (or JSON) format file specified as command line argument. If it is missing, the source is read from the standard input. +The generator also performs static analysis of extensions. The result of the analysis is the level of compliance with best practices (0-100%). A compliance grade (A-F) is calculated from the compliance level. The compliance level and grade are stored in the registry for each extension. Based on the compliance grade, an SVG compliance badge is created for each extension. -Repository metadata is collected using the API of the extensions' git repository managers. Currently only the GitHub API is supported. +The source is read from file specified as command line argument. If it is missing, the source is read from the standard input. The output of the generation will be written to the standard output by default. The output can be saved to a file using the `-o/--out` flag. -The `--api` flag can be used to specify a directory to which the outputs will be written. The `registry.json` file is placed in the root directory. The `extension.json` file and the `badge.svg` file (if the `--lint` flag is used) are placed in a directory with the same name as the extension's go module path. \ No newline at end of file +The `--api` flag can be used to specify a directory to which the outputs will be written. The `registry.json` file is placed in the root directory. The `extension.json` file and the `badge.svg` file (if the `--lint` flag is used) are placed in a directory with the same name as the extension's go module path. From e9b881115ef9370eef0198bed7229747b3cffd06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20SZKIBA?= Date: Tue, 3 Sep 2024 17:37:01 +0200 Subject: [PATCH 08/12] fix: version generation --- cmd/legacy.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/legacy.go b/cmd/legacy.go index f70d74e..b231e6a 100644 --- a/cmd/legacy.go +++ b/cmd/legacy.go @@ -80,13 +80,14 @@ func legacyConvert(ctx context.Context) error { legacyPatch(ext) - repo, _, err := loadRepository(ctx, ext.Module) + repo, tags, err := loadRepository(ctx, ext.Module) if err != nil { return err } tmp := *ext tmp.Repo = repo + tmp.Versions = filterVersions(tags) if ok, _ := lintExtension(tmp); ok { reg = append(reg, ext) From 33fc666e9147765f7d38c1a0f4efa66a4149f2d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20SZKIBA?= Date: Tue, 3 Sep 2024 17:38:19 +0200 Subject: [PATCH 09/12] docs: update tasks --- CONTRIBUTING.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b5e8019..9e1b725 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -36,19 +36,18 @@ eget golangci/golangci-lint eget goreleaser/goreleaser ``` -## schema - Contribute to the JSON schema +## schema - Generate code due to schema change -The JSON schema of the registry can be found in the [registry.schema.yaml] file, after modification of which the schema in JSON format ([registry.schema.json]) and the golang data model ([registry_gen.go]) must be regenerated. +After modifying registry schema ([registry.schema.json]), the [registry_gen.go] file must be regenerated. ```bash -yq -o=json -P docs/registry.schema.yaml > docs/registry.schema.json -go-jsonschema --capitalization URL --capitalization OSS -p k6registry --only-models -o registry_gen.go docs/registry.schema.yaml +go-jsonschema --capitalization URL --capitalization OSS -p k6registry --only-models -o registry_gen.go docs/registry.schema.json ``` [registry.schema.json]: docs/registry.schema.json [registry_gen.go]: registry_gen.go -## example - Contribute to the example +## example - Update documentation due to example changes The example registry can be found in [example.yaml] file, the documentation ([registry.md], [README.md]) must be updated after modification. @@ -139,14 +138,14 @@ docker build -t k6registry -f Dockerfile.goreleaser . rm -rf build ``` -## all - Update everything +### update - Update everything The most robust thing is to update everything (both the schema and the example) after modifying the source. Requires : schema, example, readme -## legacy - Convert legacy registry +### legacy - Convert legacy registry ```bash go run ./cmd/k6registry . --legacy | yq '.[]|= pick(["module","description","tier","products","imports","outputs","repo","categories"])|sort_by(.module)' > ./docs/legacy.yaml From 96fb2768d3fb632fada4f62b5088a594cc5e23fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20SZKIBA?= Date: Tue, 3 Sep 2024 17:40:55 +0200 Subject: [PATCH 10/12] docs: release notes --- releases/v0.1.19.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 releases/v0.1.19.md diff --git a/releases/v0.1.19.md b/releases/v0.1.19.md new file mode 100644 index 0000000..03cd62f --- /dev/null +++ b/releases/v0.1.19.md @@ -0,0 +1,9 @@ +k6registry `v0.1.19` is here 🎉! + +This is an internal maintenance release. + +**simplify responsibility*** + +- only use `registry.schema.json` instead of owning it, `registry.schema.json` source moved to `grafana/k6-extension-registry` repository +- only implement `openapi.yaml` and not own it, `openapi.yaml` source moved to `grafana/k6-extension-registry` repository + From f47bd1399a633248b2782087a88088d7c48bbd98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20SZKIBA?= Date: Tue, 3 Sep 2024 17:45:04 +0200 Subject: [PATCH 11/12] docs: update short description --- README.md | 4 ++-- cmd/cmd.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a5c308c..6f3af1c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

k6registry

-**k6 Extension Registry Generator** +**k6 Extension Registry/Catalog Generator** k6registry is a CLI tool and a GitHub Action that enables the generation of the k6 extension registry. The generation source is a YAML (or JSON) file that contains the most important properties of extensions. The generator generates the missing properties from the repository metadata. Repository metadata is collected using the repository manager APIs. GitHub and GitLab APIs are currently supported. @@ -503,7 +503,7 @@ changed | `true` if the output has changed compared to `ref`, otherwise `false` ## k6registry -k6 Extension Registry Generator +k6 Extension Registry/Catalog Generator ### Synopsis diff --git a/cmd/cmd.go b/cmd/cmd.go index 8c89cac..b2ef102 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -35,7 +35,7 @@ func New() (*cobra.Command, error) { root := &cobra.Command{ Use: "k6registry [flags] [source-file]", - Short: "k6 Extension Registry Generator", + Short: "k6 Extension Registry/Catalog Generator", Long: help, SilenceUsage: true, SilenceErrors: true, From dea5c70c84a60590c2c119a477f1958e4265d10c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20SZKIBA?= Date: Tue, 3 Sep 2024 17:51:23 +0200 Subject: [PATCH 12/12] feat: schema updated --- docs/registry.schema.json | 4 ++-- registry_gen.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/registry.schema.json b/docs/registry.schema.json index 267a764..0893e68 100644 --- a/docs/registry.schema.json +++ b/docs/registry.schema.json @@ -1,5 +1,5 @@ { - "$id": "https://grafana.github.io/k6registry/registry.schema.json", + "$id": "https://registry.k6.io/registry.schema.json", "$ref": "#/$defs/registry", "$defs": { "registry": { @@ -11,7 +11,7 @@ "additionalProperties": false }, "catalog": { - "description": "k6 Extension Catalog.\n\nThe k6 extension catalog is an alternative representation of the k6 extension registry.\nThe catalog stores the extension data in an associative array (object),\nwhere the key is the imprt path for JavaScript extensions, and the output name for output extensions.\nThis data structure is optimized to resolve extensions as dependencies.\n", + "description": "k6 Extension Catalog.\n\nThe k6 extension catalog is an alternative representation of the k6 extension registry.\nThe catalog stores the extension data in an associative array (object),\nwhere the key is the import path for JavaScript extensions, and the output name for output extensions.\nThis data structure is optimized to resolve extensions as dependencies.\n", "type": "object", "additionalProperties": { "$ref": "#/$defs/extension" diff --git a/registry_gen.go b/registry_gen.go index d9a9407..0f927e0 100644 --- a/registry_gen.go +++ b/registry_gen.go @@ -7,7 +7,7 @@ package k6registry // The k6 extension catalog is an alternative representation of the k6 extension // registry. // The catalog stores the extension data in an associative array (object), -// where the key is the imprt path for JavaScript extensions, and the output name +// where the key is the import path for JavaScript extensions, and the output name // for output extensions. // This data structure is optimized to resolve extensions as dependencies. type Catalog map[string]Extension