Skip to content
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

upcoming: [M3-9535] - Support VPC interfaces on updated Linode Create Networking flow #11847

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
things seems to be working
bnussman committed Mar 13, 2025
commit cdc5d70dccc78b52a88bd29e2a07079997136fb7
Original file line number Diff line number Diff line change
@@ -53,6 +53,14 @@ export const getLinodeCreateResolver = (
getInterfacesPayload(values.interfaces, values.private_ip) ?? [];
}

if (!values.placement_group?.id) {
values.placement_group = undefined;
}

if (!values.metadata?.user_data) {
values.metadata = undefined;
}

const { errors } = await yupResolver(
schema,
{},
4 changes: 2 additions & 2 deletions packages/validation/src/linodes.schema.ts
Original file line number Diff line number Diff line change
@@ -700,8 +700,8 @@ export const CreateLinodeSchema = object({
test: (value) => !value || value.length === 0,
}),
}),
metadata: MetadataSchema.notRequired(),
metadata: MetadataSchema.notRequired().default(undefined),
firewall_id: number().nullable().notRequired(),
placement_group: PlacementGroupPayloadSchema.notRequired(),
placement_group: PlacementGroupPayloadSchema.notRequired().default(undefined),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not intuitive to me, but this is how I had to handle an optional object with required fields.

Let me know if there is a better way to handle this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.notRequired().nullable() maybe? (haven't tried)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue unfortunately

notRequired includes nullable already https://github.com/jquense/yup?tab=readme-ov-file#schemanotrequired-schema

Either, way it doesn't work as I expect for optional object with required fields

Screenshot 2025-03-18 at 10 55 06β€―AM

disk_encryption: DiskEncryptionSchema,
});

Unchanged files with check annotations Beta

const selectedVPC = vpcs?.find((vpc) => vpc.id === selectedVPCId);
console.log(formState.errors)

Check failure on line 37 in packages/manager/src/features/Linodes/LinodeCreate/Networking/VPC.tsx

GitHub Actions / lint (linode-manager)

Unexpected console statement
return (
<Box>