Git Product home page Git Product logo

Comments (9)

aeschli avatar aeschli commented on July 23, 2024 1

Thanks @azeemba, you are correct, there's a bug. I fixed it with a72b1c0

from vscode-json-languageservice.

aeschli avatar aeschli commented on July 23, 2024

Sure, we can add a second validation API doValidate2 that requires a schema and is sync.

You want to give it a try and make a PR?

from vscode-json-languageservice.

Levertion avatar Levertion commented on July 23, 2024

I'll give it a go! Thanks - I just wanted to check something like that could be useful for this library.

from vscode-json-languageservice.

Levertion avatar Levertion commented on July 23, 2024

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.

from vscode-json-languageservice.

azeemba avatar azeemba commented on July 23, 2024

I was looking into implementing this but I found something unexpected so wanted to clarify. It seems that getDiagnostics can be either called with a JSONSchema or a ResolvedSchema.
Since the former doesn't have a .error field, I am not sure how this line isn't erroring out.

Is this an issue? Or should the PR for this maintain this behavior?

from vscode-json-languageservice.

Levertion avatar Levertion commented on July 23, 2024

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...

from vscode-json-languageservice.

aeschli avatar aeschli commented on July 23, 2024

Is there still demand for this or plans to work on this?

from vscode-json-languageservice.

my-tien avatar my-tien commented on July 23, 2024

Yes, so my use case is the following:
We have a monaco editor in which we do JSON validation against a given schema and additionally we want to log the diagnostics somewhere. Since the monaco editor doesnโ€™t support simply reading out the diagnostics, we are forced to actually validate the same string again with vscode-json-languageservice.

Since at that point the schema and json string are already given, I would wish there was a simple synchronous validate(json, schema) and in my naive thinking this could be called by doValidation internally?

from vscode-json-languageservice.

my-tien avatar my-tien commented on July 23, 2024

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.

from vscode-json-languageservice.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.