aurelia / aurelia/path

buildQueryString should not force to use brackets around nested properties

Open
#38 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
20
Forks
28
PR merge metrics
No merged PRs in 30d

Description

**I'm submitting a feature request**

* **Library Version:**
aurelia-path 1.1.5

**Please tell us about your environment:**
* **Operating System:**
Ubuntu

* **Node Version:**
13.0.1

* **NPM Version:**
6.12.0

* **JSPM OR Webpack AND Version**
webpack 4.41.2

* **Browser:**
all

* **Language:**
all

**Current behavior:**

`buildQueryString` with complex object returns a query string where nested properties (example : author.lastname) are surrounded by square brackets. Exemple : author[lastname].

**Expected/desired behavior:**

For JS server I guess it is equal, since `author.lastname` and `author["lastname"]` are the same, but in Java (and probably in .NET), brackets are only use if the property is indexed (a Map or a List if a number is between the brackets).

* **What is the expected behavior?**

it would be nice to add a parameter to the `buildQueryString` method, so the caller can choose a strategy (dot, brackets). dot could even be the default strategy if it makes no difference for JS web servers.

* **What is the motivation / use case for changing the behavior?**

better compatibility with non JS web servers.

Contributor guide

Open the contributing guide

Research direction

Start at the buildQueryString entry point in aurelia-path 1.1.5 and inspect how nested properties are currently serialized. Compare the existing bracket output with the requested dot strategy, including how callers should choose between strategies and how indexed values should behave. Done means the method supports the requested compatibility option without changing the intended bracket behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.