opensearch-project / OpenSearch

🔎 Open source distributed and RESTful search engine.
https://opensearch.org/docs/latest/opensearch/index/
Apache License 2.0
9.6k stars 1.76k forks source link

Delete unused parts of rest-api-spec #4027

Open dblock opened 2 years ago

dblock commented 2 years ago

Is your feature request related to a problem? Please describe.

The actual spec portion of https://github.com/opensearch-project/OpenSearch/tree/main/rest-api-spec is AFAIK unused, and likely incorrect. Looking at, for example, https://github.com/opensearch-project/OpenSearch/commit/931813f8cf512260430101495905bcd0b7602c11, we update the tests, but we don't make changes to the spec.

Describe the solution you'd like Delete any unused parts.

Additional context More recent work in https://github.com/opensearch-project/opensearch-api-specification is probably the future of API spec, authored in Smithy. The idea is that that repo will become the canonical source of truth for versioned APIs, that we will build and publish it into OpenAPI, and that we would generate clients and server from it.

dblock commented 2 years ago

@reta Is what I am saying ^ accurate? I was inspired by your change there.

reta commented 2 years ago

:+1: @dblock you are very right, the spec seems to be out of sync and needs cleanup (it also references ealsticsearch all over the place) ....

andrross commented 2 years ago

Out of curiosity I did some poking here and found that

rm -rf ./rest-api-spec/src/main/resources/rest-api-spec/api

will at least result in a failure when running:

./gradlew ':client:rest-high-level:test' --tests "org.opensearch.client.RestHighLevelClientTests.testApiNamingConventions"

so the spec isn't entirely unused. Just figured I'd share for anyone else like me who is unfamiliar with this :)

VachaShah commented 2 years ago

The tests in this spec are also used in opensearch-rs for test cases https://github.com/opensearch-project/opensearch-rs/blob/main/yaml_test_runner/src/github.rs#L73 and in api-generator https://github.com/opensearch-project/opensearch-rs/blob/main/api_generator/src/rest_spec/mod.rs#L47.

There is a discussion to decouple the tests in rust client from this rest-api-spec. Refer https://github.com/opensearch-project/opensearch-rs/pull/59#issuecomment-1190779334.