Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PROPOSAL] Standardize operation groups #417

Open
dblock opened this issue Jul 15, 2024 · 0 comments
Open

[PROPOSAL] Standardize operation groups #417

dblock opened this issue Jul 15, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@dblock
Copy link
Member

dblock commented Jul 15, 2024

What/Why

What are you proposing?

Coming from opensearch-project/documentation-website#7700 it may make sense to organize the documentation by operation group. Currently this list looks very inconsistent.

["info", "ping", "indices", "bulk", "cat", "cluster", "nodes", "count", "dangling_indices", "delete_by_query_rethrottle", "field_caps", "ingest", "mget", "msearch", "msearch_template", "mtermvectors", "security", "knn", "ml", "notifications", "rollups", "transforms", "rank_eval", "reindex", "reindex_rethrottle", "remote_store", "render_search_template", "get_script_context", "get_script_languages", "get_script", "put_script", "delete_script", "scripts_painless_execute", "search", "search_shards", "search_pipeline", "delete_pit", "get_all_pits", "delete_all_pits", "scroll", "clear_scroll", "search_template", "snapshot", "tasks", "update_by_query_rethrottle", "create", "delete_by_query", "index", "get", "exists", "delete", "explain", "create_pit", "get_source", "exists_source", "termvectors", "update_by_query", "update"]

Groups such as indices or bulk make sense, but get_script or put_script should probably be script, etc.

What problems are you trying to solve?

Make it easy to machine-generate documentation that's well organized.

What is the developer experience going to be?

I attempted to check groups with the following code.

  validate_operation_group (): ValidationError | undefined {
    if (!this.group || this.group === '') { return this.error('Missing x-operation-group property') }
    if (!GROUP_REGEX.test(this.group)) { return this.error(`Invalid x-operation-group '${this.group}'. Must match regex: /${GROUP_REGEX.source}/.`) }
    const parts = _.map(_.remove(this.path.split('/'), (part) => {
      if (part[0] == '{' && part[part.length - 1] == '}') return false
      if (part == '_plugins') return false
      if (part.length == 0) return false
      return true
    }), (item) => item.replace(/_/, ''))
    const operation_group = `${parts.shift()}.${_.join(parts, '_')}`
    if (! this.group.startsWith(operation_group)) { return this.error(`Invalid x-operation-group '${this.group}'. Must start with: ${operation_group}.`) }
  }

That almost worked, however in the security namespace we have legacy functions that are correctly grouped with legacy in them while newer functions that map to internalusers are correctly labeled as users.

Any remaining open questions?

What should the standard naming for groups be?

@dblock dblock added enhancement New feature or request and removed untriaged labels Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant