Skip to content

Commit

Permalink
OData: Update default protocol version to v4 (#25862)
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegKipchatov authored Oct 30, 2023
1 parent 30a21fd commit 70b5bec
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 65 deletions.
2 changes: 1 addition & 1 deletion packages/devextreme/js/data/odata/context.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export interface ODataContextOptions {
url?: string;
/**
* @docid
* @default 2
* @default 4
* @acceptValues 2|3|4
* @public
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/devextreme/js/data/odata/query_adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
isUnaryOperation
} from '../utils';

const DEFAULT_PROTOCOL_VERSION = 2;
const DEFAULT_PROTOCOL_VERSION = 4;
const STRING_FUNCTIONS = ['contains', 'notcontains', 'startswith', 'endswith'];

const compileCriteria = (() => {
Expand Down
2 changes: 1 addition & 1 deletion packages/devextreme/js/data/odata/request_dispatcher.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { sendRequest } from './utils';
import './query_adapter';

const DEFAULT_PROTOCOL_VERSION = 2;
const DEFAULT_PROTOCOL_VERSION = 4;

export default class RequestDispatcher {
constructor(options) {
Expand Down
2 changes: 1 addition & 1 deletion packages/devextreme/js/data/odata/store.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export interface ODataStoreOptions<
url?: string;
/**
* @docid
* @default 2
* @default 4
* @acceptValues 2|3|4
* @public
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1679,7 +1679,7 @@ QUnit.test('filterToLower option equal false for OData store', function(assert)
filter: ['prop.nested.prop', 'contains', 'O']
}).load()
.done(function(data) {
assert.equal(data[0].data.$filter, 'substringof(\'O\',prop/nested/prop)');
assert.equal(data[0].data.$filter, 'contains(prop/nested/prop,\'O\')');
})
.always(function() {
ajaxMock.clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ QUnit.test('slice', function(assert) {
QUnit.test('select', function(assert) {
const done = assert.async();

QUERY('odata.org')
QUERY('odata.org', { version: 2 })
.select('a.x', 'a.y', 'b')
.enumerate()
.fail(function() {
Expand All @@ -239,7 +239,7 @@ QUnit.test('select', function(assert) {
QUnit.test('expand to third level', function(assert) {
const done = assert.async();

QUERY('odata.org')
QUERY('odata.org', { version: 2 })
.select('a.b.c')
.enumerate()
.fail(function() {
Expand Down Expand Up @@ -366,7 +366,7 @@ QUnit.test('works', function(assert) {
});

const promises = [
QUERY('odata.org')
QUERY('odata.org', { version: 2 })
.filter([
['date', new Date(1996, 6, 4, 1, 1, 1, 1)],
['date', new Date(1996, 6, 4, 1, 1, 1, 10)],
Expand All @@ -375,7 +375,7 @@ QUnit.test('works', function(assert) {
])
.enumerate(),

QUERY('odata4.org', { version: 4 })
QUERY('odata4.org')
.filter([
['date', new Date(1996, 6, 4, 1, 1, 1, 1)],
['date', new Date(1996, 6, 4, 1, 1, 1, 10)],
Expand Down Expand Up @@ -705,7 +705,7 @@ QUnit.test('string functions', function(assert) {
const done = assert.async();

const check = function(operation, expectation) {
return QUERY('odata.org')
return QUERY('odata.org', { version: 2 })
.filter('f.p', operation, 'Ab')
.enumerate()
.done(function(r) {
Expand Down Expand Up @@ -733,7 +733,7 @@ QUnit.test('string functions with filterToLower equal false', function(assert) {
const done = assert.async();

const check = function(operation, expectation) {
return QUERY('odata.org', { filterToLower: false })
return QUERY('odata.org', { filterToLower: false, version: 2 })
.filter('f.p', operation, 'Ab')
.enumerate()
.done(function(r) {
Expand Down Expand Up @@ -763,7 +763,7 @@ QUnit.test('string functions with global filterToLower equal false', function(as
config({ oDataFilterToLower: false });

const check = function(operation, expectation) {
return QUERY('odata.org')
return QUERY('odata.org', { version: 2 })
.filter('f.p', operation, 'Ab')
.enumerate()
.done(function(r) {
Expand Down Expand Up @@ -895,7 +895,7 @@ QUnit.test('Explicit Edm literals (Q441230 case)', function(assert) {
QUnit.test('Edm literals for case conversion (Q522002)', function(assert) {
const done = assert.async();

QUERY('odata.org')
QUERY('odata.org', { version: 2 })
.filter(new EdmLiteral('tolower(Name)'), 'contains', new EdmLiteral('tolower(\'abc\')'))
.enumerate()
.fail(function() {
Expand Down Expand Up @@ -1087,13 +1087,13 @@ QUnit.test('enumerate with/without requireTotalCount', function(assert) {
});

const promises = [
QUERY('odata.org')
QUERY('odata.org', { version: 2 })
.enumerate()
.done(function(r, extra) {
assert.ok(!extra);
}),

QUERY('odata.org/count', { requireTotalCount: true })
QUERY('odata.org/count', { requireTotalCount: true, version: 2 })
.enumerate()
.done(function(r, extra) {
assert.equal(extra.totalCount, 123);
Expand Down
Loading

0 comments on commit 70b5bec

Please sign in to comment.