Skip to content

Commit

Permalink
fix type number in schema (#20068)
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Reuter authored Dec 6, 2022
1 parent 2b045a9 commit f1c9d8d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions airbyte-webapp/src/core/jsonSchema/schemaToYup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ it("should build schema for conditional case", () => {
start_date: {
type: "string",
},
max_objects: {
type: "number",
},
credentials: {
type: "object",
oneOf: [
Expand Down Expand Up @@ -104,6 +107,7 @@ it("should build schema for conditional case", () => {

const expectedSchema = yup.object().shape({
start_date: yup.string().trim().required("form.empty.error").transform(String),
max_objects: yup.number().transform((x) => x),
credentials: yup.object().shape({
api_key: yup.string().trim().required("form.empty.error").transform(String),
}),
Expand Down
1 change: 1 addition & 0 deletions airbyte-webapp/src/core/jsonSchema/schemaToYup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export const buildYupFormForJsonSchema = (
schema = yup.boolean();
break;
case "integer":
case "number":
schema = yup.number().transform((value) => (isNaN(value) ? undefined : value));

if (jsonSchema?.minimum !== undefined) {
Expand Down

0 comments on commit f1c9d8d

Please sign in to comment.