Skip to content

Commit

Permalink
#75 allow extend (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
aboutlo committed Jun 20, 2020
1 parent d2f81ab commit 42993d9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ObjectSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,10 @@ const ObjectSchema = ({ schema = initialState, ...options } = {}) => {
isFluentSchema,
FLUENT_SCHEMA,
_getState,
extend,
...rest
} = BaseSchema({ schema: extended, ...options })
return { valueOf, isFluentSchema, FLUENT_SCHEMA, _getState }
} = ObjectSchema({ schema: extended, ...options })
return { valueOf, isFluentSchema, FLUENT_SCHEMA, _getState, extend }
},

/**
Expand Down
2 changes: 2 additions & 0 deletions src/ObjectSchema.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -762,13 +762,15 @@ describe('ObjectSchema', () => {
.prop('again')
.prop('reason', S.string().minLength(2))
.extend(extended)
.extend(S.object().prop('multiple'))

expect(extendedAgain.valueOf()).toEqual({
$schema: 'http://json-schema.org/draft-07/schema#',
type: 'object',
properties: {
other: {},
again: {},
multiple: {},
reason: { title: 'title', type: 'string', minLength: 2 },
},
})
Expand Down

0 comments on commit 42993d9

Please sign in to comment.