-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
OpenSearch Smithy IDL Model - RFC #1590
Comments
Do we have instances of such? |
I like the proposal and I think you should PR it. It looks like there are no downsides except that we all have to learn to author a different spec? The change in OpenSearch would imply the same change in plugins as we want to publish a combined API spec for the entire distribution. See opensearch-project/opensearch-build#702. Does this make it easier/harder/different? |
Yup, One such example in the PoC would be the search within Search API, we noticed that the several parameter can be passed as both query parameter and within the body. Will get back to you regarding the second part |
Hello all; Thanks for your feedback. We're going to be moving ahead on this project. If you're interested, or you'd like to contribute, we'll be working in a new repo called opensearch-api-specifications. I'll be closing this issue out on February 21st to continue the conversations over there. See you in the new repo! |
Very cool to see this! |
Is your feature request related to a problem? Please describe.
Currently OpenSearch only provides partial definitions for the available OpenSearch APIs in https://github.com/opensearch-project/OpenSearch/tree/main/rest-api-spec/src/main/resources/rest-api-spec/api. These APIs are defined here as JSON documents and describes only the URL path for the operation and the Query parameters that it accepts. The accepted parameters in the request body for the APIs are not clearly specified anywhere and similarly the expected response structure is not defined. The documentation also does not cover all the possible request parameters / responses.
For users of OpenSearch it would be extremely helpful if all these available APIs were well defined and documented using an interface definition language like Smithy (https://awslabs.github.io/smithy/).
Describe the solution you'd like
We propose to define new API models for the OpenSearch APIs using Smithy interface definition language (IDL). Smithy is an open source IDL which is protocol agnostic, extensible and supports code generation. The API models could be defined in the same OpenSearch Github repository under a new “api model” directory or we could create a separate Github repository for defining the API models.
We have created a POC to demonstrate the use of Smithy models by defining few OpenSearch APIs: https://github.com/pgtgrly/OpenSearch/tree/smithy-specification. The models have been defined in “smithy-specification” directory and it is configured to also generate an OpenAPI model and a typescript client during build.
Describe alternatives you've considered
We could also define the API models using OpenAPI directly, however we felt that Smithy was much more expressive and easier language to define the APIs. Smithy models are much cleaner to read and can be easily converted to OpenAPI during build.
Additional context
Below are some snippets on how the service and APIs can be defined using Smithy:
Defining the service
Defining an Operation / API
Defining the Request body for Put Mapping operation
Defining Response body for Put Mapping operation
Smithy models can easily be configured to translate into OpenAPI format by specifying OpenAPI plugin in the smithy-build.json file
For more details please refer to the Smithy models defined in POC: https://github.com/pgtgrly/OpenSearch/tree/smithy-specification
Benefits of defining OpenSearch API models using Smithy
Limitations
Co-authored by: pgtgrly and sachetalva
The text was updated successfully, but these errors were encountered: