The code changes have also taken worker authentication design [doc](WorkerGateway Authentication design doc into consideration.
[x] Firstly Restructure - Proper separation of different types of bindings, , introduce gateway_binding_executor trait, restructure and many re-writes. Removed some confusing modules too such as parser in worker-service-base. The restructure is done in a way that it's easier to just move all gateway related into another module down the time. It requires a bit more work than we think.
[x] With that done, introduction of a new binding type called cors pre-flight for preflight requests from browsers, that has no way to access any workers
[x] Once module restructuring and new preflight request handling is done, introduction of the concept of generic middleware
[x] Gateway needs CORS preflight binding, as well as CORS middleware to play together. Make sure this is done. Users don't necessarily add middleware in every routes. They simply configure preflights (example: AWS gateway), and that essentially means middleware is automatically added to the other routes. Resolve conflicts if there is any, as users may configure it by themselves (although it is hardly seen). These are discussed in notion page (I think)
[x] Support both concise and verbose versions of CORS - OpenAPI spec supports both and native Api Definition supports only concise. This is the best I could come up with.
[x] OpenAPI spec fix to support binding at Operator level. It was at path level, and we had to fix to get CORS going.
[x] Add a full end to end tests module for API Gateway. i.e, Given an input request, get the final response based on registered definitions. This has no integration with any other modules. The new file server binding was tested through golem-cli because of the absence of such a workflow test. The new CORS is tested in this module. I am adding a file server test here as well (along with what's existing in golem-cli side).
[x] Ensuring backward compatibility ensured both from REST API perspective and GRPC proto. This was a bit of work
[x] Many renaming, especially avoiding worker-bridge, but keeping backward compatibility.
[x] Also, making sure that tests don't have its own instances of ToResponse
TODO
[x] FileServer binding to follow the new way of GatewayBinding enum that is completely independent
[x] Resolve conflicts with IFS changes
[x] Fixing FileServer tests
It took a bit of time than I thought for resolving conflicts and make necessary changes to get the file server tests working again.
Note that the new module structure will help with separating it out completely
New module structure (focused on separating it out in future)
Fixes #921
Design doc here
The code changes have also taken worker authentication design [doc](WorkerGateway Authentication design doc into consideration.
ToResponse
TODO
It took a bit of time than I thought for resolving conflicts and make necessary changes to get the file server tests working again.
Note that the new module structure will help with separating it out completely
New module structure (focused on separating it out in future)
Before, it was the following
Now, it is (gateway responsibilities are well separated out)