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

treat bodies as of type 'value' when not described in schema #49

Merged
merged 3 commits into from
Aug 7, 2024

Conversation

miguelgrinberg
Copy link
Contributor

It appears there are some endpoints in the schema that use a body, but do not have an explicit description of it. Example:

    {
      "availability": {
        "stack": {
          "stability": "stable",
          "visibility": "public"
        }
      },
      "description": "Puts the configuration for a geoip database to be downloaded",
      "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/master/TODO.html",
      "name": "ingest.put_geoip_database",
      "request": null,
      "requestBodyRequired": true,
      "response": null,
      "responseMediaType": [
        "application/json"
      ],
      "stability": "stable",
      "urls": [
        {
          "methods": [
            "PUT"
          ],
          "path": "/_ingest/geoip/database/{id}"
        }
      ],
      "visibility": "public"
    },

With the current logic, the request attribute being null causes the Python and JavaScript exporters to ignore the body. With this change, these endpoints will be treated as having a body with kind == 'value', which makes the exporters output the body as a generic object.

Copy link
Member

@JoshMock JoshMock left a comment

Choose a reason for hiding this comment

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

LGTM, just a couple nits that are up to your discretion.

miguelgrinberg and others added 2 commits August 7, 2024 16:40
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
@miguelgrinberg miguelgrinberg merged commit 2bbe196 into main Aug 7, 2024
23 checks passed
@miguelgrinberg miguelgrinberg deleted the generic-body-without-schema branch August 7, 2024 15:58
github-actions bot pushed a commit that referenced this pull request Aug 7, 2024
* treat bodies as of type 'value' when not described in schema

* Update src/exporters/javascript.ts

Co-authored-by: Josh Mock <joshua.mock@elastic.co>

* Update src/exporters/python.ts

Co-authored-by: Josh Mock <joshua.mock@elastic.co>

---------

Co-authored-by: Josh Mock <joshua.mock@elastic.co>
(cherry picked from commit 2bbe196)
miguelgrinberg added a commit that referenced this pull request Aug 7, 2024
* treat bodies as of type 'value' when not described in schema

* Update src/exporters/javascript.ts

Co-authored-by: Josh Mock <joshua.mock@elastic.co>

* Update src/exporters/python.ts

Co-authored-by: Josh Mock <joshua.mock@elastic.co>

---------

Co-authored-by: Josh Mock <joshua.mock@elastic.co>
(cherry picked from commit 2bbe196)

Co-authored-by: Miguel Grinberg <miguel.grinberg@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants