-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
RESTIssues related to @loopback/rest package and REST transport in generalIssues related to @loopback/rest package and REST transport in generalValidationfeature
Milestone
Description
In loopback/strong-remoting 3.x, we allow remote methods to accept parameters of complex types and have the runtime to convert string inputs (e.g. in a query string or formdata) to such complex type.
- consider whether we want to implement this feature in loopback-next too
- figure how to extend
SwaggerOpenAPI specification to allow developers to specify a complex parameter type to be coerced from a string - implement the proposal
strong-remoting 3.x has pretty extensive test suite that we can reuse here - see strong-remoting:test/rest-coercion/
Acceptance criteria (Scope for 4.0 GA)
- Support "type: object" only
- Leverage OpenAPI spec parameter "style: deepObject"
- For deepObject parameters, support both
color[R]=100&color[G]=200&color[B]=150andcolor={"R":100,"G":200,"B":150}encodings (the latter is our own extension). - Test + Docs
Everything else (other styles than deepObject, array values, etc.) is out of scope of GA.
Examples
-
Send a "filter" query as JSON-encoded value:
GET /api/products?filter={"where":{"name":"Pen"},"limit":10}Sets
filterargument to{where: {name: 'Pen'}, limit: 10}.Alternative encoding:
GET /api/products?filter[where][name]=Pen&filter[limit]=10 -
Encode an array of strings as a comma-separated list (OUT OF SCOPE OF 4.0 GA)
GET /api/domains?tlds=com,net,euSets
tldsargument to['com', 'net', 'eu'].
Metadata
Metadata
Assignees
Labels
RESTIssues related to @loopback/rest package and REST transport in generalIssues related to @loopback/rest package and REST transport in generalValidationfeature