Skip to content

[Spike] Investigate how to allow complex object in filter object in API Explorer #3770

@dhmlau

Description

@dhmlau

Originated from #2208.

Description

swagger-ui, the library powering our API Explorer, unfortunately does not support complex objects in query strings. This spike is to investigate if/how we can allow it.

Extracting from #2208 (comment) from @bajtos

Based on OAI/OpenAPI-Specification#1706 (comment) (cross-posted below), maybe we can switch filter encoding from deepObject style into JSON?

Here is an experiment we can try:

  1. Let's keep @param.query.object with no changes for backwards compatibility.
  2. Introduce a new helper @param.query.jsonObject that will use JSON encoding instead of deepObject style.
  3. Modify the function parseJsonIfNeeded to detect JSON encoding and parse the string value - see packages/rest/src/coercion/coerce-parameter.ts
  4. Update our example Todo controller to use @param.query.jsonObject - see examples/todo/src/controllers/todo.controller.ts
  5. Start the Todo app, open API Explorer and check how is the filter parameter handled.

Acceptance Criteria

- [ ] Review the workaround posted by various users in #2208

  • Try out the experiment from @bajtos (listed above)

Metadata

Metadata

Assignees

Labels

developer-experienceIssues affecting ease of use and overall experience of LB usersspike

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions