Skip to content

Conversation

pquentin
Copy link
Member

The vast majority of query parameters are not required, but most of them don't specify it. Removing "required": false entirely will help generate the rest-api-spec from the Elasticsearch specification by just not including it when not needed.

This was done using this Python script:

import json
import os

for path in os.listdir("api"):
    if path == "_common.json":
        continue
    api_name = path.removesuffix(".json")
    print(api_name)
    with open(f"api/{path}") as f:
        d = json.load(f)

    for name, data in d[api_name].get("params", {}).items():
        if data.get("required") == False:
            data.pop("required")

    with open(f"api/{path}", "w") as f:
        d = json.dump(d, f, indent=2)
        print("", file=f)  # end with an empty line

The vast majority of query parameters are not required, but most of them don't
specify it. Removing "required": false entirely will help generation.
@pquentin pquentin added >non-issue :Core/Infra/REST API REST infrastructure and utilities auto-backport Automatically create backport pull requests when merged v9.2.0 v8.19.5 v9.1.5 labels Sep 12, 2025
@elasticsearchmachine elasticsearchmachine added the Team:Core/Infra Meta label for core/infra team label Sep 12, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Automatically create backport pull requests when merged :Core/Infra/REST API REST infrastructure and utilities >non-issue Team:Core/Infra Meta label for core/infra team v8.19.5 v9.1.5 v9.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants