synapse 2.196.0__py311-none-any.whl → 2.197.0__py311-none-any.whl

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.

Potentially problematic release.


This version of synapse might be problematic. Click here for more details.

synapse/cortex.py CHANGED
@@ -77,6 +77,7 @@ import synapse.lib.stormlib.yaml as s_stormlib_yaml # NOQA
77
77
  import synapse.lib.stormlib.basex as s_stormlib_basex # NOQA
78
78
  import synapse.lib.stormlib.cache as s_stormlib_cache # NOQA
79
79
  import synapse.lib.stormlib.graph as s_stormlib_graph # NOQA
80
+ import synapse.lib.stormlib.index as s_stormlib_index # NOQA
80
81
  import synapse.lib.stormlib.iters as s_stormlib_iters # NOQA
81
82
  import synapse.lib.stormlib.macro as s_stormlib_macro
82
83
  import synapse.lib.stormlib.model as s_stormlib_model
@@ -1496,7 +1497,7 @@ class Cortex(s_oauth.OAuthMixin, s_cell.Cell): # type: ignore
1496
1497
  'desc': 'Controls the ability to remove a file from the Axon.'},
1497
1498
  ))
1498
1499
  for pdef in self._cortex_permdefs:
1499
- s_storm.reqValidPermDef(pdef)
1500
+ s_schemas.reqValidPermDef(pdef)
1500
1501
 
1501
1502
  def _getPermDefs(self):
1502
1503
 
@@ -1770,7 +1771,7 @@ class Cortex(s_oauth.OAuthMixin, s_cell.Cell): # type: ignore
1770
1771
  gdef['updated'] = now
1771
1772
  gdef['permissions']['users'][user.iden] = s_cell.PERM_ADMIN
1772
1773
 
1773
- s_stormlib_graph.reqValidGdef(gdef)
1774
+ s_schemas.reqValidGdef(gdef)
1774
1775
 
1775
1776
  await self.reqValidStormGraph(gdef)
1776
1777
 
@@ -1778,7 +1779,7 @@ class Cortex(s_oauth.OAuthMixin, s_cell.Cell): # type: ignore
1778
1779
 
1779
1780
  @s_nexus.Pusher.onPush('storm:graph:add')
1780
1781
  async def _addStormGraph(self, gdef):
1781
- s_stormlib_graph.reqValidGdef(gdef)
1782
+ s_schemas.reqValidGdef(gdef)
1782
1783
 
1783
1784
  await self.reqValidStormGraph(gdef)
1784
1785
 
@@ -1857,7 +1858,7 @@ class Cortex(s_oauth.OAuthMixin, s_cell.Cell): # type: ignore
1857
1858
  gdef = copy.deepcopy(gdef)
1858
1859
  gdef.update(info)
1859
1860
 
1860
- s_stormlib_graph.reqValidGdef(gdef)
1861
+ s_schemas.reqValidGdef(gdef)
1861
1862
 
1862
1863
  await self.reqValidStormGraph(gdef)
1863
1864
 
@@ -1879,7 +1880,7 @@ class Cortex(s_oauth.OAuthMixin, s_cell.Cell): # type: ignore
1879
1880
 
1880
1881
  await self._setEasyPerm(gdef, scope, iden, level)
1881
1882
 
1882
- s_stormlib_graph.reqValidGdef(gdef)
1883
+ s_schemas.reqValidGdef(gdef)
1883
1884
 
1884
1885
  self.graphs.set(gden, gdef)
1885
1886
 
@@ -2876,7 +2877,7 @@ class Cortex(s_oauth.OAuthMixin, s_cell.Cell): # type: ignore
2876
2877
  await self.reqValidStormGraph(gdef)
2877
2878
 
2878
2879
  # Validate package def (post normalization)
2879
- s_storm.reqValidPkgdef(pkgdef)
2880
+ s_schemas.reqValidPkgdef(pkgdef)
2880
2881
 
2881
2882
  for configvar in pkgdef.get('configvars', ()):
