Skip to content
This repository has been archived by the owner on Nov 27, 2019. It is now read-only.

First Use Help #11

Closed
MarkHerhold opened this issue Aug 28, 2017 · 5 comments
Closed

First Use Help #11

MarkHerhold opened this issue Aug 28, 2017 · 5 comments

Comments

@MarkHerhold
Copy link

MarkHerhold commented Aug 28, 2017

This project is a really great idea! I've run into some issues trying to use it for the first time though.

  1. It seems that the project needs to have joi as a dependency, not a dev dependency. Installing the module globally seems to exclude joi.
  2. It seems that ts-node is required to be installed globally. I will submit a PR to add a note to the README about this if you like.
  3. The example in the README doesn't work for me. Some additional options are now required (nullableMode, library) (what are these BTW?) and the example only outputs a definition file with some comments.

Any help/guidance is much appreciated! Thanks!

@alonp99
Copy link

alonp99 commented Nov 18, 2017

@MarkHerhold Did you find a solution for 3?

I get:
const error = new Error(message); ^ ValidationError: child "joiTsGenerator" fails because [child "nullableMode" fails because ["nullableMode" is required]]

@MarkHerhold
Copy link
Author

MarkHerhold commented Nov 19, 2017

I have not. I checked the code and found it pretty confusing as well so I wasn't able to answer my own questions. The actual goal of the module/its APIs are not clear to me because it seems to be more than just TS generation.

I'm guessing you are trying to do the same thing as me. I'm currently evaluating joi-to-swagger to see if I can generate OpenAPI docs with my Joi schema and in turn use autorest to generate TS and other classes for client libraries. I have no idea if it will actually work though. 😄

@nikcorg
Copy link
Contributor

nikcorg commented Nov 21, 2017

In your own interest, you might want to consider another library, unless it's adopted by someone else, as it's no longer used or maintained by the original author.

For your questions, you probably want to set nullableMode to be option in your config. library is an output path you need to supply.

Sample config block in your package.json:

  "joiTsGenerator": {
    "input": "./src/generatorInputs.ts",
    "nullableMode": "option",
    "outputs": {
      "library": "./src/coercion.generated.ts",
      "optics": "./src/optics",
      "types": "./src/types.generated.ts",
      "utils": "./src/utils.generated.ts"
    }
  }

@MarkHerhold
Copy link
Author

@nikcorg Could you put a warning in the README so future users know the project isn't being maintained?

@nikcorg
Copy link
Contributor

nikcorg commented Nov 21, 2017

Done.

@nikcorg nikcorg closed this as completed Nov 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants