Comments (5)
Addition: not just for porting, but for reusing schema between languages.
from strictyaml.
Hi @worldmind
I have a documentation page on why I don't define schemas in YAML : https://hitchdev.com/strictyaml/why/turing-complete-schema/
I do think that the base should be ported to other languages - the ability to parse mappings, sequences and strings (multiline and single line) but I'd be happy to see other languages implement their own schema language - or even not have a schema at all (strictyaml technically doesn't need a schema).
As far as I'm concerned the "data format" of StrictYAML and the schema validation are entirely separate entities. The former is very simple (kind of like JSON) while the latter is pretty complex and evolving and probably won't translate all that well away from python.
I also think that it's a good idea to make a jsonschema -> StrictYAML validator converter (the other way is not possible). I started a project last year where you could input a jsonschema and get a valid strictyaml schema object out ( https://github.com/hitchdev/strictyamljsonschema ) but I lost steam - partly because I don't have a use for such a thing myself. I'd love to see it exist, to aid it and promote it though.
from strictyaml.
Yes, JSONSchema it's a beautiful way.
probably won't translate all that well away from python
Maybe I misunderstood something, you says that some data structures can't be implemented in other languages?
from strictyaml.
No, I think that they can but I can't see a way of creating a language independent schema without sacrificing flexibility and/or strictness. For instance in strictyaml you can:
- Revalidate whole portions of the document based upon what is in other portions of the document (there's an example of this in the revalidation docs).
- Easily pull in external data (e.g. a frequently updated list of country codes, time zones and international dial codes) from externally managed sources and use them to validate.
- Create custom validators that use custom logic - e.g. create a Hong Kong ID card validator based upon the standard ID card validation algorithm.
- Create a custom validator/typecaster that uses the python-slugify package (I use this one a lot).
A framework to do all of this requires the validation to be done with turing complete code. It's basically not possible with JSON schema (at least, not without using nasty hacks).
Personally I have found the above kind of flexibility to be absolutely vital for the purposes I have used strictyaml for while portability of schemas across programming languages simply isn't a requirement I've ever had.
You could duplicate the way it's done in some other languages and so the schemas look very similar (and perhaps share names - like map and mappattern) but they'd still look substantially different in the end.
If other languages do implement their own version of strictyaml (and I very much hope that they do) I'd ideally like to see them follow a similar pattern for similar reasons. Turing complete schemas are underrated IMHO. I'd be somewhat less fussed about them being consistent with strictyaml (e.g. if the javascript version had a MapPattern but called it something else I think that'd be okay).
from strictyaml.
Thank for explanation, sorry I miss https://hitchdev.com/strictyaml/why/turing-complete-schema/
I suppose that will be great if you make link to this page from main page for example by adding new item in priorities list, may be something like "Data schema is Python code because flexibility is matter, details here".
from strictyaml.
Related Issues (20)
- Problem loading document with a single string
- Repeated revalidate() raises Invalid state HOT 2
- Failed revalidation leads to inconsistant state
- Fasjo HOT 3
- Website fails to acknowledge that the Norway problem was fixed in YAML 1.2 HOT 2
- strictyaml does not act as "a near-drop in replacement for pyyaml" HOT 4
- The type order of optional arguments affects the results HOT 2
- Date vs Datetime HOT 2
- Support python2.7.18 HOT 2
- 1.7.0 is broken (cannot import name 'ruamel' from partially initialized module 'strictyaml') HOT 5
- Map containing only Optionals does not validate an empty dict HOT 1
- as_document and load have dissimilar results for CommaSeparated(Int())
- Doesn't Work At All For Lists / Arrays? HOT 4
- New lines after comment line causes `NotImplementedError`
- Feature request/Question: "Optionalize" maps HOT 1
- Thoughts regarding case-sensitivity of keys HOT 6
- Why not: non-Turing complete configuration languages
- Cannot iterate on emtpy list
- BUG: MapCombined documentation different traceback
- Feature: strictyaml.scalar.Time
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from strictyaml.