perenecabuto / json_schema_generator Goto Github PK
View Code? Open in Web Editor NEWA simple json schema generator from any json source
License: MIT License
A simple json schema generator from any json source
License: MIT License
In my json decoder, I usually use json.loads(json_str, object_pairs_hook=OrderedDict)
, so that key-ordering is preserved. But the json_schema_generator does not support this:
json_schema_generator.schema_types.JsonSchemaTypeNotFound: There is no schema type for <class 'collections.OrderedDict'>.
Suggestion: Make it more obvious that this requires something other than Python 3.x , or fix to make it work with Python 3.x .
Background: Since this is a relatively new module, I thought that it would be best to install Python 3.x (with pip and virtualenv) and run it with that. On a Mac, at least for a Python noob such as myself, that is something of a pain. I got a syntax error when trying to run this under Python 3.x . It works fine under the default Mac Python 2.7. At this time, I don't have time to reproduce that error.
It would be good to have a quick start example in the project README.
First of all thank you for the awesome tool! It is indeed very useful!
Currently when one reverse engineers the JSON Schema from the JSON - the required attribute is always set to true - this is in the generator.py file in the to_dict method - the schema_dict["required"] is hard coded to True.
It would be good if a command line option could be offered to to control this property - so users can generate schemas with all properties required or all not required.
Thank you!
I am new in python. I don't know how to solve this.
I am trying to execute the following command
python jsonschema_generator.py record example_movie.json schema_movie.json_schema
But I am getting the following error.
Traceback (most recent call last):
File "jsonschema_generator.py", line 9, in
import json_schema_generator
ImportError: No module named json_schema_generator
I executed the above command after navigating in bin folder. Please help me out
In the example in the readme for this project, it appears as though the required properties are specified in the JSON schema by a required
boolean property on each and every property which is required.
{
"type": "object",
"properties": {
"name": { "type": "string", "required": true },
"email": { "type": "string", "required": true },
"address": { "type": "string" },
"telephone": { "type": "string" }
}
}
However, the JSON schema specification indicates required properties are specified in the JSON schema by a required
array on the parent that includes all child properties which are required.
{
"type": "object",
"properties": {
"name": { "type": "string" },
"email": { "type": "string" },
"address": { "type": "string" },
"telephone": { "type": "string" }
},
"required": ["name", "email"]
}
Please correct me if this is a mistake. Maybe this is a difference with previous versions of the JSON Schema specification?
I see a reference to the license in the setup.py - but it would be in the interest of adoption that a License.txt file be added explicitly in the package clearly stating the license the code is available under.
The version uploaded to PyPI (0.3
) still doesn't run in Python 3.
It would be great to have the latest version in PyPI as well, so we can use it in other libraries.
Can someone with the proper access do python setup.py dist upload
? :)
PS: I can help to setup Travis to release to PyPI whenever there is a new tag, if you'd like that.
Current behaviour:
Please elaborate on that issue so that it is clear before implementation
Acceptance Criteria ?
additional information:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.