2882
2883
  self._reqStormPkgVarType(pkgname, configvar.get('type'))
@@ -4421,6 +4422,9 @@ class Cortex(s_oauth.OAuthMixin, s_cell.Cell): # type: ignore
4421
4422
  for cdef in s_stormlib_vault.stormcmds:
4422
4423
  await self._trySetStormCmd(cdef.get('name'), cdef)
4423
4424
 
4425
+ for cdef in s_stormlib_index.stormcmds:
4426
+ await self._trySetStormCmd(cdef.get('name'), cdef)
4427
+
4424
4428
  async def _initPureStormCmds(self):
4425
4429
  oldcmds = []
4426
4430
  for name, cdef in self.cmddefs.items():
@@ -4451,7 +4455,7 @@ class Cortex(s_oauth.OAuthMixin, s_cell.Cell): # type: ignore
4451
4455
  for path, ctor in s_stormtypes.registry.iterLibs():
4452
4456
  # Ensure each ctor's permdefs are valid
4453
4457
  for pdef in ctor._storm_lib_perms:
4454
- s_storm.reqValidPermDef(pdef)
4458
+ s_schemas.reqValidPermDef(pdef)
4455
4459
  # Skip libbase which is registered as a default ctor in the storm Runtime
4456
4460
  if path:
4457
4461
  self.addStormLib(path, ctor)
@@ -5672,7 +5676,7 @@ class Cortex(s_oauth.OAuthMixin, s_cell.Cell): # type: ignore
5672
5676
  async def runStormDmon(self, iden, ddef):
5673
5677
 
5674
5678
  # validate ddef before firing task
5675
- s_storm.reqValidDdef(ddef)
5679
+ s_schemas.reqValidDdef(ddef)
5676
5680
 
5677
5681
  dmon = self.stormdmons.getDmon(iden)
5678
5682
  if dmon is not None:
synapse/cryotank.py CHANGED
@@ -8,7 +8,7 @@ import synapse.common as s_common
8
8
 
9
9
  import synapse.lib.base as s_base
10
10
  import synapse.lib.cell as s_cell
11
- import synapse.lib.storm as s_storm
11
+ import synapse.lib.schemas as s_schemas
12
12
  import synapse.lib.lmdbslab as s_lmdbslab
13
13
  import synapse.lib.slabseqn as s_slabseqn
14
14
  import synapse.lib.slaboffs as s_slaboffs
@@ -314,7 +314,7 @@ class CryoCell(s_cell.Cell):
314
314
  ))
315
315
 
316
316
  for pdef in self._cryo_permdefs:
317
- s_storm.reqValidPermDef(pdef)
317
+ s_schemas.reqValidPermDef(pdef)
318
318
 
319
319
  def _getPermDefs(self):
320
320
  permdefs = list(s_cell.Cell._getPermDefs(self))
synapse/lib/cell.py CHANGED
@@ -4478,7 +4478,7 @@ class Cell(s_nexus.Pusher, s_telepath.Aware):
4478
4478
 
4479
4479
  for task in self.boss.ps():
4480
4480
 
4481
- item = task.pack()
4481
+ item = task.packv2()
4482
4482
  item['service'] = self.ahasvcname
4483
4483
 
4484
4484
  yield item
@@ -4500,7 +4500,7 @@ class Cell(s_nexus.Pusher, s_telepath.Aware):
4500
4500
 
4501
4501
  task = self.boss.get(iden)
4502
4502
  if task is not None:
4503
- item = task.pack()
4503
+ item = task.packv2()
4504
4504
  item['service'] = self.ahasvcname
4505
4505
  return item
4506
4506
 
synapse/lib/config.py CHANGED
@@ -32,16 +32,16 @@ def localSchemaRefHandler(uri):
32
32
  try:
33
33
  parts = urllib.parse.urlparse(uri)
34
34
  except ValueError:
35
- raise s_exc.BadUrl(f'Malformed URI: {uri}.') from None
35
+ raise s_exc.BadUrl(mesg=f'Malformed URI: {uri}.') from None
36
36
 
