@scalar/json-magic 0.4.3 → 0.5.1

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.
Files changed (111) hide show
  1. package/.turbo/turbo-build.log +4 -4
  2. package/CHANGELOG.md +16 -0
  3. package/dist/bundle/bundle.d.ts +37 -10
  4. package/dist/bundle/bundle.d.ts.map +1 -1
  5. package/dist/bundle/bundle.js +40 -30
  6. package/dist/bundle/bundle.js.map +2 -2
  7. package/dist/bundle/index.d.ts +2 -2
  8. package/dist/bundle/index.d.ts.map +1 -1
  9. package/dist/bundle/index.js +3 -2
  10. package/dist/bundle/index.js.map +2 -2
  11. package/dist/bundle/plugins/fetch-urls/index.d.ts.map +1 -1
  12. package/dist/bundle/plugins/fetch-urls/index.js +2 -2
  13. package/dist/bundle/plugins/fetch-urls/index.js.map +2 -2
  14. package/dist/bundle/plugins/parse-json/index.d.ts.map +1 -1
  15. package/dist/bundle/plugins/parse-json/index.js +1 -1
  16. package/dist/bundle/plugins/parse-json/index.js.map +2 -2
  17. package/dist/bundle/plugins/parse-yaml/index.d.ts.map +1 -1
  18. package/dist/bundle/plugins/parse-yaml/index.js +1 -1
  19. package/dist/bundle/plugins/parse-yaml/index.js.map +2 -2
  20. package/dist/bundle/plugins/read-files/index.d.ts.map +1 -1
  21. package/dist/bundle/plugins/read-files/index.js +1 -1
  22. package/dist/bundle/plugins/read-files/index.js.map +2 -2
  23. package/dist/helpers/convert-to-local-ref.d.ts +10 -0
  24. package/dist/helpers/convert-to-local-ref.d.ts.map +1 -0
  25. package/dist/helpers/convert-to-local-ref.js +26 -0
  26. package/dist/helpers/convert-to-local-ref.js.map +7 -0
  27. package/dist/helpers/escape-json-pointer.d.ts.map +1 -0
  28. package/dist/{utils → helpers}/escape-json-pointer.js.map +1 -1
  29. package/dist/helpers/get-schemas.d.ts +21 -0
  30. package/dist/helpers/get-schemas.d.ts.map +1 -0
  31. package/dist/helpers/get-schemas.js +37 -0
  32. package/dist/helpers/get-schemas.js.map +7 -0
  33. package/dist/helpers/get-segments-from-path.d.ts.map +1 -0
  34. package/dist/{utils → helpers}/get-segments-from-path.js.map +1 -1
  35. package/dist/helpers/get-value-by-path.d.ts +24 -0
  36. package/dist/helpers/get-value-by-path.d.ts.map +1 -0
  37. package/dist/helpers/get-value-by-path.js +23 -0
  38. package/dist/helpers/get-value-by-path.js.map +7 -0
  39. package/dist/helpers/is-json-object.d.ts.map +1 -0
  40. package/dist/{utils → helpers}/is-json-object.js +1 -1
  41. package/dist/helpers/is-json-object.js.map +7 -0
  42. package/dist/helpers/is-object.d.ts.map +1 -0
  43. package/dist/{utils → helpers}/is-object.js.map +1 -1
  44. package/dist/helpers/is-yaml.d.ts.map +1 -0
  45. package/dist/{utils → helpers}/is-yaml.js.map +1 -1
  46. package/dist/{utils → helpers}/json-path-utils.d.ts +0 -11
  47. package/dist/helpers/json-path-utils.d.ts.map +1 -0
  48. package/dist/{utils → helpers}/json-path-utils.js +0 -9
  49. package/dist/helpers/json-path-utils.js.map +7 -0
  50. package/dist/helpers/normalize.d.ts.map +1 -0
  51. package/dist/{utils → helpers}/normalize.js.map +1 -1
  52. package/dist/helpers/unescape-json-pointer.d.ts.map +1 -0
  53. package/dist/{utils → helpers}/unescape-json-pointer.js.map +1 -1
  54. package/dist/magic-proxy/proxy.d.ts +35 -10
  55. package/dist/magic-proxy/proxy.d.ts.map +1 -1
  56. package/dist/magic-proxy/proxy.js +40 -20
  57. package/dist/magic-proxy/proxy.js.map +2 -2
  58. package/esbuild.ts +1 -0
  59. package/package.json +6 -1
  60. package/src/bundle/bundle.test.ts +533 -25
  61. package/src/bundle/bundle.ts +53 -37
  62. package/src/bundle/index.ts +3 -3
  63. package/src/bundle/plugins/fetch-urls/index.ts +2 -2
  64. package/src/bundle/plugins/parse-json/index.ts +1 -1
  65. package/src/bundle/plugins/parse-yaml/index.ts +3 -2
  66. package/src/bundle/plugins/read-files/index.ts +1 -1
  67. package/src/helpers/convert-to-local-ref.test.ts +211 -0
  68. package/src/helpers/convert-to-local-ref.ts +43 -0
  69. package/src/helpers/get-schemas.test.ts +356 -0
  70. package/src/helpers/get-schemas.ts +80 -0
  71. package/src/helpers/get-value-by-path.test.ts +338 -0
  72. package/src/helpers/get-value-by-path.ts +44 -0
  73. package/src/{utils → helpers}/is-json-object.ts +1 -1
  74. package/src/{utils → helpers}/json-path-utils.ts +0 -19
  75. package/src/{utils → helpers}/normalize.test.ts +2 -1
  76. package/src/magic-proxy/proxy.test.ts +548 -0
  77. package/src/magic-proxy/proxy.ts +80 -31
  78. package/dist/utils/escape-json-pointer.d.ts.map +0 -1
  79. package/dist/utils/get-segments-from-path.d.ts.map +0 -1
  80. package/dist/utils/is-json-object.d.ts.map +0 -1
  81. package/dist/utils/is-json-object.js.map +0 -7
  82. package/dist/utils/is-object.d.ts.map +0 -1
  83. package/dist/utils/is-yaml.d.ts.map +0 -1
  84. package/dist/utils/json-path-utils.d.ts.map +0 -1
  85. package/dist/utils/json-path-utils.js.map +0 -7
  86. package/dist/utils/normalize.d.ts.map +0 -1
  87. package/dist/utils/unescape-json-pointer.d.ts.map +0 -1
  88. /package/dist/{utils → helpers}/escape-json-pointer.d.ts +0 -0
  89. /package/dist/{utils → helpers}/escape-json-pointer.js +0 -0
  90. /package/dist/{utils → helpers}/get-segments-from-path.d.ts +0 -0
  91. /package/dist/{utils → helpers}/get-segments-from-path.js +0 -0
  92. /package/dist/{utils → helpers}/is-json-object.d.ts +0 -0
  93. /package/dist/{utils → helpers}/is-object.d.ts +0 -0
  94. /package/dist/{utils → helpers}/is-object.js +0 -0
  95. /package/dist/{utils → helpers}/is-yaml.d.ts +0 -0
  96. /package/dist/{utils → helpers}/is-yaml.js +0 -0
  97. /package/dist/{utils → helpers}/normalize.d.ts +0 -0
  98. /package/dist/{utils → helpers}/normalize.js +0 -0
  99. /package/dist/{utils → helpers}/unescape-json-pointer.d.ts +0 -0
  100. /package/dist/{utils → helpers}/unescape-json-pointer.js +0 -0
  101. /package/src/{utils → helpers}/escape-json-pointer.test.ts +0 -0
  102. /package/src/{utils → helpers}/escape-json-pointer.ts +0 -0
  103. /package/src/{utils → helpers}/get-segments-from-path.test.ts +0 -0
  104. /package/src/{utils → helpers}/get-segments-from-path.ts +0 -0
  105. /package/src/{utils → helpers}/is-object.test.ts +0 -0
  106. /package/src/{utils → helpers}/is-object.ts +0 -0
  107. /package/src/{utils → helpers}/is-yaml.ts +0 -0
  108. /package/src/{utils → helpers}/json-path-utils.test.ts +0 -0
  109. /package/src/{utils → helpers}/normalize.ts +0 -0
  110. /package/src/{utils → helpers}/unescape-json-pointer.test.ts +0 -0
  111. /package/src/{utils → helpers}/unescape-json-pointer.ts +0 -0
