@api-client/core 0.19.29 → 0.19.31
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/DomainAssociation.d.ts +4 -4
- package/build/src/modeling/DomainAssociation.d.ts.map +1 -1
- package/build/src/modeling/DomainAssociation.js.map +1 -1
- package/build/src/modeling/ai/domain_response_schema.d.ts +4 -2
- package/build/src/modeling/ai/domain_response_schema.d.ts.map +1 -1
- package/build/src/modeling/ai/domain_response_schema.js +1 -1
- package/build/src/modeling/ai/domain_response_schema.js.map +1 -1
- package/build/src/modeling/ai/types.d.ts +2 -3
- package/build/src/modeling/ai/types.d.ts.map +1 -1
- package/build/src/modeling/ai/types.js.map +1 -1
- package/build/src/modeling/amf/ShapeGenerator.js +1 -1
- package/build/src/modeling/amf/ShapeGenerator.js.map +1 -1
- package/build/src/modeling/generators/oas_312/OasGenerator.js +1 -1
- package/build/src/modeling/generators/oas_312/OasGenerator.js.map +1 -1
- package/build/src/modeling/generators/oas_312/OasSchemaGenerator.js +3 -3
- package/build/src/modeling/generators/oas_312/OasSchemaGenerator.js.map +1 -1
- package/build/src/modeling/generators/oas_320/OasSchemaGenerator.js +3 -3
- package/build/src/modeling/generators/oas_320/OasSchemaGenerator.js.map +1 -1
- package/build/src/modeling/types.d.ts +55 -0
- package/build/src/modeling/types.d.ts.map +1 -1
- package/build/src/modeling/types.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/skills-lock.json +10 -0
- package/src/modeling/DomainAssociation.ts +4 -4
- package/src/modeling/ai/domain_response_schema.ts +1 -1
- package/src/modeling/ai/types.ts +2 -3
- package/src/modeling/amf/ShapeGenerator.ts +1 -1
- package/src/modeling/generators/oas_312/OasGenerator.ts +1 -1
- package/src/modeling/generators/oas_312/OasSchemaGenerator.ts +3 -3
- package/src/modeling/generators/oas_320/OasSchemaGenerator.ts +3 -3
- package/src/modeling/types.ts +56 -0
- package/tests/unit/modeling/amf/shape_generator.spec.ts +32 -14
- package/tests/unit/modeling/data_domain_change_observers.spec.ts +1 -1
- package/tests/unit/modeling/domain_asociation.spec.ts +18 -18
- package/tests/unit/modeling/domain_entity_example_generator_json.spec.ts +68 -23
- package/tests/unit/modeling/domain_entity_example_generator_xml.spec.ts +32 -9
- package/tests/unit/modeling/generators/OasGenerator.spec.ts +2 -2
|
@@ -730,7 +730,7 @@ test.group('JSON DomainEntity Generator: associations', (group) => {
|
|
|
730
730
|
|
|
731
731
|
test('creates a property from an association', ({ assert }) => {
|
|
732
732
|
e2.addProperty({ type: 'number', key: 'n1', info: { name: 'n1' } })
|
|
733
|
-
e1.addAssociation({ targets: [{ key: e2.key }], key: 'a1', info: { name: 'a1' } })
|
|
733
|
+
e1.addAssociation({ targets: [{ key: e2.key }], key: 'a1', info: { name: 'a1' }, schema: { embedded: true } })
|
|
734
734
|
|
|
735
735
|
const result = e1.toExample(mime) as string
|
|
736
736
|
|
|
@@ -744,8 +744,8 @@ test.group('JSON DomainEntity Generator: associations', (group) => {
|
|
|
744
744
|
const e3 = d1.addEntity({ key: 'e3', info: { name: 'e3' } })
|
|
745
745
|
e3.addProperty({ type: 'number', key: 'i1', info: { name: 'i1' } })
|
|
746
746
|
e2.addProperty({ type: 'number', key: 'n1', info: { name: 'n1' } })
|
|
747
|
-
e1.addAssociation({ targets: [{ key: e2.key }], key: 'a1', info: { name: 'a1' } })
|
|
748
|
-
e2.addAssociation({ targets: [{ key: e3.key }], key: 'a2', info: { name: 'a2' } })
|
|
747
|
+
e1.addAssociation({ targets: [{ key: e2.key }], key: 'a1', info: { name: 'a1' }, schema: { embedded: true } })
|
|
748
|
+
e2.addAssociation({ targets: [{ key: e3.key }], key: 'a2', info: { name: 'a2' }, schema: { embedded: true } })
|
|
749
749
|
|
|
750
750
|
const result = e1.toExample(mime) as string
|
|
751
751
|
|
|
@@ -757,8 +757,8 @@ test.group('JSON DomainEntity Generator: associations', (group) => {
|
|
|
757
757
|
assert.typeOf(data.a1.a2.i1, 'number', 'has a deep association property')
|
|
758
758
|
})
|
|
759
759
|
|
|
760
|
-
test('does not make associations to self (recursive #1)', ({ assert }) => {
|
|
761
|
-
e1.addAssociation({ targets: [{ key: e1.key }],
|
|
760
|
+
test('does not make associations to self with embedded shape (recursive #1)', ({ assert }) => {
|
|
761
|
+
e1.addAssociation({ targets: [{ key: e1.key }], schema: { embedded: true } })
|
|
762
762
|
const result = e1.toExample(mime) as string
|
|
763
763
|
assert.equal(result, '{}')
|
|
764
764
|
})
|
|
@@ -767,9 +767,24 @@ test.group('JSON DomainEntity Generator: associations', (group) => {
|
|
|
767
767
|
const e3 = d1.addEntity({ key: 'e3', info: { name: 'e3' } })
|
|
768
768
|
e3.addProperty({ type: 'number', key: 'i1', info: { name: 'i1' } })
|
|
769
769
|
e2.addProperty({ type: 'number', key: 'n1', info: { name: 'n1' } })
|
|
770
|
-
e1.addAssociation({
|
|
771
|
-
|
|
772
|
-
|
|
770
|
+
e1.addAssociation({
|
|
771
|
+
targets: [{ key: e2.key }],
|
|
772
|
+
key: 'a1',
|
|
773
|
+
info: { name: 'a1' },
|
|
774
|
+
schema: { embedded: true },
|
|
775
|
+
})
|
|
776
|
+
e2.addAssociation({
|
|
777
|
+
targets: [{ key: e3.key }],
|
|
778
|
+
key: 'a2',
|
|
779
|
+
info: { name: 'a2' },
|
|
780
|
+
schema: { embedded: true },
|
|
781
|
+
})
|
|
782
|
+
e3.addAssociation({
|
|
783
|
+
targets: [{ key: e1.key }],
|
|
784
|
+
key: 'a3',
|
|
785
|
+
info: { name: 'a3' },
|
|
786
|
+
schema: { embedded: true },
|
|
787
|
+
})
|
|
773
788
|
|
|
774
789
|
const result = e1.toExample(mime) as string
|
|
775
790
|
|
|
@@ -786,7 +801,12 @@ test.group('JSON DomainEntity Generator: associations', (group) => {
|
|
|
786
801
|
const e3 = d1.addEntity({ key: 'e3', info: { name: 'e3' } })
|
|
787
802
|
e3.addProperty({ type: 'number', key: 'i1', info: { name: 'i1' } })
|
|
788
803
|
e2.addProperty({ type: 'string', key: 's1', info: { name: 's1' } })
|
|
789
|
-
const a1 = e1.addAssociation({
|
|
804
|
+
const a1 = e1.addAssociation({
|
|
805
|
+
targets: [{ key: e2.key }],
|
|
806
|
+
key: 'a1',
|
|
807
|
+
info: { name: 'a1' },
|
|
808
|
+
schema: { embedded: true },
|
|
809
|
+
})
|
|
790
810
|
a1.addTarget(e3.key)
|
|
791
811
|
|
|
792
812
|
const result = e1.toExample(mime) as string
|
|
@@ -801,9 +821,14 @@ test.group('JSON DomainEntity Generator: associations', (group) => {
|
|
|
801
821
|
const e3 = d1.addEntity({ key: 'e3', info: { name: 'e3' } })
|
|
802
822
|
e3.addProperty({ type: 'number', key: 'i1', info: { name: 'i1' } })
|
|
803
823
|
e2.addProperty({ type: 'string', key: 's1', info: { name: 's1' } })
|
|
804
|
-
const a1 = e1.addAssociation({
|
|
824
|
+
const a1 = e1.addAssociation({
|
|
825
|
+
targets: [{ key: e2.key }],
|
|
826
|
+
key: 'a1',
|
|
827
|
+
info: { name: 'a1' },
|
|
828
|
+
multiple: true,
|
|
829
|
+
schema: { embedded: true },
|
|
830
|
+
})
|
|
805
831
|
a1.addTarget(e3.key)
|
|
806
|
-
a1.multiple = true
|
|
807
832
|
|
|
808
833
|
const result = e1.toExample(mime) as string
|
|
809
834
|
|
|
@@ -821,9 +846,13 @@ test.group('JSON DomainEntity Generator: associations', (group) => {
|
|
|
821
846
|
e2.addProperty({ type: 'string', key: 's1', info: { name: 's1' } })
|
|
822
847
|
e3.addProperty({ type: 'number', key: 'i1', info: { name: 'i1' } })
|
|
823
848
|
|
|
824
|
-
const a1 = e1.addAssociation({
|
|
849
|
+
const a1 = e1.addAssociation({
|
|
850
|
+
targets: [{ key: e2.key }],
|
|
851
|
+
key: 'a1',
|
|
852
|
+
info: { name: 'a1' },
|
|
853
|
+
schema: { unionType: 'anyOf', embedded: true },
|
|
854
|
+
})
|
|
825
855
|
a1.addTarget(e3.key)
|
|
826
|
-
a1.schema = { unionType: 'anyOf' }
|
|
827
856
|
|
|
828
857
|
const result = e1.toExample(mime) as string
|
|
829
858
|
|
|
@@ -838,9 +867,13 @@ test.group('JSON DomainEntity Generator: associations', (group) => {
|
|
|
838
867
|
const e3 = d1.addEntity({ key: 'e3', info: { name: 'e3' } })
|
|
839
868
|
e3.addProperty({ type: 'number', key: 'i1', info: { name: 'i1' } })
|
|
840
869
|
e2.addProperty({ type: 'string', key: 's1', info: { name: 's1' } })
|
|
841
|
-
const a1 = e1.addAssociation({
|
|
870
|
+
const a1 = e1.addAssociation({
|
|
871
|
+
targets: [{ key: e2.key }],
|
|
872
|
+
key: 'a1',
|
|
873
|
+
info: { name: 'a1' },
|
|
874
|
+
schema: { embedded: true, unionType: 'allOf' },
|
|
875
|
+
})
|
|
842
876
|
a1.addTarget(e3.key)
|
|
843
|
-
a1.schema = { unionType: 'allOf' }
|
|
844
877
|
|
|
845
878
|
const result = e1.toExample(mime) as string
|
|
846
879
|
|
|
@@ -857,11 +890,14 @@ test.group('JSON DomainEntity Generator: associations', (group) => {
|
|
|
857
890
|
e2.addProperty({ type: 'string', key: 's1', info: { name: 's1' } })
|
|
858
891
|
e3.addProperty({ type: 'number', key: 'i1', info: { name: 'i1' } })
|
|
859
892
|
|
|
860
|
-
const a1 = e1.addAssociation({
|
|
893
|
+
const a1 = e1.addAssociation({
|
|
894
|
+
targets: [{ key: e2.key }],
|
|
895
|
+
key: 'a1',
|
|
896
|
+
info: { name: 'a1' },
|
|
897
|
+
schema: { embedded: true, unionType: 'oneOf' },
|
|
898
|
+
})
|
|
861
899
|
a1.addTarget(e3.key)
|
|
862
900
|
|
|
863
|
-
a1.schema = { unionType: 'oneOf' }
|
|
864
|
-
|
|
865
901
|
const result = e1.toExample(mime) as string
|
|
866
902
|
|
|
867
903
|
assert.typeOf(result, 'string', 'result is a string')
|
|
@@ -877,9 +913,13 @@ test.group('JSON DomainEntity Generator: associations', (group) => {
|
|
|
877
913
|
e2.addProperty({ type: 'string', key: 's1', info: { name: 's1' } })
|
|
878
914
|
e3.addProperty({ type: 'number', key: 'i1', info: { name: 'i1' } })
|
|
879
915
|
|
|
880
|
-
const a1 = e1.addAssociation({
|
|
916
|
+
const a1 = e1.addAssociation({
|
|
917
|
+
targets: [{ key: e2.key }],
|
|
918
|
+
key: 'a1',
|
|
919
|
+
info: { name: 'a1' },
|
|
920
|
+
schema: { unionType: 'oneOf', embedded: true },
|
|
921
|
+
})
|
|
881
922
|
a1.addTarget(e3.key)
|
|
882
|
-
a1.schema = { unionType: 'oneOf' }
|
|
883
923
|
|
|
884
924
|
const result = e1.toExample(mime) as string
|
|
885
925
|
|
|
@@ -897,7 +937,12 @@ test.group('JSON DomainEntity Generator: associations', (group) => {
|
|
|
897
937
|
e3.addProperty({ type: 'number', key: 'n1', info: { name: 'n1' } })
|
|
898
938
|
n2.info.version = '1.0.0'
|
|
899
939
|
n1.registerForeignDomain(n2)
|
|
900
|
-
e1.addAssociation({
|
|
940
|
+
e1.addAssociation({
|
|
941
|
+
targets: [{ key: e3.key, domain: n2.key }],
|
|
942
|
+
key: 'a3',
|
|
943
|
+
info: { name: 'a3' },
|
|
944
|
+
schema: { embedded: true },
|
|
945
|
+
})
|
|
901
946
|
const result = e1.toExample(mime) as string
|
|
902
947
|
assert.typeOf(result, 'string', 'result is a string')
|
|
903
948
|
const data = JSON.parse(result)
|
|
@@ -945,7 +990,7 @@ test.group('JSON DomainEntity Generator: parents', (group) => {
|
|
|
945
990
|
e2.addParent(e1.key)
|
|
946
991
|
const e3 = d1.addEntity({ key: 'e3', info: { name: 'e3' } })
|
|
947
992
|
e3.addProperty({ type: 'string', key: 'p3', info: { name: 'p3' } })
|
|
948
|
-
e2.addAssociation({ targets: [{ key: e3.key }], key: 'a1', info: { name: 'a1' } })
|
|
993
|
+
e2.addAssociation({ targets: [{ key: e3.key }], key: 'a1', info: { name: 'a1' }, schema: { embedded: true } })
|
|
949
994
|
|
|
950
995
|
const result = e2.toExample(mime) as string
|
|
951
996
|
|
|
@@ -963,7 +1008,7 @@ test.group('JSON DomainEntity Generator: parents', (group) => {
|
|
|
963
1008
|
e2.addParent(e1.key)
|
|
964
1009
|
const e3 = d1.addEntity({ key: 'e3', info: { name: 'e3' } })
|
|
965
1010
|
e3.addProperty({ type: 'string', key: 'p3', info: { name: 'p3' } })
|
|
966
|
-
e1.addAssociation({ targets: [{ key: e3.key }], key: 'a1', info: { name: 'a1' } })
|
|
1011
|
+
e1.addAssociation({ targets: [{ key: e3.key }], key: 'a1', info: { name: 'a1' }, schema: { embedded: true } })
|
|
967
1012
|
|
|
968
1013
|
const result = e2.toExample(mime) as string
|
|
969
1014
|
|
|
@@ -1108,7 +1108,12 @@ test.group('XML DomainEntity Generator: associations', (group) => {
|
|
|
1108
1108
|
|
|
1109
1109
|
test('creates a property from an association', ({ assert }) => {
|
|
1110
1110
|
e2.addProperty({ type: 'number', key: 'n1', info: { name: 'n1' } })
|
|
1111
|
-
e1.addAssociation({
|
|
1111
|
+
e1.addAssociation({
|
|
1112
|
+
targets: [{ key: e2.key }],
|
|
1113
|
+
key: 'a1',
|
|
1114
|
+
info: { name: 'a1' },
|
|
1115
|
+
schema: { embedded: true },
|
|
1116
|
+
})
|
|
1112
1117
|
|
|
1113
1118
|
const result = e1.toExample(mime) as string
|
|
1114
1119
|
|
|
@@ -1131,8 +1136,18 @@ test.group('XML DomainEntity Generator: associations', (group) => {
|
|
|
1131
1136
|
const e3 = d1.addEntity({ key: 'e3', info: { name: 'e3' } })
|
|
1132
1137
|
e3.addProperty({ type: 'number', key: 'i1', info: { name: 'i1' } })
|
|
1133
1138
|
e2.addProperty({ type: 'number', key: 'n1', info: { name: 'n1' } })
|
|
1134
|
-
e1.addAssociation({
|
|
1135
|
-
|
|
1139
|
+
e1.addAssociation({
|
|
1140
|
+
targets: [{ key: e2.key }],
|
|
1141
|
+
key: 'a1',
|
|
1142
|
+
info: { name: 'a1' },
|
|
1143
|
+
schema: { embedded: true },
|
|
1144
|
+
})
|
|
1145
|
+
e2.addAssociation({
|
|
1146
|
+
targets: [{ key: e3.key }],
|
|
1147
|
+
key: 'a2',
|
|
1148
|
+
info: { name: 'a2' },
|
|
1149
|
+
schema: { embedded: true },
|
|
1150
|
+
})
|
|
1136
1151
|
|
|
1137
1152
|
const result = e1.toExample(mime) as string
|
|
1138
1153
|
|
|
@@ -1192,7 +1207,12 @@ test.group('XML DomainEntity Generator: associations', (group) => {
|
|
|
1192
1207
|
const e3 = d1.addEntity({ key: 'e3', info: { name: 'e3' } })
|
|
1193
1208
|
e3.addProperty({ type: 'number', key: 'i1', info: { name: 'i1' } })
|
|
1194
1209
|
e2.addProperty({ type: 'string', key: 's1', info: { name: 's1' } })
|
|
1195
|
-
const a1 = e1.addAssociation({
|
|
1210
|
+
const a1 = e1.addAssociation({
|
|
1211
|
+
targets: [{ key: e2.key }],
|
|
1212
|
+
key: 'a1',
|
|
1213
|
+
info: { name: 'a1' },
|
|
1214
|
+
schema: { embedded: true },
|
|
1215
|
+
})
|
|
1196
1216
|
a1.addTarget(e3.key)
|
|
1197
1217
|
|
|
1198
1218
|
const result = e1.toExample(mime) as string
|
|
@@ -1233,11 +1253,14 @@ test.group('XML DomainEntity Generator: associations', (group) => {
|
|
|
1233
1253
|
e2.addProperty({ type: 'string', key: 's1', info: { name: 's1' } })
|
|
1234
1254
|
e3.addProperty({ type: 'number', key: 'i1', info: { name: 'i1' } })
|
|
1235
1255
|
|
|
1236
|
-
const a1 = e1.addAssociation({
|
|
1256
|
+
const a1 = e1.addAssociation({
|
|
1257
|
+
targets: [{ key: e2.key }],
|
|
1258
|
+
key: 'a1',
|
|
1259
|
+
info: { name: 'a1' },
|
|
1260
|
+
schema: { embedded: true, unionType: 'anyOf' },
|
|
1261
|
+
})
|
|
1237
1262
|
a1.addTarget(e3.key)
|
|
1238
1263
|
|
|
1239
|
-
a1.schema = { unionType: 'anyOf' }
|
|
1240
|
-
|
|
1241
1264
|
const result = e1.toExample(mime) as string
|
|
1242
1265
|
assert.typeOf(result, 'string', 'result is a string')
|
|
1243
1266
|
|
|
@@ -1374,7 +1397,7 @@ test.group('XML DomainEntity Generator: parents', (group) => {
|
|
|
1374
1397
|
e2.addParent(e1.key)
|
|
1375
1398
|
const e3 = d1.addEntity({ key: 'e3', info: { name: 'e3' } })
|
|
1376
1399
|
e3.addProperty({ type: 'string', key: 'p3', info: { name: 'p3' } })
|
|
1377
|
-
e2.addAssociation({ targets: [{ key: e3.key }], key: 'a1', info: { name: 'a1' } })
|
|
1400
|
+
e2.addAssociation({ targets: [{ key: e3.key }], key: 'a1', info: { name: 'a1' }, schema: { embedded: true } })
|
|
1378
1401
|
|
|
1379
1402
|
const result = e2.toExample(mime) as string
|
|
1380
1403
|
assert.typeOf(result, 'string', 'result is a string')
|
|
@@ -1406,7 +1429,7 @@ test.group('XML DomainEntity Generator: parents', (group) => {
|
|
|
1406
1429
|
e2.addParent(e1.key)
|
|
1407
1430
|
const e3 = d1.addEntity({ key: 'e3', info: { name: 'e3' } })
|
|
1408
1431
|
e3.addProperty({ type: 'string', key: 'p3', info: { name: 'p3' } })
|
|
1409
|
-
e1.addAssociation({ targets: [{ key: e3.key }], key: 'a1', info: { name: 'a1' } })
|
|
1432
|
+
e1.addAssociation({ targets: [{ key: e3.key }], key: 'a1', info: { name: 'a1' }, schema: { embedded: true } })
|
|
1410
1433
|
|
|
1411
1434
|
const result = e2.toExample(mime) as string
|
|
1412
1435
|
assert.typeOf(result, 'string', 'result is a string')
|
|
@@ -113,7 +113,7 @@ test.group('OasGenerator', (group) => {
|
|
|
113
113
|
info: { name: 'author' },
|
|
114
114
|
targets: [{ key: user.key }],
|
|
115
115
|
multiple: false,
|
|
116
|
-
schema: {
|
|
116
|
+
schema: { embedded: false },
|
|
117
117
|
semantics: [{ id: SemanticType.ResourceOwnerIdentifier }],
|
|
118
118
|
})
|
|
119
119
|
|
|
@@ -127,7 +127,7 @@ test.group('OasGenerator', (group) => {
|
|
|
127
127
|
name: 'API Admin',
|
|
128
128
|
url: 'https://api.com',
|
|
129
129
|
}
|
|
130
|
-
api.accessRule = [new AllowAuthenticatedAccessRule()]
|
|
130
|
+
api.accessRule = [new AllowAuthenticatedAccessRule(api)]
|
|
131
131
|
api.session = {
|
|
132
132
|
properties: [email.key],
|
|
133
133
|
secret: 'test-secret',
|