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

Spike: Create Controller in JSLB4 #2478

Closed
hacksparrow opened this issue Feb 26, 2019 · 2 comments
Closed

Spike: Create Controller in JSLB4 #2478

hacksparrow opened this issue Feb 26, 2019 · 2 comments

Comments

@hacksparrow
Copy link
Contributor

Follow up task for #1978.

Acceptance criteria

a. Should be created as a class
b. Should be automatically loaded in the LB4 app
c. Should have access to a specified Repository
d. Should expose CRUD methods to interact with the Repository
e. Should allow custom methods to be added, with access to:
i. The LB4 request object
ii. A Model
iii. A Repository
iv. The LB4 response object

@bajtos
Copy link
Member

bajtos commented Feb 26, 2019

@hacksparrow could you please make it more explicit that we also need an easy-to-use solution for describing the remote methods via OpenAPI spec? There are several ways how to do that, I'd like us to consider all of them before we decide the winner. See the discussion in #1978 for more details.

Many of the points I made in #2474 (comment) apply to Controllers too, most notably:

(2)
In addition to the list of objects the route should have access to, the route must be also able to receive parameters parsed by LB4 from the request. The parameters are described in the provided OpenAPI spec (this.route argument number 3), either via parameters or requestBody.

(4)
To describe route's inputs and outputs, we need a helper function to build JSON schema from LB4 model class. I believe that in TypeScript, this conversion is done automatically by @param and @response decorators. In JavaScript, we need to be more explicit.

(5)
As you can see, building the OperationObject requires a lot of boilerplate code. It would be great to create a follow-up spike to look for ways how to simplify this part.

@hacksparrow
Copy link
Contributor Author

Closing as per the decision taken in #2567.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants