easyjevko.js
awesome-jsonschema
easyjevko.js | awesome-jsonschema | |
---|---|---|
7 | 70 | |
0 | 101 | |
- | 4.0% | |
10.0 | 5.3 | |
over 1 year ago | 8 months ago | |
JavaScript | Handlebars | |
MIT License | Creative Commons Zero v1.0 Universal |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
easyjevko.js
- Jc – JSONifies the output of many CLI tools
-
Jevko: a minimal general-purpose syntax
Short answer: in https://github.com/jevko/easyjevko.js a thing like [ my text ] is converted to a JS string " my text " -- all whitespace is preserved.
Responding to some points I left off here https://news.ycombinator.com/item?id=33336789
I guess the main one is this:
> If your audience is people like me, I think it would probably be worthwhile for you to spend some time up front describing the intended semantics of a data model, as I've attempted above, rather than leaving people to infer it from the grammar. (Maybe OCaml is not a good way to explain it, though.) You might also want to specify that leading and trailing whitespace in prefixes is not significant, though it is in the suffix ("body"); this would enable people to format their name-value pairs readably without corrupting the data. As far as I can tell, this addendum wouldn't interfere with any of your existing uses for Jevko, though in some cases it would simplify their implementations.
You're right, things should be explained more clearly (TODO). Especially the exact role of Jevko and treatment of whitespace. I'll try to improve that.
Here is a sketch of an explanation.
Plain Jevko is meant to be a low-level syntactic layer.
It takes care of turning a unicode sequence into a tree.
On this level, all whitespace is preserved in the tree.
To represent key-value pairs and other data, you most likely want another layer above Jevko -- this would be a Jevko-based format, such as queryjevko (somewhat explained below) or, a very similar one, easyjevko, implemented and very lightly documented here: https://github.com/jevko/easyjevko.js
Or you could have a markup format, such as https://github.com/jevko/markup-experiments#asttoxml5
This format layer defines certain restrictions which may make a subset of Jevkos invalid in it.
It also specifies how to interpret the valid Jevkos. This includes the treatment of whitespace, e.g. that a leading or trailing whitespace in prefixes is insignificant, but conditionally significant in suffixes, etc.
Different formats will define different restrictions and interpretations.
For example:
# queryjevko
queryjevko is a format which uses (a variant of) Jevko as a syntax. Only a subset of Jevko is valid queryjevko.
> I think this is a more useful level of abstraction, and it's more or less the level used by, for example, queryjevko.js's jevkoToJs, although that erroneously uses () instead of [].
The `()` are used on purpose -- queryjevko is meant to be used in URL query strings and be readable. If square brackets were used, things like JS' encodeURIComponent would escape them, making the string unreadable. Using `()` solves that. "~" is used instead of "`" for the same reason. So technically we are dealing not with a spec-compliant Jevko, but a trivial variant of it. Maybe I should write a meta-spec which allows one to pick the three special characters before instantiating itself into a spec. Anyway the parser implementation is configurable in that regard, so I simply configure it to use "~()" instead of "`[]".
> (Also, contrary to your assertion above that this is an example of "leaving [Jevko's data model] as-is", it forgets the order of the name-value pairs as well as I guess all but one of any duplicate set of fields with the same name and also the possibility that there could be both fields and a body.)
I meant [whitespace] rather than [Jevko's data model].
Again, queryjevko is a format which uses Jevko as an underlying syntax. It specifies how syntax trees are converted to JS values, by restricting the range of valid Jevkos. It also specifies conversion in the opposite direction, likewise placing restrictions on JS values that can be safely converted to queryjevko.
The order of name-value pairs happens to get preserved (because of the way JS works), but that's not necessarily relevant. If I were to write a cross-language spec for queryjevko, I'd probably specify that this shouldn't be relied upon.
Duplicate fields and Jevkos with both fields and a non-whitespace body will produce an error when converting Jevko->JS.
I hope this clarifies things somewhat.
Lastly, I'll respond to this for completeness:
> (By the way, if you want to attribute your JSON example for copyright reasons, you need to attribute it to its author or authors, not to the Wikipedia, which is just the site they posted it on.)
According to this:
https://en.wikipedia.org/wiki/Wikipedia:Reusing_Wikipedia_co...
there are 3 options, one of them being what I did, which is to include a link.
I think that's all.
Have a good one!
awesome-jsonschema
- YAML or JSON files that are typed?
- Parse, Don't Validate (2019)
-
The Last Breaking Change | JSON Schema Blog
Truth. Zod is comparable to JSON Schema plus AJV, and it doesn't compare well at all. Your Zod code is all locked inside TypeScript so not only can it not be shared to any other language in your stack but it also cannot be serialized, which introduces many limitations. You also miss out on all the JSON Schema ecosystem tooling. (1, 2) For example the intellisense you get in VS Code for config files is powered by JSON Schema and schemastore.
The very first line of text below the header on the json-schema.org homepage is:
-
How to use FastAPI for microservices in Python
The framework's official website mentions a number of pros of FastAPI. In my opinion, the most useful features from a microservice perspective are: the simplicity of code (easy to use and avoid boilerplate), high operational capacity thanks to Starlette and Pydantic and compatibility with industry standards - OpenAPI and JSON Schema.
-
How to handle forms in a good way?
I've used Felte to reduce form boilerplate. Felte supports several different validation libraries like Zod. I actually used a custom validation function with ajv (which uses JSON schema).
-
A Brief Defense of XML
(There is already a JSON Schema definition at https://json-schema.org/)
Like you said - standard XML isn't terrible. Adding on an XSD isn't terrible, because now you can enforce structure and datatypes on files provided by outside parties. Creating an XSLT is much more of a mental challenge, and probably should be left to tools to define.
Anything beyond those technologies is someone polishing up their resume.
-
On the seventh day of Enhancing: Forms
While the aws-sdk is being installed to simulate DynamoDB locally, let me explain a few things about this command. First Comment will be the name of the model the scaffold creates. This model will be codified under app/models/schemas/comment.mjs as a JSON Schema object. Each of the parameters after Comment will be split into a property name and type (e.g. property name “subject”, property type “string”). This JSON Schema document will be used to validate the form data both on the client and server sides.
-
Server Sent UI Schema Driven UIs
What you are looking is called Json-schema. Have a look at the implementations page, which will give you an idea of what you can do with json-schema, which also includes UI rendering.
- Tool to document Firestore 'schema'
What are some alternatives?
easyjevko.lua - An Easy Jevko library for Lua.
zod - TypeScript-first schema validation with static type inference
yapl - YAml Programming Language
ajv - The fastest JSON schema Validator. Supports JSON Schema draft-04/06/07/2019-09/2020-12 and JSON Type Definition (RFC8927)
binary-experiments - Experiments with various binary formats based on Jevko.
JSON-Schema Faker - JSON-Schema + fake data generators
community - Features Jevko-related things created by various authors
fastify-swagger - Swagger documentation generator for Fastify
pydantic - Data validation using Python type hints
Superstruct - A simple and composable way to validate data in JavaScript (and TypeScript).
datree - Prevent Kubernetes misconfigurations from reaching production (again 😤 )! From code to cloud, Datree provides an E2E policy enforcement solution to run automatic checks for rule violations. See our docs: https://hub.datree.io
flasgger - Easy OpenAPI specs and Swagger UI for your Flask API