@@ -1282,6 +1282,554 @@ describe('createMagicProxy', () => {
1282
1282
  })
1283
1283
  })
1284
1284
 
1285
+ describe('$id and $anchor reference resolution', () => {
1286
+ it('resolves references to schemas with $id property', () => {
1287
+ const input = {
1288
+ $id: 'https://example.com/schema',
1289
+ definitions: {
1290
+ user: {
1291
+ $id: 'https://example.com/user',
1292
+ type: 'object',
1293
+ properties: {
1294
+ name: { type: 'string' },
1295
+ age: { type: 'number' },
1296
+ },
1297
+ },
1298
+ },
1299
+ userRef: {
1300
+ $ref: 'https://example.com/user',
1301
+ },
1302
+ }
1303
+
1304
+ const result = createMagicProxy(input)
1305
+
1306
+ expect(result.userRef['$ref-value']).toEqual({
1307
+ $id: 'https://example.com/user',
1308
+ type: 'object',
1309
+ properties: {
1310
+ name: { type: 'string' },
1311
+ age: { type: 'number' },
1312
+ },
1313
+ })
1314
+ })
1315
+
1316
+ it('resolves references to schemas with $anchor property', () => {
1317
+ const input = {
1318
+ $id: 'https://example.com/schema',
1319
+ definitions: {
1320
+ user: {
1321
+ $anchor: 'user-schema',
1322
+ type: 'object',
1323
+ properties: {
1324
+ name: { type: 'string' },
1325
+ email: { type: 'string' },
1326
+ },
1327
+ },
1328
+ },
1329
+ userRef: {
1330
+ $ref: 'https://example.com/schema#user-schema',
1331
+ },
1332
+ }
1333
+
1334
+ const result = createMagicProxy(input)
1335
+
1336
+ expect(result.userRef['$ref-value']).toEqual({
1337
+ $anchor: 'user-schema',
1338
+ type: 'object',
1339
+ properties: {
1340
+ name: { type: 'string' },
1341
+ email: { type: 'string' },
1342
+ },
1343
+ })
1344
+ })
1345
+
1346
+ it('resolves references to schemas with both $id and $anchor properties', () => {
1347
+ const input = {
1348
+ $id: 'https://example.com/root',
1349
+ definitions: {
1350
+ user: {
1351
+ $id: 'https://example.com/user',
1352
+ $anchor: 'user-schema',
1353
+ type: 'object',
1354
+ properties: {
1355
+ id: { type: 'string' },
1356
+ profile: { type: 'object' },
1357
+ },
1358
+ },
1359
+ },
1360
+ userByIdRef: {
1361
+ $ref: 'https://example.com/user',
1362
+ },
1363
+ userByAnchorRef: {
1364
+ $ref: 'https://example.com/user#user-schema',
1365
+ },
1366
+ }
1367
+
1368
+ const result = createMagicProxy(input)
1369
+
1370
+ const expectedUser = {
1371
+ $id: 'https://example.com/user',
1372
+ $anchor: 'user-schema',
1373
+ type: 'object',
1374
+ properties: {
1375
+ id: { type: 'string' },
1376
+ profile: { type: 'object' },
1377
+ },
1378
+ }
1379
+
1380
+ expect(result.userByIdRef['$ref-value']).toEqual(expectedUser)
1381
+ expect(result.userByAnchorRef['$ref-value']).toEqual(expectedUser)
1382
+ })
1383
+
1384
+ it('resolves nested references with $id and $anchor', () => {
1385
+ const input = {
1386
+ $id: 'https://example.com/api',
1387
+ components: {
1388
+ schemas: {
1389
+ user: {
1390
+ $id: 'https://example.com/user',
1391
+ $anchor: 'user-schema',
1392
+ type: 'object',
1393
+ properties: {
1394
+ profile: {
1395
+ $anchor: 'profile-schema',
1396
+ type: 'object',
1397
+ properties: {
1398
+ name: { type: 'string' },
1399
+ },
1400
+ },
1401
+ },
1402
+ },
1403
+ },
1404
+ },
1405
+ userRef: {
1406
+ $ref: 'https://example.com/user',
1407
+ },
1408
+ profileRef: {
1409
+ $ref: 'https://example.com/user#profile-schema',
1410
+ },
1411
+ }
1412
+
1413
+ const result = createMagicProxy(input)
1414
+
1415
+ expect(result.userRef['$ref-value']).toEqual({
1416
+ $id: 'https://example.com/user',
1417
+ $anchor: 'user-schema',
1418
+ type: 'object',
1419
+ properties: {
1420
+ profile: {
1421
+ $anchor: 'profile-schema',
1422
+ type: 'object',
1423
+ properties: {
1424
+ name: { type: 'string' },
1425
+ },
1426
+ },
1427
+ },
1428
+ })
1429
+
1430
+ expect(result.profileRef['$ref-value']).toEqual({
1431
+ $anchor: 'profile-schema',
1432
+ type: 'object',
1433
+ properties: {
1434
+ name: { type: 'string' },
1435
+ },
1436
+ })
1437
+ })
1438
+
1439
+ it('resolves references with path fragments after $id', () => {
1440
+ const input = {
1441
+ $id: 'https://example.com/schema',
1442
+ definitions: {
1443
+ user: {
1444
+ $id: 'https://example.com/user',
1445
+ type: 'object',
1446
+ properties: {
1447
+ name: { type: 'string' },
1448
+ address: {
1449
+ type: 'object',
1450
+ properties: {
1451
+ street: { type: 'string' },
1452
+ },
1453
+ },
1454
+ },
1455
+ },
1456
+ },
1457
+ addressRef: {
1458
+ $ref: 'https://example.com/user#/properties/address',
1459
+ },
1460
+ }
1461
+
1462
+ const result = createMagicProxy(input)
1463
+
1464
+ expect(result.addressRef['$ref-value']).toEqual({
1465
+ type: 'object',
1466
+ properties: {
1467
+ street: { type: 'string' },
1468
+ },
1469
+ })
1470
+ })
1471
+
1472
+ it('handles multiple schemas with different $id values', () => {
1473
+ const input = {
1474
+ $id: 'https://example.com/root',
1475
+ schemas: {
1476
+ user: {
1477
+ $id: 'https://example.com/user',
1478
+ type: 'object',
1479
+ properties: {
1480
+ name: { type: 'string' },
1481
+ },
1482
+ },
1483
+ product: {
1484
+ $id: 'https://example.com/product',
1485
+ type: 'object',
1486
+ properties: {
1487
+ title: { type: 'string' },
1488
+ },
1489
+ },
1490
+ },
1491
+ userRef: {
1492
+ $ref: 'https://example.com/user',
1493
+ },
1494
+ productRef: {
1495
+ $ref: 'https://example.com/product',
1496
+ },
1497
+ }
1498
+
1499
+ const result = createMagicProxy(input)
1500
+
1501
+ expect(result.userRef['$ref-value']).toEqual({
1502
+ $id: 'https://example.com/user',
1503
+ type: 'object',
1504
+ properties: {
1505
+ name: { type: 'string' },
1506
+ },
1507
+ })
1508
+
1509
+ expect(result.productRef['$ref-value']).toEqual({
1510
+ $id: 'https://example.com/product',
1511
+ type: 'object',
1512
+ properties: {
1513
+ title: { type: 'string' },
1514
+ },
1515
+ })
1516
+ })
1517
+
1518
+ it('handles multiple schemas with different $anchor values', () => {
1519
+ const input = {
1520
+ $id: 'https://example.com/schema',
1521
+ definitions: {
1522
+ user: {
1523
+ $anchor: 'user',
1524
+ type: 'object',
1525
+ properties: {
1526
+ name: { type: 'string' },
1527
+ },
1528
+ },
1529
+ admin: {
1530
+ $anchor: 'admin',
1531
+ type: 'object',
1532
+ properties: {
1533
+ permissions: { type: 'array' },
1534
+ },
1535
+ },
1536
+ },
1537
+ userRef: {
1538
+ $ref: 'https://example.com/schema#user',
1539
+ },
1540
+ adminRef: {
1541
+ $ref: 'https://example.com/schema#admin',
1542
+ },
1543
+ }
1544
+
1545
+ const result = createMagicProxy(input)
1546
+
1547
+ expect(result.userRef['$ref-value']).toEqual({
1548
+ $anchor: 'user',
1549
+ type: 'object',
1550
+ properties: {
1551
+ name: { type: 'string' },
1552
+ },
1553
+ })
1554
+
1555
+ expect(result.adminRef['$ref-value']).toEqual({
1556
+ $anchor: 'admin',
1557
+ type: 'object',
1558
+ properties: {
1559
+ permissions: { type: 'array' },
1560
+ },
1561
+ })
1562
+ })
1563
+
1564
+ it('handles external references to $id schemas', () => {
1565
+ const input = {
1566
+ $id: 'https://example.com/schema',
1567
+ definitions: {
1568
+ external: {
1569
+ $id: 'https://external.com/schema',
1570
+ type: 'object',
1571
+ properties: {
1572
+ externalProp: { type: 'string' },
1573
+ },
1574
+ },
1575
+ },
1576
+ externalRef: {
1577
+ $ref: 'https://external.com/schema',
1578
+ },
1579
+ }
1580
+
1581
+ const result = createMagicProxy(input)
1582
+
1583
+ expect(result.externalRef['$ref-value']).toEqual({
1584
+ $id: 'https://external.com/schema',
1585
+ type: 'object',
1586
+ properties: {
1587
+ externalProp: { type: 'string' },
1588
+ },
1589
+ })
1590
+ })
1591
+
1592
+ it('handles references in arrays with $id and $anchor', () => {
1593
+ const input = {
1594
+ $id: 'https://example.com/schema',
1595
+ definitions: {
1596
+ item: {
1597
+ $anchor: 'item-schema',
1598
+ type: 'object',
1599
+ properties: {
1600
+ id: { type: 'string' },
1601
+ },
1602
+ },
1603
+ },
1604
+ items: [{ $ref: 'https://example.com/schema#item-schema' }, { $ref: 'https://example.com/schema#item-schema' }],
1605
+ }
1606
+
1607
+ const result = createMagicProxy(input)
1608
+
1609
+ expect(result.items[0]['$ref-value']).toEqual({
1610
+ $anchor: 'item-schema',
1611
+ type: 'object',
1612
+ properties: {
1613
+ id: { type: 'string' },
1614
+ },
1615
+ })
1616
+
1617
+ expect(result.items[1]['$ref-value']).toEqual({
1618
+ $anchor: 'item-schema',
1619
+ type: 'object',
1620
+ properties: {
1621
+ id: { type: 'string' },
1622
+ },
1623
+ })
1624
+ })
1625
+
1626
+ it('preserves $ref information when resolving $id references', () => {
1627
+ const input = {
1628
+ $id: 'https://example.com/schema',
1629
+ definitions: {
1630
+ user: {
1631
+ $id: 'https://example.com/user',
1632
+ type: 'object',
1633
+ properties: {
1634
+ name: { type: 'string' },
1635
+ },
1636
+ },
1637
+ },
1638
+ userRef: {
1639
+ $ref: 'https://example.com/user',
1640
+ },
1641
+ }
1642
+
1643
+ const result = createMagicProxy(input)
1644
+
1645
+ expect(result.userRef).toEqual({
1646
+ $ref: 'https://example.com/user',
1647
+ '$ref-value': {
1648
+ $id: 'https://example.com/user',
1649
+ type: 'object',
1650
+ properties: {
1651
+ name: { type: 'string' },
1652
+ },
1653
+ },
1654
+ })
1655
+ })
1656
+
1657
+ it('preserves $ref information when resolving $anchor references', () => {
1658
+ const input = {
1659
+ $id: 'https://example.com/schema',
1660
+ definitions: {
1661
+ user: {
1662
+ $anchor: 'user-schema',
1663
+ type: 'object',
1664
+ properties: {
1665
+ email: { type: 'string' },
1666
+ },
1667
+ },
1668
+ },
1669
+ userRef: {
1670
+ $ref: 'https://example.com/schema#user-schema',
1671
+ },
1672
+ }
1673
+
1674
+ const result = createMagicProxy(input)
1675
+
1676
+ expect(result.userRef).toEqual({
1677
+ $ref: 'https://example.com/schema#user-schema',
1678
+ '$ref-value': {
1679
+ $anchor: 'user-schema',
1680
+ type: 'object',
1681
+ properties: {
1682
+ email: { type: 'string' },
1683
+ },
1684
+ },
1685
+ })
1686
+ })
1687
+
1688
+ it('handles deeply nested $id and $anchor references', () => {
1689
+ const input = {
1690
+ $id: 'https://example.com/root',
1691
+ api: {
1692
+ $id: 'https://example.com/api',
1693
+ v1: {
1694
+ schemas: {
1695
+ user: {
1696
+ $id: 'https://example.com/user',
1697
+ $anchor: 'user-schema',
1698
+ type: 'object',
1699
+ properties: {
1700
+ profile: {
1701
+ $anchor: 'profile-schema',
1702
+ type: 'object',
1703
+ properties: {
1704
+ name: { type: 'string' },
1705
+ },
1706
+ },
1707
+ },
1708
+ },
1709
+ },
1710
+ },
1711
+ },
1712
+ userRef: {
1713
+ $ref: 'https://example.com/user',
1714
+ },
1715
+ profileRef: {
1716
+ $ref: 'https://example.com/user#profile-schema',
1717
+ },
1718
+ }
1719
+
1720
+ const result = createMagicProxy(input)
1721
+
1722
+ expect(result.userRef['$ref-value']).toEqual({
1723
+ $id: 'https://example.com/user',
1724
+ $anchor: 'user-schema',
1725
+ type: 'object',
1726
+ properties: {
1727
+ profile: {
1728
+ $anchor: 'profile-schema',
1729
+ type: 'object',
1730
+ properties: {
1731
+ name: { type: 'string' },
1732
+ },
1733
+ },
1734
+ },
1735
+ })
1736
+
1737
+ expect(result.profileRef['$ref-value']).toEqual({
1738
+ $anchor: 'profile-schema',
1739
+ type: 'object',
1740
+ properties: {
1741
+ name: { type: 'string' },
1742
+ },
1743
+ })
1744
+ })
1745
+ })
1746
+
1747
+ describe('setting on $id and $anchor properties', () => {
1748
+ it('should allow writing on an $id property', () => {
1749
+ const input = {
1750
+ $id: 'https://example.com/schema',
1751
+ definitions: {
1752
+ user: {
1753
+ $id: 'https://example.com/user',
1754
+ type: 'object',
1755
+ properties: {
1756
+ name: { type: 'string' },
1757
+ },
1758
+ },
1759
+ },
1760
+ a: {
1761
+ $ref: 'https://example.com/user',
1762
+ },
1763
+ }
1764
+
1765
+ const proxy = createMagicProxy(input)
1766
+
1767
+ proxy.a['$ref-value'] = {
1768
+ message: 'I rewrote the user schema',
1769
+ }
1770
+
1771
+ expect(proxy.definitions.user).toEqual({
1772
+ 'message': 'I rewrote the user schema',
1773
+ })
1774
+ })
1775
+
1776
+ it('should allow writing on an $anchor property', () => {
1777
+ const input = {
1778
+ $id: 'https://example.com/schema',
1779
+ definitions: {
1780
+ user: {
1781
+ $id: 'https://example.com/user',
1782
+ $anchor: 'user-schema',
1783
+ type: 'object',
1784
+ properties: {
1785
+ name: { type: 'string' },
1786
+ },
1787
+ },
1788
+ },
1789
+ a: {
1790
+ $ref: 'https://example.com/user#user-schema',
1791
+ },
1792
+ }
1793
+
1794
+ const proxy = createMagicProxy(input)
1795
+
1796
+ proxy.a['$ref-value'] = {
1797
+ message: 'I rewrote the user schema',
1798
+ }
1799
+
1800
+ expect(proxy.definitions.user).toEqual({
1801
+ 'message': 'I rewrote the user schema',
1802
+ })
1803
+ })
1804
+
1805
+ it('should allow writing on a top level $anchor property', () => {
1806
+ const input = {
1807
+ definitions: {
1808
+ user: {
1809
+ $anchor: 'user-schema',
1810
+ type: 'object',
1811
+ properties: {
1812
+ name: { type: 'string' },
1813
+ },
1814
+ },
1815
+ },
1816
+ a: {
1817
+ $ref: '#user-schema',
1818
+ },
1819
+ }
1820
+
1821
+ const proxy = createMagicProxy(input)
1822
+
1823
+ proxy.a['$ref-value'] = {
1824
+ message: 'I rewrote the user schema',
1825
+ }
1826
+
1827
+ expect(proxy.definitions.user).toEqual({
1828
+ 'message': 'I rewrote the user schema',
1829
+ })
1830
+ })
1831
+ })
1832
+
1285
1833
  describe('hide underscore properties', () => {
1286
1834
  it('should hide properties starting with underscore from direct access', () => {
1287
1835
  const input = {