37
37
  filename = s_data.path('jsonschemas', parts.hostname, *parts.path.split('/'))
38
38
 
39
39
  # Check for path traversal. Unlikely, but still check
40
40
  if not filename.startswith(s_data.path('jsonschemas', parts.hostname)):
41
- raise s_exc.BadArg(f'Path traversal in schema URL: {uri}.')
41
+ raise s_exc.BadArg(mesg=f'Path traversal in schema URL: {uri}.')
42
42
 
43
43
  if not os.path.exists(filename) or not os.path.isfile(filename):
44
- raise s_exc.NoSuchFile(f'Local JSON schema not found for {uri}.')
44
+ raise s_exc.NoSuchFile(mesg=f'Local JSON schema not found for {uri}.')
45
45
 
46
46
  with open(filename, 'r') as fp:
47
47
  return json.load(fp)
@@ -150,7 +150,7 @@ class MultiSlabSeqn(s_base.Base):
150
150
  firstidx = firstitem[0] # might not match the separately stored first index due to culling
151
151
 
152
152
  if firstidx < fnstartidx:
153
- raise s_exc.BadCoreStore('Multislab: filename inconsistent with contents')
153
+ raise s_exc.BadCoreStore(mesg='Multislab: filename inconsistent with contents')
154
154
 
155
155
  lastidx = seqn.index() - 1
156
156
 
@@ -161,7 +161,7 @@ class MultiSlabSeqn(s_base.Base):
161
161
  self.firstindx = lowindx
162
162
 
163
163
  if self.firstindx > self.indx:
164
- raise s_exc.BadCoreStore('Invalid firstindx value')
164
+ raise s_exc.BadCoreStore(mesg='Invalid firstindx value')
165
165
 
166
166
  await self._initTailSlab(fnstartidx)
167
167
 
synapse/lib/schemas.py CHANGED
@@ -1,7 +1,8 @@
1
1
  import synapse.lib.const as s_const
2
2
  import synapse.lib.config as s_config
3
+ import synapse.lib.grammar as s_grammar
3
4
  import synapse.lib.msgpack as s_msgpack
4
-
5
+ import synapse.lib.version as s_version
5
6
 
6
7
  easyPermSchema = {
7
8
  'type': 'object',
@@ -551,3 +552,479 @@ stixIngestBundleSchema = {
551
552
  },
552
553
  }
553
554
  reqValidStixIngestBundle = s_config.getJsValidator(stixIngestBundleSchema)
