Labels with spaces produce invalid type names
See original GitHub issueWith this schema:
export const RegisterAccountParams = Joi.object({
name: Joi.string()
.label("Company Name")
.required(),
phoneNumber: Joi.string()
.label("Company Phone Number")
.required(),
customerEmail: Joi.string()
.label("Customer Email")
.required(),
website: Joi.string()
.label("Website")
});
this output is generated:
/**
* This file was automatically generated by joi-to-typescript
* Do not modify this file manually
*/
import { Customer Email, Company Name, Company Phone Number, Website } from '.';
export interface RegisterAccountParams {
customerEmail: Customer Email;
name: Company Name;
phoneNumber: Company Phone Number;
website?: Website;
}
The import statement is clearly incorrect. It seems to me that joi-to-typescript takes label
to mean that we’re referencing another named exported schema, which is not our intention.
Labels are handy for customizing the error messages that Joi throws on validation failures. Is there a way that this behaviour might be made configurable, or perhaps default to ignoring label
modifiers on object properties?
To be clear, we expect an output similar to this one:
export interface RegisterAccountParams {
customerEmail: string;
name: string;
phoneNumber: string;
website?: string;
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Unable to use tag names containing multiple spaces | Jira Cloud
I'm facing the same issue with 'Labels' field. Error: The label 'social gallery' contains spaces which is invalid. Kindly Resolve @kerrod.williams.
Read more >cross referencing - Are LaTeX's label names case-sensitive ...
Can the name contain spaces? I'm asking because when using Vim's snipmate TeX snippet, if I type sec and hit tab, I automatically...
Read more >How to deal with spaces in column names? - Stack Overflow
Use the make.names() function to create safe names; this is used by R too to create identifiers (eg by using underscores for spaces...
Read more >How to Troubleshoot and Fix Excel Pivot Table Errors
How to troubleshoot and fix Excel pivot table errors, such as PivotTable field name is not valid. Find the problem, and fix it....
Read more >How to write SQL queries with spaces in column names
Let us understand the concept with some examples. Space in the database object name. Suppose we want to create a table named Employee...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Cheers dude, I’ll get this released
Hi @AverageHelper if you are interested in doing a Merge Request I can look at your idea further.