Skip to content

Commit

Permalink
feat: not allow empty chain id and check uri type (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
ALPAC-4 authored Apr 9, 2024
1 parent 6023a47 commit c235f74
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 15 deletions.
2 changes: 1 addition & 1 deletion _packages/types/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@initia/initia-registry-types",
"version": "0.0.13",
"version": "0.0.14",
"description": "The package provides TypeScript type definitions and Zod integration for initia-registry.",
"types": "./dist/types/index.d.ts",
"exports": {
Expand Down
23 changes: 13 additions & 10 deletions _packages/types/src/zods/Chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const ChainSchema = z
.regex(new RegExp("^(\\.\\./)+chain\\.schema\\.json$"))
.optional(),
chain_name: z.string().regex(new RegExp("[a-z0-9]+")),
chain_id: z.string(),
chain_id: z.string().regex(new RegExp("[a-z0-9]+")),
pre_fork_chain_name: z.string().regex(new RegExp("[a-z0-9]+")).optional(),
pretty_name: z.string().optional(),
website: z.string().url().optional(),
Expand Down Expand Up @@ -333,7 +333,7 @@ export const ChainSchema = z
.array(
z
.object({
address: z.string(),
address: z.string().url(),
provider: z.string().optional(),
archive: z.boolean().default(false),
})
Expand All @@ -344,7 +344,7 @@ export const ChainSchema = z
.array(
z
.object({
address: z.string(),
address: z.string().url(),
provider: z.string().optional(),
archive: z.boolean().default(false),
})
Expand All @@ -355,7 +355,7 @@ export const ChainSchema = z
.array(
z
.object({
address: z.string(),
address: z.string().url(),
provider: z.string().optional(),
archive: z.boolean().default(false),
})
Expand All @@ -366,7 +366,7 @@ export const ChainSchema = z
.array(
z
.object({
address: z.string(),
address: z.string().url(),
provider: z.string().optional(),
archive: z.boolean().default(false),
})
Expand All @@ -377,7 +377,7 @@ export const ChainSchema = z
.array(
z
.object({
address: z.string(),
address: z.string().url(),
provider: z.string().optional(),
archive: z.boolean().default(false),
})
Expand All @@ -388,7 +388,7 @@ export const ChainSchema = z
.array(
z
.object({
address: z.string(),
address: z.string().url(),
provider: z.string().optional(),
archive: z.boolean().default(false),
})
Expand All @@ -399,7 +399,7 @@ export const ChainSchema = z
.array(
z
.object({
address: z.string(),
address: z.string().url(),
provider: z.string().optional(),
archive: z.boolean().default(false),
})
Expand All @@ -414,7 +414,7 @@ export const ChainSchema = z
z
.object({
kind: z.string().optional(),
url: z.string().optional(),
url: z.string().url().optional(),
tx_page: z.string().optional(),
account_page: z.string().optional(),
})
Expand All @@ -424,7 +424,10 @@ export const ChainSchema = z
faucets: z
.array(
z
.object({ kind: z.string().optional(), url: z.string().optional() })
.object({
kind: z.string().optional(),
url: z.string().url().optional(),
})
.strict()
)
.optional(),
Expand Down
12 changes: 8 additions & 4 deletions chain.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"pattern": "[a-z0-9]+"
},
"chain_id": {
"type": "string"
"type": "string",
"pattern": "[a-z0-9]+"
},
"pre_fork_chain_name": {
"type": "string",
Expand Down Expand Up @@ -701,7 +702,8 @@
],
"properties": {
"address": {
"type": "string"
"type": "string",
"format": "uri"
},
"provider": {
"type": "string"
Expand All @@ -720,7 +722,8 @@
"type": "string"
},
"url": {
"type": "string"
"type": "string",
"format": "uri"
},
"tx_page": {
"type": "string"
Expand All @@ -738,7 +741,8 @@
"type": "string"
},
"url": {
"type": "string"
"type": "string",
"format": "uri"
}
},
"additionalProperties": false
Expand Down

0 comments on commit c235f74

Please sign in to comment.