-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Synchronous validation #28
Comments
Sure, we can add a second validation API You want to give it a try and make a PR? |
I'll give it a go! Thanks - I just wanted to check something like that could be useful for this library. |
I have worked out a way to do what I want by using https://www.npmjs.com/package/synchronous-promise. This means that your library requires no changes to support my usecase because you already allow using a custom promise constructor. I'm not going to close this issue, as a cleaner solution would be ideal, although I won't object if you wish to. |
I was looking into implementing this but I found something unexpected so wanted to clarify. It seems that Is this an issue? Or should the PR for this maintain this behavior? |
I did look into this and that was what stopped me contributing - I thought there was some really complex infrastructure in place to make that work... |
Is there still demand for this or plans to work on this? |
Yes, so my use case is the following: Since at that point the schema and json string are already given, I would wish there was a simple synchronous |
Hi, is there any capacity to look into this issue? If I could receive some guidance I could also try to implement this in a PR. |
In some situations it is useful to support JSON where the set of required schemas is known before the validation is run. It appears to me, from my armchair (figure of speech) postulations, that the only required promises are in fetching schemas from a filesystem as decided by
SchemaRequestService
. In my case, this would be a single static schema.However, the current api still requires that such cases happen in the infectious async world, which is not always valuable. Have you got any suggestions for how I could handle this/what changes would be required to support such a use case?
If this is out of scope, I will be forced to reimplement (using the powers vested in me by ctrl-c and ctrl-v) all of the logic in this library.
Many thanks!
Further Context:
For my project https://github.com/Levertion/mcfunction-langserver, I know that the only required schema is https://github.com/Levertion/minecraft-json-schemas/blob/master/shared/minecraft_definitions.json, which doesn't reference any external files.
As this is a language server implementation requiring JSON support, I thought that
vscode-json-languageservice
would be a suitable, but as my core api is synchronous, I would require large changes just to avoid this issue.The text was updated successfully, but these errors were encountered: