Skip to content

Commit

Permalink
docs: rename jsonpath to JSONPath
Browse files Browse the repository at this point in the history
  • Loading branch information
josdejong committed Sep 25, 2024
1 parent 4b1f3f6 commit 1c29c78
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/lib/plugins/query/jsonpathQueryLanguage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ describe('jsonpathQueryLanguage', () => {
assert.deepStrictEqual(result, [user2])
})

test('should throw an error when trying to sort (not supported by jsonpath)', () => {
test('should throw an error when trying to sort (not supported by JSONPath)', () => {
assert.throws(() => {
createQuery(users, {
sort: {
path: ['user', 'age'],
direction: 'asc'
}
})
}, /Sorting is not supported by jsonpath. Please clear the sorting fields/)
}, /Sorting is not supported by JSONPath. Please clear the sorting fields/)
})

test('should create and execute a project query for a single property', () => {
Expand All @@ -137,7 +137,7 @@ describe('jsonpathQueryLanguage', () => {
paths: [['user', 'name'], ['_id']]
}
})
}, /Error: Picking multiple fields is not supported by jsonpath. Please select only one field/)
}, /Error: Picking multiple fields is not supported by JSONPath. Please select only one field/)
})

test('should create and execute a query with filter and project', () => {
Expand All @@ -158,7 +158,7 @@ describe('jsonpathQueryLanguage', () => {
assert.deepStrictEqual(result, ['Stuart', 'Bob'])
})

test('should throw an exception when the query is no valid jsonpath expression', () => {
test('should throw an exception when the query is no valid JSONPath expression', () => {
assert.throws(() => {
const data = {}
const query = '@bla bla bla'
Expand Down
10 changes: 5 additions & 5 deletions src/lib/plugins/query/jsonpathQueryLanguage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import type { JSONPath } from 'immutable-json-patch'

const description = `
<p>
Enter a <a href="https://github.com/dchester/jsonpath" target="_blank"
rel="noopener noreferrer"><code>jsonpath</code></a> expression to filter, sort, or transform the data.
Enter a <a href="https://github.com/JSONPath-Plus/JSONPath" target="_blank"
rel="noopener noreferrer"><code>JSONPath</code></a> expression to filter, sort, or transform the data.
</p>`

export const jsonpathQueryLanguage: QueryLanguage = {
id: 'jsonpath',
name: 'jsonpath',
name: 'JSONPath',
description,
createQuery,
executeQuery
Expand All @@ -29,13 +29,13 @@ function createQuery(_json: unknown, queryOptions: QueryLanguageOptions): string
}

if (sort && sort.path && sort.direction) {
throw new Error('Sorting is not supported by jsonpath. Please clear the sorting fields')
throw new Error('Sorting is not supported by JSONPath. Please clear the sorting fields')
}

if (projection && projection.paths) {
if (projection.paths.length > 1) {
throw new Error(
'Picking multiple fields is not supported by jsonpath. Please select only one field'
'Picking multiple fields is not supported by JSONPath. Please select only one field'
)
}

Expand Down

0 comments on commit 1c29c78

Please sign in to comment.