Skip to content

Commit

Permalink
feat(core): loose custom resource id length
Browse files Browse the repository at this point in the history
  • Loading branch information
bzp2010 committed Nov 12, 2024
1 parent 107209d commit afddaa6
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/cli/src/linter/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { z } from 'zod';
const idSchema = z
.string()
.min(1)
.max(64)
.max(256)
.regex(/^[a-zA-Z0-9-_.]+$/);
const nameSchema = z
.string()
Expand Down
38 changes: 38 additions & 0 deletions apps/cli/src/linter/specs/common.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,44 @@ describe('Common Linter', () => {
} as ADCSDK.Configuration,
expect: true,
},
{
name: 'should check id length (length <= 256)',
input: {
services: [
{
id: ''.padEnd(256, '0'),
name: 'name',
routes: [],
},
],
} as ADCSDK.Configuration,
expect: true,
errors: [],
},
{
name: 'should check id length (length > 256)',
input: {
services: [
{
id: ''.padEnd(257, '0'),
name: 'name',
routes: [],
},
],
} as ADCSDK.Configuration,
expect: false,
errors: [
{
code: 'too_big',
exact: false,
inclusive: true,
maximum: 256,
message: 'String must contain at most 256 character(s)',
path: ['services', 0, 'id'],
type: 'string',
},
],
},
];

// test cases runner
Expand Down
2 changes: 1 addition & 1 deletion schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"id": {
"type": "string",
"minLength": 1,
"maxLength": 64,
"maxLength": 256,
"pattern": "^[a-zA-Z0-9-_.]+$"
},
"name": {
Expand Down

0 comments on commit afddaa6

Please sign in to comment.