diff --git a/synapse/data/jsonschemas/json-schema.org/draft-07/schema b/synapse/data/jsonschemas/json-schema.org/draft-07/schema index 68e0f50483..5165426e1d 100644 --- a/synapse/data/jsonschemas/json-schema.org/draft-07/schema +++ b/synapse/data/jsonschemas/json-schema.org/draft-07/schema @@ -169,8 +169,7 @@ }, "propertyNames": { "format": "regex" - }, - "default": {} + } }, "dependencies": { "type": "object", diff --git a/synapse/tests/files/stormpkg/testpkg.yaml b/synapse/tests/files/stormpkg/testpkg.yaml index be5631d15f..a68f74a426 100644 --- a/synapse/tests/files/stormpkg/testpkg.yaml +++ b/synapse/tests/files/stormpkg/testpkg.yaml @@ -122,10 +122,8 @@ vaults: oneOf: - { type: boolean } - { type: string } - default: true baz: type: boolean - default: false additionalProperties: false required: - bar diff --git a/synapse/tests/test_tools_storm_pkg_gen.py b/synapse/tests/test_tools_storm_pkg_gen.py index 961a88c2ae..25f3fc2894 100644 --- a/synapse/tests/test_tools_storm_pkg_gen.py +++ b/synapse/tests/test_tools_storm_pkg_gen.py @@ -160,9 +160,7 @@ async def test_tools_genpkg(self): self.eq(pvault['schemas']['configs']['properties']['foo']['default'], 'hehe haha') self.eq(pvault['schemas']['configs']['properties']['bar']['oneOf'][0]['type'], 'boolean') self.eq(pvault['schemas']['configs']['properties']['bar']['oneOf'][1]['type'], 'string') - self.eq(pvault['schemas']['configs']['properties']['bar']['default'], True) self.eq(pvault['schemas']['configs']['properties']['baz']['type'], 'boolean') - self.eq(pvault['schemas']['configs']['properties']['baz']['default'], False) self.eq(pvault['schemas']['configs']['additionalProperties'], False) self.eq(pvault['schemas']['secrets']['properties']['quux']['type'], 'string') self.eq(pvault['schemas']['secrets']['properties']['quux']['minLength'], 2) @@ -193,6 +191,22 @@ async def test_tools_genpkg(self): self.eq(build.get('synapse:version'), s_version.verstring) self.eq(build.get('synapse:commit'), s_version.commit) + ret = await core.callStorm(''' + $s = $lib.pkg.get(testpkg).vaults.testpkg.schemas.configs + return($lib.json.schema($s).validate(({"bar": true, "baz": true}))) + ''') + self.eq([True, { + 'foo': 'hehe haha', + 'bar': True, + 'baz': True, + }], ret) + + ret = await core.callStorm(''' + $s = $lib.pkg.get(testpkg).vaults.testpkg.schemas.secrets + return($lib.json.schema($s).validate(({"quux": "foo"}))) + ''') + self.eq([True, {'quux': 'foo'}], ret) + # nodocs nodocspath = s_common.genpath(core.dirn, 'testpkg_nodocs.json') argv = ('--no-docs', '--save', nodocspath, ymlpath)