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

Add CAT API automation #9042

Closed
wants to merge 10 commits into from
Closed

Add CAT API automation #9042

wants to merge 10 commits into from

Conversation

Naarcha-AWS
Copy link
Collaborator

Description

The following PR adds CAT API automation markers. All descriptions have been reviewed by editorial, see opensearch-project/opensearch-api-specification#726.

Checklist

  • By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and subject to the Developers Certificate of Origin.
    For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Copy link

github-actions bot commented Jan 9, 2025

Thank you for submitting your PR. The PR states are In progress (or Draft) -> Tech review -> Doc review -> Editorial review -> Merged.

Before you submit your PR for doc review, make sure the content is technically accurate. If you need help finding a tech reviewer, tag a maintainer.

When you're ready for doc review, tag the assignee of this PR. The doc reviewer may push edits to the PR directly or leave comments and editorial suggestions for you to address (let us know in a comment if you have a preference). The doc reviewer will arrange for an editorial review.

@Naarcha-AWS Naarcha-AWS added backport 2.18 PR: Backport label for 2.18 4 - Doc review PR: Doc review in progress labels Jan 9, 2025
Copy link
Collaborator

@kolchfa-aws kolchfa-aws left a comment

Choose a reason for hiding this comment

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

A couple of suggestions for template consistency.

columns: Parameter,Type,Description,Default
include_deprecated: false
-->
## Query parameters
Copy link
Collaborator

Choose a reason for hiding this comment

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

There should be a line between the heading and the table: do the spec tags have to go below the heading for it to happen? There should also be an intro sentence here "The following table lists the available query parameters. All query parameters are optional." per the API template.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agreed. I noticed now that not having the space breaks the table on prod. I'll omit the header for now.

@nhtruong: can we adjust the workflow to add a space after the header for both query parameters and path parameters?

`cluster_manager_timeout` | String | A timeout for connection to the cluster manager node. |
`format` | String | A short version of the HTTP `Accept` header, such as `json` or `yaml`. |
`h` | List | A comma-separated list of column names to display. |
`help` | Boolean | Return help information. | `false`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
`help` | Boolean | Return help information. | `false`
`help` | Boolean | Returns help information. | `false`

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updating this description in the spec.

<!-- spec_insert_end -->


## Example request

```
Copy link
Collaborator

Choose a reason for hiding this comment

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

There should be a json highlighter specified for the example requests.

:--- | :--- | :--- | :---
`bytes` | String | The units used to display byte values. |
`cluster_manager_timeout` | String | The amount of time allowed to establish a connection to the cluster manager node. |
`expand_wildcards` | List or String | The type of index that wildcard patterns can match. |
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we provide valid values for expand_wildcards?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updating the description in the spec now.

`h` | List | A comma-separated list of column names to display. |
`help` | Boolean | Return help information. | `false`
`s` | List | A comma-separated list of column names or column aliases to sort by. |
`time` | String | Specifies the time units, for example, `5d` or `7h`. For more information, see [Supported units](https://opensearch.org/docs/latest/api-reference/units/). |
Copy link
Collaborator

Choose a reason for hiding this comment

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

The previous instance of time did not include examples. I think examples are nice and a link to the units should be provided.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Are all time parameter descriptions coming from different places in the spec? If so, we should create a reference variable in the spec and source all descriptions from that variable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Let's talk about using $ref for descriptions in another venue. Using $refs for descriptions also affects how other developers contribute new or missing specs, so I think it warrants a larger discussion about how to do it properly.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We talked about this in the API spec repo a while ago opensearch-project/opensearch-api-specification#726 (comment)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes we did. When I tried to do this locally it the spec would error out, similar to what's discussed in this issue: opensearch-project/opensearch-api-specification#577. I believe that you would have to create a separate schema which includes only the shared description, as opposed to referencing an already used description to another schema. I'll make an issue the api-specification repo detailing what I tried and encountered.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we just need to keep the definitions in the common schema and generate valid values off of the enum (I opened an issue in the api-spec repo opensearch-project/opensearch-api-specification#783) cc: @nhtruong

<!-- spec_insert_end -->

## Request body fields

Copy link
Collaborator

Choose a reason for hiding this comment

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

There should be an intro sentence here per the API template.


```json
GET /_cat/pit_segments

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change

"o463QQEPbXktaW5kZXgtMDAwMDAxFkhGN09fMVlPUkVPLXh6MUExZ1hpaEEAFjBGbmVEZHdGU1EtaFhhUFc4ZkR5cWcAAAAAAAAAAAIWaXBPNVJtZEhTZDZXTWFFR05waXdWZwEWSEY3T18xWU9SRU8teHoxQTFnWGloQQAA"
]
}
```
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add a copy button here

`bytes` | String | The units used to display byte values. |
`completed_only` | Boolean | When `true`, the response only includes the last-completed segment replication events. | `false`
`detailed` | Boolean | When `true`, the response includes additional metrics for each stage of a segment replication event. | `false`
`expand_wildcards` | List or String | Whether to expand the wildcard expression to include concrete indexes that are open, closed, or both. |
Copy link
Collaborator

Choose a reason for hiding this comment

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

This description is different from one of the above expand_wildcards descriptions. We should make them the same by using a variable in the spec.

include_deprecated: false
-->
## Query parameters
Parameter | Type | Description | Default
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we make this "Data type" to be consistent with the template?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure. But I don't think this should be a blocker for this PR since @nhtruong would have to address it in the workflow.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Addendum to my previous. I figured out how to update this and will add it to this PR.

@Naarcha-AWS Naarcha-AWS mentioned this pull request Jan 10, 2025
26 tasks
@Naarcha-AWS
Copy link
Collaborator Author

Going to close this one for now to open a new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 - Doc review PR: Doc review in progress backport 2.18 PR: Backport label for 2.18
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants