Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions synapse/data/jsonschemas/json-schema.org/draft-07/schema
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,7 @@
},
"propertyNames": {
"format": "regex"
},
"default": {}
}
},
"dependencies": {
"type": "object",
Expand Down
2 changes: 0 additions & 2 deletions synapse/tests/files/stormpkg/testpkg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,8 @@ vaults:
oneOf:
- { type: boolean }
- { type: string }
default: true
baz:
type: boolean
default: false
additionalProperties: false
required:
- bar
Expand Down
18 changes: 16 additions & 2 deletions synapse/tests/test_tools_storm_pkg_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down