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

[FEATURE] Create an ExtensionRequestHandler class to pair with NamedRoutes #856

Open
dbwiddis opened this issue Jul 1, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@dbwiddis
Copy link
Member

dbwiddis commented Jul 1, 2023

Is your feature request related to a problem?

In opensearch-project/OpenSearch#7957, the NamedRoute class is being implemented to replace existing extension Route and RouteHandler options. For the security implementation it will be required that Extensions implement this.

One of the builder's required arguments is a handler with type Function<RestRequest, RestResponse>. Extensions are expected to use the ExtensionRestResponse class whose entire reason for existence is to communicate a list of consumed parameters, and a consumed content boolean, to OpenSearch.

Enforcing the ExtensionRestResponse type is most easily done with a subclass, but NamedRoute does not permit inheritance.

What solution would you like?

We can create an ExtensionRequestHandler class which either enforces the ExtensionRestResponse type, or better yet, handles all the checking of consumed params within the SDK and includes some of the "exceptional Response" handling we currently get in the BaseExtensionRestHandler class.

We've already had to special-case consuming params and content on the OpenSearch side of transport for the case of exceptions; we could just make that the default if it's always handled on the SDK side.

What alternatives have you considered?

Lots more type checks in the existing code.

Do you have any additional context?

Some of this may be handled in #622

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant