Giter Club home page Giter Club logo

jschema-to-python's Introduction

jschema-to-python

Generate Python classes from a JSON schema.

Usage

python -m jschema_to_python [-h] -s SCHEMA_PATH -o OUTPUT_DIRECTORY [-m MODULE_NAME] -r ROOT_CLASS_NAME [-g HINTS_FILE_PATH] [-f] [-v]

Generate source code for a set of Python classes from a JSON schema.

optional arguments:
  -h, --help            show this help message and exit
  -s SCHEMA_PATH, --schema-path SCHEMA_PATH
                        path to the JSON schema file
  -o OUTPUT_DIRECTORY, --output-directory OUTPUT_DIRECTORY
                        directory in which the generated classes will be
                        created
  -m MODULE_NAME, --module-name MODULE_NAME
                        name of the module containing the object model classes
  -r ROOT_CLASS_NAME, --root-class-name ROOT_CLASS_NAME
                        the name of the class at the root of the object model
                        represented by the schema
  -g HINTS_FILE_PATH, --hints-file-path HINTS_FILE_PATH
                        path to a file containing hints that control code
                        generation
  -f, --force           overwrite the output directory if it exists
  -v, --verbose         increase output verbosity (may be specified up to two
                        times)

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

jschema-to-python's People

Contributors

microsoftopensource avatar msftgits avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

jschema-to-python's Issues

Make it Python 2-compatible

Issues:

  • open(..., encoding=...) isn't supported in Python 2.
  • In Python 2, print() prints ().
  • In Python 2, dictionary keys aren't sorted by default.

Don't assume that an enum value is a string

When deciding whether to quote an enum value in an initializer, look at the first element of the enum. (It's true that enum values can be of mixed types, but then we are lost.)

Required property names are not translated from underscore_separated to camelCase

The logic in class_generator.write_class_body that generates the attr.ib() call only emits the metadata={"schema_property_name"="theProperty"} argument for optional properties. That means that to_json will not translate required properties from the underscore_separated name used in the Python binding back to the schema-defined name.

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.