Skip to content

Commit 680d682

Browse files
committed
Add support for owl:deprecated annotations
1 parent a0a2c37 commit 680d682

File tree

7 files changed

+83
-23
lines changed

7 files changed

+83
-23
lines changed

.eslintrc.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
module.exports = {
2-
'env': {
2+
env: {
33
'browser': true,
44
'commonjs': true,
55
'es6': true,
66
'jest': true,
77
'node': true,
88
},
9-
'parser': 'babel-eslint',
10-
'parserOptions': {
9+
parser: 'babel-eslint',
10+
parserOptions: {
1111
ecmaVersion: 7,
1212
sourceType: 'module'
1313
},
14-
'plugins': ['import'],
15-
'extends': 'eslint:recommended',
14+
plugins: ['import', 'flowtype', 'prettier'],
15+
16+
extends: [
17+
"prettier",
18+
"prettier/flowtype",
19+
"prettier/react"
20+
],
21+
1622
};

package.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,26 @@
2424
"babel-preset-es2015": "^6.24.0",
2525
"babel-preset-stage-0": "^6.22.0",
2626
"eslint": "^3.18.0",
27+
"eslint-config-prettier": "^2.9.0",
28+
"eslint-plugin-flowtype": "^2.47.1",
2729
"eslint-plugin-import": "^2.2.0",
30+
"eslint-plugin-prettier": "^2.6.0",
2831
"flow-bin": "^0.42.0",
2932
"jest": "^20.0.0",
30-
"jest-fetch-mock": "^1.0.8"
33+
"jest-fetch-mock": "^1.0.8",
34+
"prettier": "^1.12.1"
3135
},
3236
"dependencies": {
3337
"babel-runtime": "^6.23.0",
3438
"jsonld": "^0.4.11",
35-
"lodash.get": "^4.4.2"
39+
"lodash.get": "^4.4.2",
40+
"npm": "^6.1.0"
3641
},
3742
"scripts": {
3843
"test": "jest",
3944
"lint": "eslint src && flow check",
45+
"fix": "eslint --fix src",
46+
"eslint-check": "eslint --print-config .eslintrc.js | eslint-config-prettier-check",
4047
"build": "babel src -d lib --ignore '*.test.js'"
4148
},
4249
"jest": {

src/Field.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ type FieldOptions = {
77
required?: boolean,
88
description?: string,
99
maxCardinality?: number,
10+
deprecated?: boolean,
1011
}
1112

1213
/**

src/Operation.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ type OperationOptions = {
44
method?: string,
55
returns?: string,
66
types?: Array<string>,
7+
deprecated?: boolean,
78
}
89

910
/**

src/Resource.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import Operation from './Operation';
66
type ResourceOptions = {
77
id?: string,
88
title?: string,
9+
deprecated?: boolean,
910
readableFields?: Field[],
1011
writableFields?: Field[],
1112
operations?: Operation[],
@@ -22,6 +23,7 @@ export default class Resource {
2223
/**
2324
* @param {string} name
2425
* @param {string} url
26+
* @param {boolean} deprecated
2527
* @param {ResourceOptions} options
2628
*/
2729
constructor(name: string, url: string, options: ResourceOptions = {}) {

src/hydra/parseHydraDocumentation.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ export default function parseHydraDocumentation(entrypointUrl, options = {}) {
182182
required: get(supportedProperties, '["http://www.w3.org/ns/hydra/core#required"][0]["@value"]', false),
183183
description: get(supportedProperties, '["http://www.w3.org/ns/hydra/core#description"][0]["@value"]', ''),
184184
maxCardinality: get(supportedProperty, '["http://www.w3.org/2002/07/owl#maxCardinality"][0]["@value"]', null),
185+
deprecated: get(supportedProperty, '["http://www.w3.org/2002/07/owl#deprecated"][0]["@value"]', false),
185186
},
186187
);
187188

@@ -212,6 +213,7 @@ export default function parseHydraDocumentation(entrypointUrl, options = {}) {
212213
expects: entrypointOperation['http://www.w3.org/ns/hydra/core#expects'] && entrypointOperation['http://www.w3.org/ns/hydra/core#expects'][0]['@id'],
213214
returns: range,
214215
types: entrypointOperation['@type'],
216+
deprecated: get(entrypointOperation, '["http://www.w3.org/2002/07/owl#deprecated"][0]["@value"]', false),
215217
},
216218
);
217219

@@ -234,6 +236,7 @@ export default function parseHydraDocumentation(entrypointUrl, options = {}) {
234236
expects: supportedOperation['http://www.w3.org/ns/hydra/core#expects'] && supportedOperation['http://www.w3.org/ns/hydra/core#expects'][0]['@id'],
235237
returns: range,
236238
types: supportedOperation['@type'],
239+
deprecated: get(supportedOperation, '["http://www.w3.org/2002/07/owl#deprecated"][0]["@value"]', false),
237240
},
238241
);
239242

@@ -255,7 +258,8 @@ export default function parseHydraDocumentation(entrypointUrl, options = {}) {
255258
fields: resourceFields,
256259
readableFields,
257260
writableFields,
258-
operations: resourceOperations
261+
operations: resourceOperations,
262+
deprecated: get(relatedClass, '["http://www.w3.org/2002/07/owl#deprecated"][0]["@value"]', false),
259263
}
260264
));
261265
}

0 commit comments

Comments
 (0)