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

Issues with the $filter, $select and other QueryOperations #33

Open
siddiquipro opened this issue Aug 4, 2018 · 7 comments
Open

Issues with the $filter, $select and other QueryOperations #33

siddiquipro opened this issue Aug 4, 2018 · 7 comments

Comments

@siddiquipro
Copy link

Hello @lazarv

I see some issues with the odata-v4-server ODataQuery, the request query which is received in the controller has duplicated parameters. As a result of duplicate parameters the query generated by odata-v4-sql are incorrect. I feel there is a potential bug in the Visitor class.

Below is the screenshot for reference.

image

`import {
odata,
ODataController,
ODataServer,
ODataQuery,
Edm
} from "odata-v4-server";
import { createQuery, createFilter } from "odata-v4-sql";

export default class employee {
@Edm.Key
@Edm.Computed
@edm.String
id: string;
@edm.String name: string;
@edm.String email: string;
@edm.String department: string;
@edm.String countryCode: string;
}

@odata.type(employee)
export class EmployeeController extends ODataController {
@odata.GET
async find(@odata.query query: ODataQuery) {
console.log("Query Received in controller - ", query);
const sqlQuery = createQuery(query);
console.log("SQL Query Returned from odata-v4-sql - ", sqlQuery);
return [];
}
}

@odata.cors
@odata.controller(EmployeeController, "employee")
export class NorthwindODataServer extends ODataServer {}

NorthwindODataServer.create("/", 3003);
console.log("Odata Server Running at / on port 3003");`

@jwerra
Copy link

jwerra commented Aug 20, 2018

I too am experiencing duplicate parameters in ODataQuery object when it reaches the controller.

@jwerra
Copy link

jwerra commented Aug 20, 2018

@mohammadsiddiqui @lazarv It looks like ddb6c1a#diff-b9cfc7f2cdf78a7f4b91a753d10865a2 updated deepmerge to a version with breaking changes. The default is now set to concat arrays which is resulting in duplicate parameters.

@anli-xsigns
Copy link

I've written a small fix for this, see https://github.com/anli-xsigns/odata-v4-server. You can install the dependency from the git repo, I've made some changes in package.json therefore. If there's interest in a PR I can create one. I've also fixed #35 in that repo.

@Rd1819
Copy link

Rd1819 commented Mar 14, 2022

Is this issue fixed?

@Rd1819
Copy link

Rd1819 commented Mar 14, 2022

I too am experiencing duplicate parameters in ODataQuery object when it reaches the controller.

How did you fix this?

@HaithamOumerzoug
Copy link

You repo solve the problem, but you have an issue when running npm install command.
It's running muilpe times.

@vlatek
Copy link

vlatek commented Aug 28, 2024

anli-xsigns Can you describe the fix here?

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

No branches or pull requests

6 participants