Skip to content

Commit

Permalink
Don't directly mutate exclusion schema
Browse files Browse the repository at this point in the history
Co-authored-by: mix irving <[email protected]>
  • Loading branch information
Powersource and mixmix authored Aug 17, 2023
1 parent 661f1c3 commit 64d7d5b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions spec/group/exclude-member.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
const Validator = require('is-my-ssb-valid')
const addMemberSchema = require('private-group-spec/group/add-member/v1/schema.json')
const schema = require('private-group-spec/group/exclude-member/schema.json')
const baseSchema = require('private-group-spec/group/exclude-member/schema.json')

// we use the tribes2 exclude message type but with sigil links instead of URIs
schema.definitions.feedId = addMemberSchema.definitions.feedId
schema.definitions.groupId = addMemberSchema.definitions.cloakedMessageId
schema.definitions.messageId = addMemberSchema.definitions.messageId
const schema = {
...baseSchema,
definitions: {
...baseSchema.definitions
feedId: addMemberSchema.definitions.feedId
groupId: addMemberSchema.definitions.cloakedMessageId
messageId: addMemberSchema.definitions.messageId
}
}

module.exports = {
isValid: Validator(schema)
Expand Down

0 comments on commit 64d7d5b

Please sign in to comment.