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

Bump yup from 0.32.11 to 1.3.3 in /frontend #7113

Merged
merged 2 commits into from
Jan 8, 2024

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Dec 17, 2023

Bumps yup from 0.32.11 to 1.3.3.

Release notes

Sourced from yup's releases.

v1 Because I finally got around to it

jquense/yup#1906

v1.0.0-beta.7

Fixes published artifacts for the main field

v1.0.0-beta.5 - partial fixes and cast migration path

Beta 5 fixes partial and deepPartial making it work correctly with lazy schema. Specifically the optionality is added after lazy is evaluated but before any other when conditions are added. This makes it consistent with other conditional schema, where runtime conditions always supersede previous schema configuration. This allows for optional overrides if necessary.

const person = object({
  name: string().required(),
  age: number().required(),
  legalGuardian:  string().when('age', {
    is: (age) => age != null && age < 18,
    then: (schema) => schema.required(),
  }),
});
const optionalPerson = person.partial()
person.cast({name: 'James', age: 6 }) // => TypeError legalGuardian required
// age is still required b/c it's applied after the partial
optionalPerson.cast({name: 'James',  age: 6 }) // => TypeError legalGuardian required

This works slightly differently for lazy which have no schema to "start" with:

const config = object({
  nameOrIdNumber:  lazy((value) => {
     if (typeof value === 'number') return number().required()
     return string().required()
  }),
});
const opti = config.partial()
config.cast({}) // => TypeError nameOrIdNumber is required
config.partial().cast({}) // => {}

Cast optionality migration path

A larger breaking change in v1 is the assertion of optionality during cast, making previous patterns like string().nullable().required() no longer possible. Generally this pattern is used when deserialized data is not valid to start, but will become valid through user input such as with an HTML form. v1 no longer allows this, but in order to make migration easier we've added an option to cast that mimics the previous behavior (not exactly but closely).

const name = string().required()
</tr></table> 

... (truncated)

Changelog

Sourced from yup's changelog.

1.3.3 (2023-12-14)

Bug Fixes

  • addMethod: allow Schema without making TypeScript upset (f921fe6)

1.3.2 (2023-09-29)

Bug Fixes

1.3.1 (2023-09-26)

Bug Fixes

  • ValidationError extends Error (bc5121b)

1.3.0 (2023-09-23)

Bug Fixes

Features

  • Allow schema metadata to be strongly typed (#2021) (e593f8f)

Reverts

... (truncated)

Commits

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

@dependabot dependabot bot added dependencies Pull requests that update a dependency file javascript Pull requests that update Javascript code labels Dec 17, 2023
@dependabot dependabot bot requested review from a team, emyl3, fzhao99 and alismx and removed request for a team December 17, 2023 15:56
@emyl3
Copy link
Collaborator

emyl3 commented Dec 18, 2023

@dependabot rebase

@dependabot dependabot bot force-pushed the dependabot/npm_and_yarn/frontend/yup-1.3.3 branch from 04c5169 to 8eff0f3 Compare December 18, 2023 23:26
@emyl3 emyl3 self-assigned this Dec 19, 2023
@emyl3
Copy link
Collaborator

emyl3 commented Dec 19, 2023

lots of breaking changes with this major version bump -- I will work on getting this fixed up :)

@emyl3
Copy link
Collaborator

emyl3 commented Dec 22, 2023

Still work-in-progress! need to smoke test forms

@emyl3 emyl3 added the Blocked label Dec 22, 2023
@emyl3 emyl3 force-pushed the dependabot/npm_and_yarn/frontend/yup-1.3.3 branch 2 times, most recently from 494af8e to d6aa002 Compare December 29, 2023 18:50
@emyl3 emyl3 force-pushed the dependabot/npm_and_yarn/frontend/yup-1.3.3 branch 2 times, most recently from 3bd8810 to 245d0e3 Compare December 30, 2023 00:50
@@ -92,13 +92,15 @@ export const initOrgErrors = (): Record<
workPhoneNumber: "",
});

export const organizationSchema: yup.SchemaOf<OrganizationCreateRequest> = yup
.object()
.shape({
Copy link
Collaborator

Choose a reason for hiding this comment

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

@@ -15,17 +11,3 @@ export interface EditOrgMutationResponse {
editPendingOrganization: string;
};
}

const phoneNumberIsValidOrEmpty = (input: any) =>
Copy link
Collaborator

Choose a reason for hiding this comment

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

⚠️ not using this anywhere

@@ -25,7 +25,8 @@ const phoneUtil = PhoneNumberUtil.getInstance();
const MAX_LENGTH = 256;
const NOTES_MAX_LENGTH = 10000;

type TranslatedSchema<T> = (t: TFunction) => yup.SchemaOf<T>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

@emyl3
Copy link
Collaborator

emyl3 commented Jan 2, 2024

This is ready for review! Deployed on dev7

@emyl3 emyl3 removed their assignment Jan 3, 2024
mpbrown
mpbrown previously approved these changes Jan 4, 2024
Copy link
Collaborator

@mpbrown mpbrown left a comment

Choose a reason for hiding this comment

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

Tested out on dev7 and overall everything seems good!

dependabot bot and others added 2 commits January 4, 2024 19:51
Bumps [yup](https://github.com/jquense/yup) from 0.32.11 to 1.3.3.
- [Release notes](https://github.com/jquense/yup/releases)
- [Changelog](https://github.com/jquense/yup/blob/master/CHANGELOG.md)
- [Commits](jquense/yup@v0.32.11...v1.3.3)

---
updated-dependencies:
- dependency-name: yup
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
@emyl3 emyl3 force-pushed the dependabot/npm_and_yarn/frontend/yup-1.3.3 branch from 245d0e3 to 4d6aff5 Compare January 5, 2024 02:17
Copy link

sonarqubecloud bot commented Jan 5, 2024

Quality Gate Failed Quality Gate failed

Failed conditions

76.5% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

@fzhao99 fzhao99 added this pull request to the merge queue Jan 8, 2024
Merged via the queue into main with commit fc31f4b Jan 8, 2024
40 of 41 checks passed
@fzhao99 fzhao99 deleted the dependabot/npm_and_yarn/frontend/yup-1.3.3 branch January 8, 2024 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Blocked dependencies Pull requests that update a dependency file javascript Pull requests that update Javascript code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants