@api-client/core 0.18.15 → 0.18.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/src/modeling/importers/SchemaFilteringStrategy.d.ts.map +1 -1
- package/build/src/modeling/importers/SchemaFilteringStrategy.js +3 -9
- package/build/src/modeling/importers/SchemaFilteringStrategy.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/data/models/example-generator-api.json +17 -17
- package/package.json +1 -1
- package/src/modeling/importers/SchemaFilteringStrategy.ts +3 -11
- package/tests/unit/modeling/importers/schema_filtering.spec.ts +47 -3
|
@@ -42071,10 +42071,10 @@
|
|
|
42071
42071
|
"@id": "#197"
|
|
42072
42072
|
},
|
|
42073
42073
|
{
|
|
42074
|
-
"@id": "#
|
|
42074
|
+
"@id": "#203"
|
|
42075
42075
|
},
|
|
42076
42076
|
{
|
|
42077
|
-
"@id": "#
|
|
42077
|
+
"@id": "#200"
|
|
42078
42078
|
},
|
|
42079
42079
|
{
|
|
42080
42080
|
"@id": "#206"
|
|
@@ -42810,16 +42810,16 @@
|
|
|
42810
42810
|
"@id": "#219"
|
|
42811
42811
|
},
|
|
42812
42812
|
{
|
|
42813
|
-
"@id": "#
|
|
42813
|
+
"@id": "#213"
|
|
42814
42814
|
},
|
|
42815
42815
|
{
|
|
42816
|
-
"@id": "#
|
|
42816
|
+
"@id": "#210"
|
|
42817
42817
|
},
|
|
42818
42818
|
{
|
|
42819
|
-
"@id": "#
|
|
42819
|
+
"@id": "#216"
|
|
42820
42820
|
},
|
|
42821
42821
|
{
|
|
42822
|
-
"@id": "#
|
|
42822
|
+
"@id": "#219"
|
|
42823
42823
|
}
|
|
42824
42824
|
],
|
|
42825
42825
|
"doc:root": false,
|
|
@@ -43499,7 +43499,7 @@
|
|
|
43499
43499
|
"doc:ExternalDomainElement",
|
|
43500
43500
|
"doc:DomainElement"
|
|
43501
43501
|
],
|
|
43502
|
-
"doc:raw": "
|
|
43502
|
+
"doc:raw": "code: 'J'\ndescription: 'Information and communication'\n",
|
|
43503
43503
|
"core:mediaType": "application/yaml",
|
|
43504
43504
|
"sourcemaps:sources": [
|
|
43505
43505
|
{
|
|
@@ -43520,7 +43520,7 @@
|
|
|
43520
43520
|
"doc:ExternalDomainElement",
|
|
43521
43521
|
"doc:DomainElement"
|
|
43522
43522
|
],
|
|
43523
|
-
"doc:raw": "
|
|
43523
|
+
"doc:raw": "class: '3'\ndescription: '150 - 300'\nnumberOfFte: 5500\nnumberOfEmployees: 5232\n",
|
|
43524
43524
|
"core:mediaType": "application/yaml",
|
|
43525
43525
|
"sourcemaps:sources": [
|
|
43526
43526
|
{
|
|
@@ -44232,7 +44232,7 @@
|
|
|
44232
44232
|
"doc:ExternalDomainElement",
|
|
44233
44233
|
"doc:DomainElement"
|
|
44234
44234
|
],
|
|
44235
|
-
"doc:raw": "type: 'GENERAL'\ncountryDialCode : '+32'\nareaCode : '
|
|
44235
|
+
"doc:raw": "type: 'GENERAL'\ncountryDialCode : '+32'\nareaCode : '21'\nsubscriberNumber: '12.87.00'\nformatted: '+32-(0)21 302099'\n",
|
|
44236
44236
|
"core:mediaType": "application/yaml",
|
|
44237
44237
|
"sourcemaps:sources": [
|
|
44238
44238
|
{
|
|
@@ -44253,7 +44253,7 @@
|
|
|
44253
44253
|
"doc:ExternalDomainElement",
|
|
44254
44254
|
"doc:DomainElement"
|
|
44255
44255
|
],
|
|
44256
|
-
"doc:raw": "
|
|
44256
|
+
"doc:raw": "type: 'GENERAL'\ncountryDialCode : '+32'\nareaCode : '22'\nsubscriberNumber: '12.87.00'\nformatted: '+32-(0)22 000000'\n",
|
|
44257
44257
|
"core:mediaType": "application/yaml",
|
|
44258
44258
|
"sourcemaps:sources": [
|
|
44259
44259
|
{
|
|
@@ -44274,7 +44274,7 @@
|
|
|
44274
44274
|
"doc:ExternalDomainElement",
|
|
44275
44275
|
"doc:DomainElement"
|
|
44276
44276
|
],
|
|
44277
|
-
"doc:raw": "type:
|
|
44277
|
+
"doc:raw": "-\n type: 'GENERAL'\n value: 'info@company.be'\n-\n type: 'IT_DEPT'\n value: 'it-service@company.be'\n",
|
|
44278
44278
|
"core:mediaType": "application/yaml",
|
|
44279
44279
|
"sourcemaps:sources": [
|
|
44280
44280
|
{
|
|
@@ -44295,7 +44295,7 @@
|
|
|
44295
44295
|
"doc:ExternalDomainElement",
|
|
44296
44296
|
"doc:DomainElement"
|
|
44297
44297
|
],
|
|
44298
|
-
"doc:raw": "type:
|
|
44298
|
+
"doc:raw": "type: \"GENERAL\"\nvalue: \"www.company.be\"\n",
|
|
44299
44299
|
"core:mediaType": "application/yaml",
|
|
44300
44300
|
"sourcemaps:sources": [
|
|
44301
44301
|
{
|
|
@@ -44771,12 +44771,12 @@
|
|
|
44771
44771
|
{
|
|
44772
44772
|
"@id": "#202/source-map/lexical/element_0",
|
|
44773
44773
|
"sourcemaps:element": "amf://id#202",
|
|
44774
|
-
"sourcemaps:value": "[(1,0)-(
|
|
44774
|
+
"sourcemaps:value": "[(1,0)-(3,0)]"
|
|
44775
44775
|
},
|
|
44776
44776
|
{
|
|
44777
44777
|
"@id": "#205/source-map/lexical/element_0",
|
|
44778
44778
|
"sourcemaps:element": "amf://id#205",
|
|
44779
|
-
"sourcemaps:value": "[(1,0)-(
|
|
44779
|
+
"sourcemaps:value": "[(1,0)-(5,0)]"
|
|
44780
44780
|
},
|
|
44781
44781
|
{
|
|
44782
44782
|
"@id": "#208/source-map/lexical/element_0",
|
|
@@ -45121,17 +45121,17 @@
|
|
|
45121
45121
|
{
|
|
45122
45122
|
"@id": "#215/source-map/lexical/element_0",
|
|
45123
45123
|
"sourcemaps:element": "amf://id#215",
|
|
45124
|
-
"sourcemaps:value": "[(1,0)-(
|
|
45124
|
+
"sourcemaps:value": "[(1,0)-(6,0)]"
|
|
45125
45125
|
},
|
|
45126
45126
|
{
|
|
45127
45127
|
"@id": "#218/source-map/lexical/element_0",
|
|
45128
45128
|
"sourcemaps:element": "amf://id#218",
|
|
45129
|
-
"sourcemaps:value": "[(1,0)-(
|
|
45129
|
+
"sourcemaps:value": "[(1,0)-(7,0)]"
|
|
45130
45130
|
},
|
|
45131
45131
|
{
|
|
45132
45132
|
"@id": "#221/source-map/lexical/element_0",
|
|
45133
45133
|
"sourcemaps:element": "amf://id#221",
|
|
45134
|
-
"sourcemaps:value": "[(1,0)-(
|
|
45134
|
+
"sourcemaps:value": "[(1,0)-(3,0)]"
|
|
45135
45135
|
},
|
|
45136
45136
|
{
|
|
45137
45137
|
"@id": "#338/source-map/synthesized-field/element_1",
|
package/package.json
CHANGED
|
@@ -107,17 +107,9 @@ export class SchemaFilteringStrategy {
|
|
|
107
107
|
return true
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
//
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
schema.allOf?.length === 1 &&
|
|
114
|
-
typeof schema.allOf[0] === 'object' &&
|
|
115
|
-
'$ref' in schema.allOf[0] &&
|
|
116
|
-
!schema.properties &&
|
|
117
|
-
!schema.additionalProperties
|
|
118
|
-
) {
|
|
119
|
-
return true
|
|
120
|
-
}
|
|
110
|
+
// Note: We removed the check for single allOf with $ref as this represents
|
|
111
|
+
// valid schema inheritance/extension patterns (e.g., BlogPosting extending SocialMediaPosting)
|
|
112
|
+
// Such schemas should be included as they define meaningful type hierarchies
|
|
121
113
|
|
|
122
114
|
// Check for schemas that only have description and type but no structure
|
|
123
115
|
if (
|
|
@@ -36,14 +36,14 @@ test.group('SchemaFilteringStrategy', () => {
|
|
|
36
36
|
test('should identify conceptual marker schemas', ({ assert }) => {
|
|
37
37
|
const strategy = new SchemaFilteringStrategy({ excludeConceptualMarkers: true })
|
|
38
38
|
|
|
39
|
-
// StatusEnumeration-like schema
|
|
39
|
+
// StatusEnumeration-like schema (empty object, should be excluded)
|
|
40
40
|
const statusEnum: JSONSchema7 = {
|
|
41
41
|
type: 'object',
|
|
42
42
|
title: 'StatusEnumeration',
|
|
43
43
|
description: 'Lists or enumerations dealing with status types.',
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
// ActionStatusType-like schema (allOf with reference only)
|
|
46
|
+
// ActionStatusType-like schema (allOf with reference only - represents inheritance, should NOT be excluded)
|
|
47
47
|
const actionStatus: JSONSchema7 = {
|
|
48
48
|
type: 'object',
|
|
49
49
|
title: 'ActionStatusType',
|
|
@@ -61,10 +61,54 @@ test.group('SchemaFilteringStrategy', () => {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
assert.isTrue(strategy.shouldExcludeSchema(statusEnum))
|
|
64
|
-
assert.
|
|
64
|
+
assert.isFalse(strategy.shouldExcludeSchema(actionStatus)) // Changed: inheritance should not be excluded
|
|
65
65
|
assert.isFalse(strategy.shouldExcludeSchema(person))
|
|
66
66
|
})
|
|
67
67
|
|
|
68
|
+
test('should preserve schema inheritance patterns', ({ assert }) => {
|
|
69
|
+
const strategy = new SchemaFilteringStrategy({ excludeConceptualMarkers: true })
|
|
70
|
+
|
|
71
|
+
// BlogPosting schema - extends SocialMediaPosting via allOf
|
|
72
|
+
const blogPosting: JSONSchema7 = {
|
|
73
|
+
$schema: 'https://json-schema.org/draft/2020-12/schema',
|
|
74
|
+
$id: 'schema:BlogPosting',
|
|
75
|
+
title: 'BlogPosting',
|
|
76
|
+
description: 'A blog post.',
|
|
77
|
+
type: 'object',
|
|
78
|
+
allOf: [
|
|
79
|
+
{
|
|
80
|
+
description: 'A post to a social media platform, including blog posts, tweets, Facebook posts, etc.',
|
|
81
|
+
$ref: 'schema:SocialMediaPosting',
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// SocialMediaPosting schema - has properties and extends Article
|
|
87
|
+
const socialMediaPosting: JSONSchema7 = {
|
|
88
|
+
$schema: 'https://json-schema.org/draft/2020-12/schema',
|
|
89
|
+
$id: 'schema:SocialMediaPosting',
|
|
90
|
+
title: 'SocialMediaPosting',
|
|
91
|
+
description: 'A post to a social media platform, including blog posts, tweets, Facebook posts, etc.',
|
|
92
|
+
type: 'object',
|
|
93
|
+
allOf: [
|
|
94
|
+
{
|
|
95
|
+
description: 'An article, such as a news article or piece of investigative report.',
|
|
96
|
+
$ref: 'schema:Article',
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
properties: {
|
|
100
|
+
sharedContent: {
|
|
101
|
+
description: 'A CreativeWork such as an image, video, or audio clip shared as part of this posting.',
|
|
102
|
+
oneOf: [{ $ref: 'schema:CreativeWork' }, { type: 'array', items: { $ref: 'schema:CreativeWork' } }],
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Both schemas represent valid inheritance and should be included
|
|
108
|
+
assert.isFalse(strategy.shouldExcludeSchema(blogPosting, 'schema:BlogPosting'))
|
|
109
|
+
assert.isFalse(strategy.shouldExcludeSchema(socialMediaPosting, 'schema:SocialMediaPosting'))
|
|
110
|
+
})
|
|
111
|
+
|
|
68
112
|
test('should filter by patterns', ({ assert }) => {
|
|
69
113
|
const strategy = new SchemaFilteringStrategy({
|
|
70
114
|
excludePatterns: [/.*Enumeration$/, /.*Type$/],
|