Skip to content

Conversation

@areina
Copy link
Collaborator

@areina areina commented Apr 2, 2025

Add a plugin that checks that:

  • entity-related messages (e.g: Cluster) define a known set of common fields: [id, name, account_id, created_at].
  • Request messages (e.g: ListClusters) define a known set of common fields: [account_id].

The list of entity required fields can be configured using the plugin options.

@areina areina self-assigned this Apr 2, 2025
@areina areina requested a review from a team as a code owner April 2, 2025 14:01
@areina
Copy link
Collaborator Author

areina commented Apr 2, 2025

@Robert-Stam @mikheillomidzeq executing it against the current public api, I get these linting issues:

proto/qdrant/cloud/auth/v2/auth.proto:88:1:"ManagementKey" is missing required fields: [name] (buf-plugin-required-fields)
proto/qdrant/cloud/booking/v2/booking.proto:83:1:"Package" is missing required fields: [account_id created_at] (buf-plugin-required-fields)
proto/qdrant/cloud/cluster/auth/v2/database_api_key.proto:88:1:"DatabaseApiKey" is missing required fields: [name] (buf-plugin-required-fields)
proto/qdrant/cloud/cluster/backup/v1/backup.proto:294:1:"BackupSchedule" is missing required fields: [name] (buf-plugin-required-fields)
proto/qdrant/cloud/cluster/v2/cluster.proto:540:1:"QdrantRelease" is missing required fields: [id name account_id created_at] (buf-plugin-required-fields)
proto/qdrant/cloud/platform/v1/platform.proto:61:1:"CloudProvider" is missing required fields: [account_id created_at] (buf-plugin-required-fields)
proto/qdrant/cloud/platform/v1/platform.proto:71:1:"CloudProviderRegion" is missing required fields: [name account_id created_at] (buf-plugin-required-fields)

There are three options:

  • Update the public api adding the fields (I'm not sure that makes sense for all them, it would be good to review it anyway)
  • Relax the list of required fields (the only one that we might remove is name)
  • Add comments where necessary in the proto files to ignore the linting rule

Add a plugin that checks that:

- entity-related messages (e.g: Cluster) define a known set of common fields
for the Qdrant Cloud API: `[id, name, account_id, created_at]`.
- Request messages (e.g: ListClusters) define a known set of common fields
for the Qdrant Cloud API: `[account_id]`.
@areina areina force-pushed the feat/toni/add-required-fields-plugin branch from 8488e4b to 092c8ef Compare April 2, 2025 14:08
Copy link
Contributor

@Robert-Stam Robert-Stam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small comments, further LGTM.

what about adding an annotation (extension) to proto which we can use to 'override' the default names per message, we we can configure the linter if we like?

@areina
Copy link
Collaborator Author

areina commented Apr 2, 2025

Small comments, further LGTM.

what about adding an annotation (extension) to proto which we can use to 'override' the default names per message, we we can configure the linter if we like?

We could do that. Another option if we don't want to clutter the proto definitions is to enable that kind of configuration using the plugins option. Could be something like (for some reason they don't support a map and we would need a little hack using |):

 - plugin: buf-plugin-required-fields
    options:
      required_entity_fields:
        - ManagementKey|id,account_id,created_at

I think for the current linting issues we have we could just add a comment in the proto file to ignore them and in the future we can implement one of the two options (proto extension or plugin config).

Example ignoring linting in proto definition:

// buf:lint:ignore QDRANT_CLOUD_REQUIRED_ENTITY_FIELDS
message ManagementKey {
   ...
}

@areina areina requested a review from Robert-Stam April 2, 2025 15:35
@Robert-Stam
Copy link
Contributor

// buf:lint:ignore QDRANT_CLOUD_REQUIRED_ENTITY_FIELDS

Fine with // buf:lint:ignore QDRANT_CLOUD_REQUIRED_ENTITY_FIELDS

// Package main implements a plugin that checks that:
// - entity-related messages (e.g: Cluster) define a known set of common fields
// for the Qdrant Cloud API. Default values: id, name, account_id, created_at
// - Request messages (e.g: ListClusters) define a known set of common fields
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ListClusters --> ListClustersRequest

Copy link
Contributor

@Robert-Stam Robert-Stam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one remark, further LGTM

@areina areina enabled auto-merge (squash) April 2, 2025 17:00
@areina areina disabled auto-merge April 2, 2025 17:00
@areina areina merged commit 87811bf into main Apr 2, 2025
5 checks passed
@areina areina deleted the feat/toni/add-required-fields-plugin branch April 2, 2025 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants