question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Concrete example of using standalone at runtime

See original GitHub issue

What version of Ajv you are you using? 8.8.2

What problem do you want to solve? I do not know how to use the validate_schema.js at runtime to validate the schema? The https://ajv.js.org/standalone.html

What do you think is the correct solution to problem? Update the docs or create an example somewhere that clearly distinguishes between generating the JS files and consuming them for validation.

Will you be able to implement it? Maybe if someone can give me a rough example?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
rehanvdmcommented, Jan 16, 2022

@epoberezkin I wrote that blog post =>https://www.rehanvdm.com/blog/typescript-type-safety-with-ajv-standalone of how I am now using the esm option, the TL;DR

TypeScript does a great job at compile time type safety, but we still need to do runtime checks just like in JavaScript. There are many packages and tools to help with this, we focused on AJV Standalone that outputs JS validation functions at compile time to be used at runtime. Going from TS Types to JSON Schema to JS functions allows us to validate TS Types where the other packages all work with classes and reflection.

0reactions
epoberezkincommented, Jan 16, 2022

I also added AJV to that bench marking repo, AJV is one of the fastest

Both suretype and ts-json-validator use ajv to compile JSON schemas to JavaScript, that’s why benchmarks are nearly identical (the difference is probably just a noise or maybe different ajv settings used)… Marshal does something different - it says something about Ruby types in the docs

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript Type Safety with AJV Standalone
We focus on AJV Standalone that outputs compiled JS functions to be used at runtime. Going from TS Types to JSON Schema to...
Read more >
Decide at runtime which class to call [closed] - Stack Overflow
In your example you're using "strategy" pattern. Anyway, it's not complete properly implemented because your class NotificationCoordinator ...
Read more >
standalone WebAssembly binaries using Emscripten
Using standalone mode in Emscripten. When emcc sees we only want Wasm then it makes it "standalone" - a Wasm file that can...
Read more >
Computational methods and efficiency - Brian 2 documentation
The default mode is Runtime code generation, which runs the simulation loop ... An alternative is to run Brian in with Standalone code...
Read more >
Dapr at 20,000 feet | Microsoft Learn
Dapr, or Distributed Application Runtime, is a new way to build ... Its sponsor, Microsoft, has closely partnered with customers and the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found