Skip to content
Open
Show file tree
Hide file tree
Changes from 5 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
5 changes: 3 additions & 2 deletions src/ObjectSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ const ObjectSchema = ({ schema = initialState, ...options } = {}) => {
* @param {string} id - an #id
**/
id: id => {
if (!id)
if (!id) {
throw new FluentSchemaError(
`id should not be an empty fragment <#> or an empty string <> (e.g. #myId)`
'id should not be an empty fragment <#> or an empty string <> (e.g. #myId)'
)
}
return options.factory({ schema: { ...schema, $id: id }, ...options })
},
/**
Expand Down
2 changes: 1 addition & 1 deletion src/ObjectSchema.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ describe('ObjectSchema', () => {
.valueOf()
).toEqual({
$id: id,
properties: {'prop': {}},
properties: { prop: {} },
type: 'object'
})
})
Expand Down
Loading