Skip to content

Commit

Permalink
Merge pull request #299 from MyUnisoft/fix_connector_idAsString
Browse files Browse the repository at this point in the history
fix(schema/events/connector): id is any string
  • Loading branch information
cedlio authored Jan 15, 2025
2 parents 37e682c + 8af1351 commit 581ac79
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 23 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const event: EventOptions<"connector"> = {
createdAt: Date.now()
},
data: {
id: 1,
id: "1",
code: "JFAC"
}
};
Expand Down
9 changes: 3 additions & 6 deletions src/schema/events/connector.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"type": "object",
"properties": {
"id": {
"type": "string",
"pattern": "^[0-9]+"
"type": "string"
},
"code": {
"type": "string"
Expand All @@ -22,8 +21,7 @@
"type": "object",
"properties": {
"id": {
"type": "string",
"pattern": "^[0-9]+"
"type": "string"
},
"code": {
"type": "string"
Expand All @@ -40,8 +38,7 @@
"type": "object",
"properties": {
"id": {
"type": "string",
"pattern": "^[0-9]+"
"type": "string"
},
"code": {
"type": "string"
Expand Down
16 changes: 0 additions & 16 deletions test/UT/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,6 @@ describe("validate", () => {
});
});

test("Given a wrong property, it should throw", () => {
const event = {
name: "connector",
operation: "CREATE",
data: {
id: "foo",
code: "bar"
}
};

assert.throws(() => validate(event as any), {
name: "Error",
message: `data: [/id: must match pattern \"^[0-9]+\"]`
});
});

test("Given a wrong metadata, it should throw", () => {
const event = {
name: "accountingFolder",
Expand Down

0 comments on commit 581ac79

Please # to comment.