-
Notifications
You must be signed in to change notification settings - Fork 0
(node:46891) UnhandledPromiseRejectionWarning: Error: Not found #30
Comments
I renamed the files to have the |
@cyberixae thanks for reporting it! Would it be possible to open a PR and add the failing schema to the examples folder https://github.com/OrKoN/schema-script/tree/master/examples? Otherwise, I will try to take a look as soon as I can. I suspect that the schema you use references some other schema which is missing. |
The error seems to be caused by the reference |
The target file can be found at https://github.com/maasglobal/maas-schemas/blob/develop/schemas/core/components/units.json |
@cyberixae I checked the case and, yeah, it won't work with the current implementation. Currently, schema-script requires a model per JSON schema and the support for the JSON schema references is limited. If you'd like to try to solve this problem, I had some thoughts:
So to summarize, only JSON schema patterns you see in the examples folder are supported. If you'd like to contribute improvements, I will be happy. |
I was looking to utilize https://github.com/APIDevTools/json-schema-ref-parser to resolve $ref but didn't have time to learn it |
Getting this issue resolved is not a high priority for me at the moment. I only need a few fields so typing them by hand is not a problem. However, schema-script might be a nice solution at some point if the amount of types we are using increases. |
Have you considered replacing the test schemas with an existing schema examples package? Maybe https://github.com/json-schema-org/JSON-Schema-Test-Suite It seems to be available as an npm package. Perhaps it would be possible to skip tests that are not passing at the moment. It would be interesting to know how many test cases are passing/failing at the moment. |
That would be interesting but, honestly, I won't have time for it at the moment. I am open for contributions though :-) Btw, you could try https://quicktype.io/, https://github.com/bcherny/json-schema-to-typescript These are some alternatives that I know. |
Ok. No problem. It's good to have alternatives, although I would imagine schema-script is the only tool that generates io-ts types in addition to static typing. |
I started drafting a conversion utility that targets the specific features set that we have in maas-schemas code base. The code lives at https://github.com/maasglobal/maas-schemas-ts/blob/master/converter.ts for the time being. |
I moved the tool into a separate package. See https://www.npmjs.com/package/io-ts-from-json-schema |
I'm getting a crash while running schema-script against schemas from
maas-schemas
npm packageThe text was updated successfully, but these errors were encountered: