File tree Expand file tree Collapse file tree 8 files changed +88
-30
lines changed Expand file tree Collapse file tree 8 files changed +88
-30
lines changed Original file line number Diff line number Diff line change 30
30
}
31
31
],
32
32
"@typescript-eslint/no-explicit-any" : " off" ,
33
- "@typescript-eslint/no-unsafe-declaration-merging" : " off " ,
33
+ "@typescript-eslint/no-unsafe-declaration-merging" : " error " ,
34
34
"eslint/arrow-body-style" : [" error" , " as-needed" ],
35
35
"eslint/curly" : " error" ,
36
36
"eslint/id-length" : " off" ,
Original file line number Diff line number Diff line change @@ -8,9 +8,12 @@ export interface ApiOptions
8
8
resources ?: Resource [ ] ;
9
9
} > { }
10
10
11
- export interface Api extends ApiOptions { }
12
- export class Api {
11
+ export class Api implements ApiOptions {
13
12
entrypoint : string ;
13
+
14
+ title ?: string | null ;
15
+ resources ?: Resource [ ] | null ;
16
+
14
17
constructor ( entrypoint : string , options : ApiOptions = { } ) {
15
18
this . entrypoint = entrypoint ;
16
19
assignSealed ( this , options ) ;
Original file line number Diff line number Diff line change @@ -40,16 +40,29 @@ export interface FieldOptions
40
40
enum ?: { [ key : string | number ] : string | number } ;
41
41
reference ?: string | Resource ;
42
42
embedded ?: Resource ;
43
- required ?: boolean ;
44
43
nullable ?: boolean ;
44
+ required ?: boolean ;
45
45
description ?: string ;
46
46
maxCardinality ?: number ;
47
47
deprecated ?: boolean ;
48
48
} > { }
49
49
50
- export interface Field extends FieldOptions { }
51
- export class Field {
50
+ export class Field implements FieldOptions {
52
51
name : string ;
52
+
53
+ id ?: string | null ;
54
+ range ?: string | null ;
55
+ type ?: FieldType | null ;
56
+ arrayType ?: FieldType | null ;
57
+ enum ?: { [ key : string | number ] : string | number } | null ;
58
+ reference ?: string | Resource | null ;
59
+ embedded ?: Resource | null ;
60
+ nullable ?: boolean | null ;
61
+ required ?: boolean | null ;
62
+ description ?: string | null ;
63
+ maxCardinality ?: number | null ;
64
+ deprecated ?: boolean | null ;
65
+
53
66
constructor ( name : string , options : FieldOptions = { } ) {
54
67
this . name = name ;
55
68
assignSealed ( this , options ) ;
Original file line number Diff line number Diff line change @@ -12,10 +12,15 @@ export interface OperationOptions
12
12
deprecated ?: boolean ;
13
13
} > { }
14
14
15
- export interface Operation extends OperationOptions { }
16
- export class Operation {
15
+ export class Operation implements OperationOptions {
17
16
name : string ;
18
17
type : OperationType ;
18
+ method ?: string | null ;
19
+ expects ?: any | null ;
20
+ returns ?: string | null ;
21
+ types ?: string [ ] | null ;
22
+ deprecated ?: boolean | null ;
23
+
19
24
constructor (
20
25
name : string ,
21
26
type : OperationType ,
Original file line number Diff line number Diff line change 1
- export class Parameter {
1
+ export interface ParameterOptions {
2
+ variable : string ;
3
+ range : string | null ;
4
+ required : boolean ;
5
+ description : string ;
6
+ deprecated ?: boolean | undefined ;
7
+ }
8
+
9
+ export class Parameter implements ParameterOptions {
2
10
variable : string ;
3
11
range : string | null ;
4
12
required : boolean ;
Original file line number Diff line number Diff line change @@ -9,19 +9,29 @@ export interface ResourceOptions
9
9
id ?: string ;
10
10
title ?: string ;
11
11
description ?: string ;
12
- deprecated ?: boolean ;
13
12
fields ?: Field [ ] ;
14
13
readableFields ?: Field [ ] ;
15
14
writableFields ?: Field [ ] ;
16
- parameters ?: Parameter [ ] ;
17
15
getParameters ?: ( ) => Promise < Parameter [ ] > ;
18
16
operations ?: Operation [ ] ;
17
+ deprecated ?: boolean ;
18
+ parameters ?: Parameter [ ] ;
19
19
} > { }
20
20
21
- export interface Resource extends ResourceOptions { }
22
- export class Resource {
21
+ export class Resource implements ResourceOptions {
23
22
name : string ;
24
23
url : string ;
24
+ id ?: string | null ;
25
+ title ?: string | null ;
26
+ description ?: string | null ;
27
+ fields ?: Field [ ] | null ;
28
+ readableFields ?: Field [ ] | null ;
29
+ writableFields ?: Field [ ] | null ;
30
+ getParameters ?: ( ( ) => Promise < Parameter [ ] > ) | null ;
31
+ operations ?: Operation [ ] | null ;
32
+ deprecated ?: boolean | null ;
33
+ parameters ?: Parameter [ ] | null ;
34
+
25
35
constructor ( name : string , url : string , options : ResourceOptions = { } ) {
26
36
this . name = name ;
27
37
this . url = url ;
Original file line number Diff line number Diff line change @@ -23,6 +23,23 @@ interface JsonLdType {
23
23
"@type" ?: Iri | Iri [ ] ;
24
24
}
25
25
26
+ /**
27
+ * A generic expanded JSON‑LD node.
28
+ * • Keys are IRIs.
29
+ * • Each predicate maps to an *array* of nodes or literal values.
30
+ *
31
+ * You can extend this interface with concrete predicates later.
32
+ */
33
+ export interface JsonLdNode extends JsonLdId , JsonLdType {
34
+ [ predicate : Iri ] :
35
+ | JsonLdNode [ ] // linked nodes
36
+ | JsonLdValue [ ] // literals
37
+ | JsonLdId [ ] // references
38
+ | Iri // e.g. "@id"
39
+ | Iri [ ] // e.g. "@type"
40
+ | undefined ; // property may be absent
41
+ }
42
+
26
43
export interface ExpandedOperation {
27
44
"@type" : [ "http://www.w3.org/ns/hydra/core#Operation" ] ;
28
45
"http://www.w3.org/2000/01/rdf-schema#label" : [ JsonLdValue < string > ] ;
@@ -73,7 +90,7 @@ interface ExpandedSupportedProperty {
73
90
"http://www.w3.org/2002/07/owl#deprecated" ?: [ JsonLdValue < boolean > ] ;
74
91
}
75
92
76
- export interface ExpandedClass extends JsonLdNode {
93
+ export interface ExpandedClass {
77
94
"@id" : string ;
78
95
"@type" : [ "http://www.w3.org/ns/hydra/core#Class" ] ;
79
96
"http://www.w3.org/2000/01/rdf-schema#label" ?: [ JsonLdValue < string > ] ;
Original file line number Diff line number Diff line change @@ -994,14 +994,7 @@ const parsed = [
994
994
description : "" ,
995
995
} ,
996
996
] ,
997
- parameters : [
998
- {
999
- variable : "page" ,
1000
- range : "integer" ,
1001
- required : false ,
1002
- description : "The collection page number" ,
1003
- } ,
1004
- ] ,
997
+
1005
998
operations : [
1006
999
{
1007
1000
name : "Retrieves a Book resource." ,
@@ -1034,6 +1027,14 @@ const parsed = [
1034
1027
deprecated : false ,
1035
1028
} ,
1036
1029
] ,
1030
+ parameters : [
1031
+ {
1032
+ variable : "page" ,
1033
+ range : "integer" ,
1034
+ required : false ,
1035
+ description : "The collection page number" ,
1036
+ } ,
1037
+ ] ,
1037
1038
} ,
1038
1039
{
1039
1040
name : "reviews" ,
@@ -1277,14 +1278,7 @@ const parsed = [
1277
1278
description : "" ,
1278
1279
} ,
1279
1280
] ,
1280
- parameters : [
1281
- {
1282
- variable : "page" ,
1283
- range : "integer" ,
1284
- required : false ,
1285
- description : "The collection page number" ,
1286
- } ,
1287
- ] ,
1281
+
1288
1282
operations : [
1289
1283
{
1290
1284
name : "Retrieves a Review resource." ,
@@ -1317,6 +1311,14 @@ const parsed = [
1317
1311
deprecated : false ,
1318
1312
} ,
1319
1313
] ,
1314
+ parameters : [
1315
+ {
1316
+ variable : "page" ,
1317
+ range : "integer" ,
1318
+ required : false ,
1319
+ description : "The collection page number" ,
1320
+ } ,
1321
+ ] ,
1320
1322
} ,
1321
1323
] ;
1322
1324
You can’t perform that action at this time.
0 commit comments