akerbeltz
akerbeltz
Explore posts from servers
TTCTheo's Typesafe Cult
Created by akerbeltz on 6/25/2024 in #questions
json schema to yup raw version
I am trying to get the raw yup object with the chaining functions from a json schema. Tried some libraries but didn't know how to get the raw yup.
const schema = {
title: "Person",
description: "A person",
type: "object",
properties: {
name: {
description: "Name of the person",
type: "string",
},
email: {
type: "string",
format: "email",
},
foobar: {
type: "string",
matches: "(foo|bar)",
},
age: {
description: "Age of person",
type: "number",
exclusiveMinimum: 0,
required: true,
},
characterType: {
enum: ["good", "bad"],
enum_titles: ["Good", "Bad"],
type: "string",
title: "Type of people",
propertyOrder: 3,
},
},
required: ["name", "email"],
};
const schema = {
title: "Person",
description: "A person",
type: "object",
properties: {
name: {
description: "Name of the person",
type: "string",
},
email: {
type: "string",
format: "email",
},
foobar: {
type: "string",
matches: "(foo|bar)",
},
age: {
description: "Age of person",
type: "number",
exclusiveMinimum: 0,
required: true,
},
characterType: {
enum: ["good", "bad"],
enum_titles: ["Good", "Bad"],
type: "string",
title: "Type of people",
propertyOrder: 3,
},
},
required: ["name", "email"],
};
From that json schema i expect to get something like this:
const schema = yup.object().shape({
name: yup.string().required(),
age: yup.number().required().positive(),
// ...
});
const schema = yup.object().shape({
name: yup.string().required(),
age: yup.number().required().positive(),
// ...
});
2 replies
TTCTheo's Typesafe Cult
Created by akerbeltz on 2/9/2024 in #questions
npm dependencies and peerDependencies
No description
2 replies
TTCTheo's Typesafe Cult
Created by akerbeltz on 11/20/2023 in #questions
virtual keyboard on mobile making scroll of the page
How can I prevent the virtual keyboard from causing the page to scroll when clicking outside of an input field? Currently, on some mobile devices, when the text field is filled and the keyboard is visible, clicking a button results in the keyboard disappearing faster than the click event can be registered. This leads to unintentional clicks on other buttons, which is quite unexpected. I've attempted various solutions without success so far. Any suggestions or code snippets are greatly appreciated.
2 replies
TTCTheo's Typesafe Cult
Created by akerbeltz on 10/4/2023 in #questions
Difference between HEAD^ and HEAD~
What's the difference in git between HEAD^ and HEAD~ ? specially in these two commands: git reset --soft HEAD~ git reset HEAD^ Also, what would be the best way to undo a commit and what would be the best way to undo a commit and a push ?
2 replies
TTCTheo's Typesafe Cult
Created by akerbeltz on 7/5/2023 in #questions
icon in mobile app
When i am on chrome and click on the Add to home screen the icon that appears is a "1" instead of the logo of my app. I have created a manifest.json the same way you would do in a react app and the meta tags of html seems ok too. Any suggestion what can i do?
2 replies
TTCTheo's Typesafe Cult
Created by akerbeltz on 6/14/2023 in #questions
Union types to solve magic strings problems
With the union types of typescript you are solving the problems of magic strings ? Or it's better to make an object?
5 replies