Skip to content

Commit

Permalink
Merge pull request #1074 from JupiterOne/int-10917
Browse files Browse the repository at this point in the history
Add asn format
  • Loading branch information
jehisonprada committed May 8, 2024
2 parents e4af097 + 874416b commit dd72f8a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to
# Unreleased

- Add expiremental `OnDiskDuplicateKeyTracker`
- Add asn validator to j1Formats
- Replace validateEntityWithSchema

# 12.6.0 - 2024-04-24
Expand Down
3 changes: 3 additions & 0 deletions packages/integration-sdk-entity-validator/src/j1Formats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ const ipv4CidrRegex =
const ipv6CidrRegex =
/^([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$|^([0-9a-fA-F]{1,4}:){1,7}:\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$|^::\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$|^([0-9a-fA-F]{1,4}:){1,7}[0-9a-fA-F]{1,4}$/;

const asnRegex = /^AS\d{2,6}$/;

const j1JsonSchemaFormats = {
ip: (x) => ipv4.test(x) || ipv6.test(x),
ipCidr: (x) => ipv4CidrRegex.test(x) || ipv6CidrRegex.test(x),
asn: (x: string) => asnRegex.test(x),
} satisfies Record<string, AjvFormat>;

export const addJ1Formats = (ajvInstance: Ajv) => {
Expand Down

0 comments on commit dd72f8a

Please sign in to comment.