555
+
556
+ _reqValidGdefSchema = {
557
+ 'type': 'object',
558
+ 'properties': {
559
+ 'iden': {'type': 'string', 'pattern': s_config.re_iden},
560
+ 'name': {'type': 'string', 'minLength': 1},
561
+ 'desc': {'type': 'string', 'default': ''},
562
+ 'scope': {'type': 'string', 'enum': ['user', 'power-up']},
563
+ 'creator': {'type': 'string', 'pattern': s_config.re_iden},
564
+ 'power-up': {'type': 'string', 'minLength': 1},
565
+ 'maxsize': {'type': 'number', 'minimum': 0},
566
+ 'existing': {'type': 'array', 'items': {'type': 'string'}},
567
+ 'created': {'type': 'number'},
568
+ 'updated': {'type': 'number'},
569
+ 'refs': {'type': 'boolean', 'default': False},
570
+ 'edges': {'type': 'boolean', 'default': True},
571
+ 'edgelimit': {'type': 'number', 'default': 3000},
572
+ 'degrees': {'type': ['integer', 'null'], 'minimum': 0},
573
+ 'filterinput': {'type': 'boolean', 'default': True},
574
+ 'yieldfiltered': {'type': 'boolean', 'default': False},
575
+ 'filters': {
576
+ 'type': ['array', 'null'],
577
+ 'items': {'type': 'string'}
578
+ },
579
+ 'pivots': {
580
+ 'type': ['array', 'null'],
581
+ 'items': {'type': 'string'}
582
+ },
583
+ 'forms': {
584
+ 'type': 'object',
585
+ 'patternProperties': {
586
+ '^.*$': {
587
+ 'type': 'object',
588
+ 'properties': {
589
+ 'filters': {
590
+ 'type': ['array', 'null'],
591
+ 'items': {'type': 'string'}
592
+ },
593
+ 'pivots': {
594
+ 'type': ['array', 'null'],
595
+ 'items': {'type': 'string'}
596
+ }
597
+ },
598
+ 'additionalProperties': False,
599
+ }
600
+ }
601
+ },
602
+ 'permissions': s_msgpack.deepcopy(easyPermSchema)
603
+ },
604
+ 'additionalProperties': False,
605
+ 'required': ['iden', 'name', 'scope'],
606
+ 'allOf': [
607
+ {
608
+ 'if': {'properties': {'scope': {'const': 'power-up'}}},
609
+ 'then': {'required': ['power-up']},
610
+ 'else': {'required': ['creator']},
611
+ }
612
+ ]
613
+ }
614
+ reqValidGdef = s_config.getJsValidator(_reqValidGdefSchema)
615
+
616
+ _reqValidPermDefSchema = {
617
+ 'type': 'object',
618
+ 'properties': {
619
+ 'perm': {'type': 'array', 'items': {'type': 'string'}},
620
+ 'desc': {'type': 'string'},
621
+ 'gate': {'type': 'string'},
622
+ 'ex': {'type': 'string'}, # Example string
623
+ 'workflowconfig': {'type': 'boolean'},
624
+ 'default': {'type': 'boolean', 'default': False},
625
+ },
626
+ 'required': ['perm', 'desc', 'gate'],
627
+ }
628
+
629
+ reqValidPermDef = s_config.getJsValidator(_reqValidPermDefSchema)
630
+
631
+ # N.B. This is kept in sync with s_datamodel.Datamodel().types
632
+ # with the DatamodelTest.test_datamodel_schema_basetypes test.
633
+ datamodel_basetypes = [
634
+ 'int',
635
+ 'float',
636
+ 'range',
637
+ 'str',
638
+ 'hex',
639
+ 'bool',
640
+ 'time',
641
+ 'duration',
642
+ 'ival',
643
+ 'guid',
644
+ 'syn:tag:part',
645
+ 'syn:tag',
646
+ 'comp',
647
+ 'loc',
648
+ 'ndef',
649
+ 'array',
650
+ 'edge',
651
+ 'timeedge',
652
+ 'data',
653
+ 'nodeprop',
654
+ 'hugenum',
655
+ 'taxon',
656
+ 'taxonomy',
657
+ 'velocity',
658
+ ]
659
+
660
+ _reqValidPkgdefSchema = {
661
+ 'type': 'object',
662
+ 'properties': {
663
+ 'name': {'type': 'string'},
664
+ 'version': {
665
+ 'type': 'string',
666
+ 'pattern': s_version.semverstr,
667
+ },
668
+ 'build': {
669
+ 'type' 'object'
670
+ 'properties': {
671
+ 'time': {'type': 'number'},
672
+ },
673
+ 'required': ['time'],
674
+ },
675
+ 'codesign': {
676
+ 'type': 'object',
677
+ 'properties': {
678
+ 'sign': {'type': 'string'},
679
+ 'cert': {'type': 'string'},
680
+ },
681
+ 'required': ['cert', 'sign'],
682
+ },
683
+ # TODO: Remove me after Synapse 3.0.0.
684
+ 'synapse_minversion': {
685
+ 'type': ['array', 'null'],
686
+ 'items': {'type': 'number'}
687
+ },
688
+ 'synapse_version': {
689
+ 'type': 'string',
690
+ },
691
+ 'modules': {
692
+ 'type': ['array', 'null'],
693
+ 'items': {'$ref': '#/definitions/module'}
694
+ },
695
+ 'docs': {
696
+ 'type': ['array', 'null'],
697
+ 'items': {'$ref': '#/definitions/doc'},
698
+ },
699
+ 'logo': {
700
+ 'type': 'object',
701
+ 'properties': {
702
+ 'mime': {'type': 'string'},
703
+ 'file': {'type': 'string'},
704
+ },
705
+ 'additionalProperties': True,
706
+ 'required': ['mime', 'file'],
707
+ },
708
+ 'commands': {
709
+ 'type': ['array', 'null'],
710
+ 'items': {'$ref': '#/definitions/command'},
711
+ },
712
+ 'graphs': {
713
+ 'type': ['array', 'null'],
714
+ 'items': s_msgpack.deepcopy(_reqValidGdefSchema, use_list=True),
715
+ },
716
+ 'desc': {'type': 'string'},
717
+ 'svciden': {'type': ['string', 'null'], 'pattern': s_config.re_iden},
718
+ 'onload': {'type': 'string'},
719
+ 'author': {
720
+ 'type': 'object',
721
+ 'properties': {
722
+ 'url': {'type': 'string'},
723
+ 'name': {'type': 'string'},
724
+ },
725
+ 'required': ['name', 'url'],
726
+ },
727
+ 'depends': {
728
+ 'properties': {
729
+ 'requires': {'type': 'array', 'items': {'$ref': '#/definitions/require'}},
730
+ 'conflicts': {'type': 'array', 'items': {'$ref': '#/definitions/conflict'}},
731
+ },
732
+ 'additionalProperties': True,
733
+ },
734
+ 'perms': {
735
+ 'type': 'array',
736
+ 'items': s_msgpack.deepcopy(_reqValidPermDefSchema),
737
+ },
738
+ 'configvars': {
739
+ 'type': 'array',
740
+ 'items': {
741
+ 'type': 'object',
742
+ 'properties': {
743
+ 'name': {'type': 'string'},
744
+ 'varname': {'type': 'string'},
745
+ 'desc': {'type': 'string'},
746
+ 'default': {},
747
+ 'workflowconfig': {'type': 'boolean'},
748
+ 'type': {'$ref': '#/definitions/configvartype'},
749
+ 'scopes': {
750
+ 'type': 'array',
751
+ 'items': {
752
+ 'type': 'string',
753
+ 'enum': ['global', 'self']
754
+ },
755
+ },
756
+ },
757
+ 'required': ['name', 'varname', 'desc', 'type', 'scopes'],
758
+ },
759
+ },
760
+ },
761
+ 'additionalProperties': True,
762
+ 'required': ['name', 'version'],
763
+ 'definitions': {
764
+ 'doc': {
765
+ 'type': 'object',
766
+ 'properties': {
767
+ 'title': {'type': 'string'},
768
+ 'content': {'type': 'string'},
769
+ },
770
+ 'additionalProperties': True,
771
+ 'required': ['title', 'content'],
772
+ },
773
+ 'module': {
774
+ 'type': 'object',
775
+ 'properties': {
776
+ 'name': {'type': 'string'},
777
+ 'storm': {'type': 'string'},
778
+ 'modconf': {'type': 'object'},
779
+ 'apidefs': {
780
+ 'type': ['array', 'null'],
781
+ 'items': {'$ref': '#/definitions/apidef'},
782
+ },
783
+ 'asroot': {'type': 'boolean'},
784
+ 'asroot:perms': {'type': 'array',
785
+ 'items': {'type': 'array',
786
+ 'items': {'type': 'string'}},
787
+ },
788
+ },
789
+ 'additionalProperties': True,
790
+ 'required': ['name', 'storm']
791
+ },
792
+ 'apidef': {
793
+ 'type': 'object',
794
+ 'properties': {
795
+ 'name': {'type': 'string'},
796
+ 'desc': {'type': 'string'},
797
+ 'deprecated': {'$ref': '#/definitions/deprecatedItem'},
798
+ 'type': {
799
+ 'type': 'object',
800
+ 'properties': {
801
+ 'type': {
802
+ 'type': 'string',
803
+ 'enum': ['function']
804
+ },
805
+ 'args': {
806
+ 'type': 'array',
807
+ 'items': {'$ref': '#/definitions/apiarg'},
808
+ },
809
+ 'returns': {
810
+ 'type': 'object',
811
+ 'properties': {
812
+ 'name': {
813
+ 'type': 'string',
814
+ 'enum': ['yields'],
815
+ },
816
+ 'desc': {'type': 'string'},
817
+ 'type': {
818
+ 'oneOf': [
819
+ {'$ref': '#/definitions/apitype'},
820
+ {'type': 'array', 'items': {'$ref': '#/definitions/apitype'}},
821
+ ],
822
+ },
823
+ },
824
+ 'additionalProperties': False,
825
+ 'required': ['type', 'desc']
826
+ },
827
+ },
828
+ 'additionalProperties': False,
829
+ 'required': ['type', 'returns'],
830
+ },
831
+ },
832
+ 'additionalProperties': False,
833
+ 'required': ['name', 'desc', 'type']
834
+ },
835
+ 'apiarg': {
836
+ 'type': 'object',
837
+ 'properties': {
838
+ 'name': {'type': 'string'},
839
+ 'desc': {'type': 'string'},
840
+ 'type': {
841
+ 'oneOf': [
842
+ {'$ref': '#/definitions/apitype'},
843
+ {'type': 'array', 'items': {'$ref': '#/definitions/apitype'}},
844
+ ],
845
+ },
846
+ 'default': {'type': ['boolean', 'integer', 'string', 'null']},
847
+ },
848
+ 'additionalProperties': False,
849
+ 'required': ['name', 'desc', 'type']
850
+ },
851
+ 'deprecatedItem': {
852
+ 'type': 'object',
853
+ 'properties': {
854
+ 'eolvers': {'type': 'string', 'minLength': 1,
855
+ 'description': "The version which will not longer support the item."},
856
+ 'eoldate': {'type': 'string', 'minLength': 1,
857
+ 'description': 'Optional string indicating Synapse releases after this date may no longer support the item.'},
858
+ 'mesg': {'type': ['string', 'null'], 'default': None,
859
+ 'description': 'Optional message to include in the warning text.'}
860
+ },
861
+ 'oneOf': [
862
+ {
863
+ 'required': ['eolvers'],
864
+ 'not': {'required': ['eoldate']}
865
+ },
866
+ {
867
+ 'required': ['eoldate'],
868
+ 'not': {'required': ['eolvers']}
869
+ }
870
+ ],
871
+ 'additionalProperties': False,
872
+ },
873
+ 'apitype': {
874
+ 'type': 'string',
875
+ },
876
+ 'command': {
877
+ 'type': 'object',
878
+ 'properties': {
879
+ 'name': {
880
+ 'type': 'string',
881
+ 'pattern': s_grammar.re_scmd
882
+ },
883
+ 'cmdargs': {
884
+ 'type': ['array', 'null'],
885
+ 'items': {'$ref': '#/definitions/cmdarg'},
886
+ },
887
+ 'cmdinputs': {
888
+ 'type': ['array', 'null'],
889
+ 'items': {'$ref': '#/definitions/cmdinput'},
890
+ },
891
+ 'storm': {'type': 'string'},
892
+ 'forms': {'$ref': '#/definitions/cmdformhints'},
893
+ 'perms': {'type': 'array',
894
+ 'items': {'type': 'array',
895
+ 'items': {'type': 'string'}},
896
+ },
897
+ },
898
+ 'additionalProperties': True,
899
+ 'required': ['name', 'storm']
900
+ },
901
+ 'cmdarg': {
902
+ 'type': 'array',
903
+ 'items': [
904
+ {'type': 'string'},
905
+ {
906
+ 'type': 'object',
907
+ 'properties': {
908
+ 'help': {'type': 'string'},
909
+ 'default': {},
910
+ 'dest': {'type': 'string'},
911
+ 'required': {'type': 'boolean'},
912
+ 'action': {'type': 'string'},
913
+ 'nargs': {'type': ['string', 'integer']},
914
+ 'choices': {
915
+ 'type': 'array',
916
+ 'uniqueItems': True,
917
+ 'minItems': 1,
918
+ },
919
+ 'type': {
920
+ 'type': 'string',
921
+ 'enum': s_msgpack.deepcopy(datamodel_basetypes),
922
+ },
923
+ },
924
+ }
925
+ ],
926
+ 'additionalItems': False,
927
+ },
928
+ 'cmdinput': {
929
+ 'type': 'object',
930
+ 'properties': {
931
+ 'form': {'type': 'string'},
932
+ 'help': {'type': 'string'},
933
+ },
934
+ 'additionalProperties': True,
935
+ 'required': ['form'],
936
+ },
937
+ 'configvartype': {
938
+ 'anyOf': [
939
+ {'type': 'array', 'items': {'$ref': '#/definitions/configvartype'}},
940
+ {'type': 'string'},
941
+ ]
942
+ },
943
+ # deprecated
944
+ 'cmdformhints': {
945
+ 'type': 'object',
946
+ 'properties': {
947
+ 'input': {
948
+ 'type': 'array',
949
+ 'uniqueItems': True,
950
+ 'items': {
951
+ 'type': 'string',
952
+ }
953
+ },
954
+ 'output': {
955
+ 'type': 'array',
956
+ 'uniqueItems': True,
957
+ 'items': {
958
+ 'type': 'string',
959
+ }
960
+ },
961
+ 'nodedata': {
962
+ 'type': 'array',
963
+ 'uniqueItems': True,
964
+ 'items': {
965
+ 'type': 'array',
966
+ 'items': [
967
+ {'type': 'string'},
968
+ {'type': 'string'},
969
+ ],
970
+ 'additionalItems': False,
971
+ },
972
+ },
973
+ }
974
+ },
975
+ 'require': {
976
+ 'type': 'object',
977
+ 'properties': {
978
+ 'name': {'type': 'string'},
979
+ 'version': {'type': 'string'},
980
+ 'desc': {'type': 'string'},
981
+ 'optional': {'type': 'boolean'},
982
+ },
983
+ 'additionalItems': True,
984
+ 'required': ('name', 'version'),
985
+ },
986
+ 'conflict': {
987
+ 'type': 'object',
988
+ 'properties': {
989
+ 'name': {'type': 'string'},
990
+ 'version': {'type': 'string'},
991
+ 'desc': {'type': 'string'},
992
+ },
993
+ 'additionalItems': True,
994
+ 'required': ('name',),
995
+ },
996
+ }
997
+ }
998
+ reqValidPkgdef = s_config.getJsValidator(_reqValidPkgdefSchema)
999
+
1000
+ _reqValidDdefSchema = {
1001
+ 'type': 'object',
1002
+ 'properties': {
1003
+ 'name': {'type': 'string'},
1004
+ 'storm': {'type': 'string'},
1005
+ 'view': {'type': 'string', 'pattern': s_config.re_iden},
1006
+ 'user': {'type': 'string', 'pattern': s_config.re_iden},
1007
+ 'iden': {'type': 'string', 'pattern': s_config.re_iden},
1008
+ 'enabled': {'type': 'boolean', 'default': True},
1009
+ 'stormopts': {
1010
+ 'oneOf': [
1011
+ {'type': 'null'},
1012
+ {'$ref': '#/definitions/stormopts'}
1013
+ ]
1014
+ }
1015
+ },
1016
+ 'additionalProperties': True,
1017
+ 'required': ['iden', 'user', 'storm'],
1018
+ 'definitions': {
1019
+ 'stormopts': {
1020
+ 'type': 'object',
1021
+ 'properties': {
1022
+ 'repr': {'type': 'boolean'},
1023
+ 'path': {'type': 'string'},
1024
+ 'show': {'type': 'array', 'items': {'type': 'string'}}
1025
+ },
1026
+ 'additionalProperties': True,
1027
+ },
1028
+ }
1029
+ }
1030
+ reqValidDdef = s_config.getJsValidator(_reqValidDdefSchema)