-
Notifications
You must be signed in to change notification settings - Fork 56
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
Comments
I too am experiencing duplicate parameters in ODataQuery object when it reaches the controller. |
@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. |
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. |
Is this issue fixed? |
How did you fix this? |
You repo solve the problem, but you have an issue when running |
anli-xsigns Can you describe the fix here? |
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.
`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");`
The text was updated successfully, but these errors were encountered: