omar-dulaimi / prisma-joi-generator

Prisma 2+ generator to emit Joi schemas from your Prisma schema
MIT License
41 stars 9 forks source link

Make the path shorten #3

Closed Cyrusky closed 2 years ago

Cyrusky commented 2 years ago

Problem

The generated pathes are tooooooooo looooooong, so please shorten them.

Suggested solution

Maybe we can use a single letter to be the folder name, then give the best practice document for the definition of the folder.. just a thouths.

Cyrusky commented 2 years ago

And combine several similar functions to one file. then we do not need to import different components in the head of the file that has loooooong name.

omar-dulaimi commented 2 years ago

Hey @Cyrusky

Thanks for the great suggestion. After the implementation, here's how the imports will look:

import { PostCreateSchema, UserAggregateSchema } from '@schemas';

As you can see, all schemas will get imported using a single import statement, single line.

There will be a need for a change on your side too(I will document it in the README).

Basically, you need to add paths in your tsconfig file like this:

{
  "compilerOptions": {
    "paths": {
      "@schemas": ["./src/generated/joi"]
     }
  }
}

Would this fix your issues?

Please let me know so I could start working on it.

omar-dulaimi commented 2 years ago

Fixed in 0.1.1

Cyrusky commented 2 years ago

Thx. let me try.