-
Notifications
You must be signed in to change notification settings - Fork 1
CCM-13907: Allow null values in routing config schema #802
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?
Conversation
| ); | ||
| }); | ||
|
|
||
| test('builds routing config drafted event with null template IDs', () => { |
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.
Does there need to be one of these for deleted too?
| }), | ||
| }); | ||
|
|
||
| export const $NullableRoutingConfigEventData = |
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.
This name NullableRoutingConfig isn't super clear about which part is nullable. Maybe $DraftRoutingConfigEventData here and ${Submitted/Locked/Production|Completed}RoutingConfigEventData below?
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.
The other way to do it that just occurred to me to toy with for the final submit check, and can't decide if I like or not, is to pass a boolean through, eg from backend client
const $ConditionalTemplateLanguage = (draft: boolean) =>
schemaFor<ConditionalTemplateLanguage>()(
z.object({
language: $Language,
templateId: draft
? z.string().nonempty().nullable()
: z.string().nonempty(),
supplierReferences: z.record(z.string(), z.string()).optional(),
})
);
const $CascadeItem = (draft: boolean) =>
schemaFor<CascadeItem>()(
$CascadeItemBase.and(
z.union([
z.object({
defaultTemplateId: draft
? z.string().nonempty().nullable()
: z.string().nonempty(),
conditionalTemplates: z
.array(
z.union([
$ConditionalTemplateAccessible(final),
$ConditionalTemplateLanguage(final),
])
)
.optional(),
}),
z.object({
defaultTemplateId: draft
? z.string().nonempty().nullable().optional()
: z.string().nonempty().optional(),
conditionalTemplates: z.array(
z.union([
$ConditionalTemplateAccessible(final),
$ConditionalTemplateLanguage(final),
])
),
}),
])
)
);
etc
bde98a4
bde98a4 to
e0e2c39
Compare
Description
PR to allow null values in routing config schema
Type of changes
Checklist
Sensitive Information Declaration
To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including PII (Personal Identifiable Information) / PID (Personal Identifiable Data) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter.