-
Notifications
You must be signed in to change notification settings - Fork 370
Migrates to Zod v4 #7005
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Migrates to Zod v4 #7005
Conversation
MartinM85
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick review. Nothing major, but maybe I overlooked something.
src/m365/entra/commands/roledefinition/roledefinition-remove.ts
Outdated
Show resolved
Hide resolved
| .strict(); | ||
| export const options = z.strictObject({ | ||
| ...globalOptionsZod.shape, | ||
| userId: z.string().refine(id => validation.isValidGuid(id), { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| userId: z.string().refine(id => validation.isValidGuid(id), { | |
| userId: z.uuid().refine(id => validation.isValidGuid(id), { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're using uuid(), then we don't need to add manual refinement on top. z.uuid() would suffice.
|
Thanks for the feedback @MartinM85! Very keen eye! |
Co-authored-by: Martin Machacek <[email protected]>
Co-authored-by: Martin Machacek <[email protected]>
Co-authored-by: Martin Machacek <[email protected]>
Co-authored-by: Martin Machacek <[email protected]>
Co-authored-by: Martin Machacek <[email protected]>
Co-authored-by: Martin Machacek <[email protected]>
Co-authored-by: Martin Machacek <[email protected]>
a86f242 to
4138dd6
Compare
MartinM85
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few minor suggestions from my side...using z.uuid() instead of z.string() in several commands.
| }), | ||
| certificateBase64Encoded: z.string().optional(), | ||
| thumbprint: z.string().optional(), | ||
| appId: z.string().optional(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| appId: z.string().optional(), | |
| appId: z.uuid().optional(), |
| export const options = z.strictObject({ | ||
| ...globalOptionsZod.shape, | ||
| roleDefinitionId: z.string().optional(), | ||
| roleDefinitionName: z.string().optional(), | ||
| principalId: z.string().optional(), | ||
| principalName: z.string().optional(), | ||
| scope: z.enum(['tenant', 'user', 'group', 'administrativeUnit', 'custom']).alias('s'), | ||
| userId: z.string().optional(), | ||
| userName: z.string().optional(), | ||
| groupId: z.string().optional(), | ||
| groupName: z.string().optional(), | ||
| administrativeUnitId: z.string().optional(), | ||
| administrativeUnitName: z.string().optional(), | ||
| customAppScopeId: z.string().optional(), | ||
| customAppScopeName: z.string().optional() | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| export const options = z.strictObject({ | |
| ...globalOptionsZod.shape, | |
| roleDefinitionId: z.string().optional(), | |
| roleDefinitionName: z.string().optional(), | |
| principalId: z.string().optional(), | |
| principalName: z.string().optional(), | |
| scope: z.enum(['tenant', 'user', 'group', 'administrativeUnit', 'custom']).alias('s'), | |
| userId: z.string().optional(), | |
| userName: z.string().optional(), | |
| groupId: z.string().optional(), | |
| groupName: z.string().optional(), | |
| administrativeUnitId: z.string().optional(), | |
| administrativeUnitName: z.string().optional(), | |
| customAppScopeId: z.string().optional(), | |
| customAppScopeName: z.string().optional() | |
| }); | |
| export const options = z.strictObject({ | |
| ...globalOptionsZod.shape, | |
| roleDefinitionId: z.uuid().optional(), | |
| roleDefinitionName: z.string().optional(), | |
| principalId: z.uuid().optional(), | |
| principalName: z.string().optional(), | |
| scope: z.enum(['tenant', 'user', 'group', 'administrativeUnit', 'custom']).alias('s'), | |
| userId: z.uuid().optional(), | |
| userName: z.string().optional(), | |
| groupId: z.uuid().optional(), | |
| groupName: z.string().optional(), | |
| administrativeUnitId: z.uuid().optional(), | |
| administrativeUnitName: z.string().optional(), | |
| customAppScopeId: z.uuid().optional(), | |
| customAppScopeName: z.string().optional() | |
| }); |
| appId: z.string().optional(), | ||
| appObjectId: z.string().optional(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| appId: z.string().optional(), | |
| appObjectId: z.string().optional(), | |
| appId: z.uuid().optional(), | |
| appObjectId: z.uuid().optional(), |
| const options = z.looseObject({ | ||
| ...globalOptionsZod.shape, | ||
| name: z.string().alias('n'), | ||
| resourceId: z.string().alias('i'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| resourceId: z.string().alias('i'), | |
| resourceId: z.uuid().alias('i'), |
| .strict(); | ||
| export const options = z.strictObject({ | ||
| ...globalOptionsZod.shape, | ||
| resourceId: z.string().alias('i'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| resourceId: z.string().alias('i'), | |
| resourceId: z.uuid().alias('i'), |
| .strict(); | ||
| export const options = z.strictObject({ | ||
| ...globalOptionsZod.shape, | ||
| resourceId: z.string().alias('i'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| resourceId: z.string().alias('i'), | |
| resourceId: z.uuid().alias('i'), |
| const options = z.looseObject({ | ||
| ...globalOptionsZod.shape, | ||
| name: z.string().alias('n'), | ||
| resourceId: z.string().alias('i'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| resourceId: z.string().alias('i'), | |
| resourceId: z.uuid().alias('i'), |
| userId: z.string().refine(id => validation.isValidGuid(id), { | ||
| error: e => `'${e.input}' is not a valid GUID.` | ||
| }).optional().alias('i'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| userId: z.string().refine(id => validation.isValidGuid(id), { | |
| error: e => `'${e.input}' is not a valid GUID.` | |
| }).optional().alias('i'), | |
| userId: z.uuid().optional().alias('i'), |
No description provided.