Giter Site home page Giter Site logo

avanov / openapi-client-generator Goto Github PK

View Code? Open in Web Editor NEW
8.0 3.0 2.0 104 KB

Generates Python client packages from OpenAPI v3 specifications. The project aims at supporting any generic valid specification.

License: MIT License

Makefile 1.41% Python 94.22% Nix 1.05% Jinja 3.32%
openapi swagger specification typing mypy codegen http-client python3 parsing validation

openapi-client-generator's Introduction

https://github.com/avanov/openapi-client-generator/workflows/CI/badge.svg?branch=develop https://coveralls.io/repos/github/avanov/openapi-client-generator/badge.svg?branch=develop Requirements Status Documentation Status Latest PyPI Release

OpenAPI Client Generator

This CLI utility allows you to generate Python client packages from OpenAPI v3 specifications. The project aims at supporting any generic valid specification.

Features

  • works on Python 3.8 and above;
  • generates clients with type hints to aid static analysis of higher level interfaces that would use the clients;
  • supports streaming endpoints.

Installation

You can install it from PyPI:

pip install openapi-client-generator

Afterwards, use a CLI utility called openapi-client-generator:

$ openapi-client-generator --help
usage: openapi-client-generator [-h] [-V] {gen} ...

OpenAPI Client Generator

optional arguments:
  -h, --help     show this help message and exit
  -V, --version  show program's version number and exit

sub-commands:
  valid sub-commands

  {gen}          additional help
    gen          Generate client for a provided schema (JSON, YAML).

Contributing

Cloning this repo

The proper way to clone this repo is:

git clone --recurse-submodules <repo-url> <local-project-root>
cd <local-project-root>

# for showing submodule status with `git status`
git config status.submodulesummary 1

# for logging submodule diff with `git diff`
git config diff.submodule log

Test framework

The project uses Nix for bootstrapping its dev environment.

You can run existing test suite with

$ nix-shell --run "make test"

Documentation

Documentation is hosted on ReadTheDocs: https://openapi-client-generator.readthedocs.io/en/develop/

Changelog

See CHANGELOG.

LICENSE

MIT

openapi-client-generator's People

Contributors

avanov avatar ppentchev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

openapi-client-generator's Issues

UnionType import error... Type exists only in Python 3.10

Running openapi-client-generator with Python v3.8.2 generates the following error. Looks like UnionType is introduced only in Python v3.10

inno-lnx:~> openapi-client-generator --help
Traceback (most recent call last):
  File "/ws/hahamed-sjc/pyats.dev/bin/openapi-client-generator", line 5, in <module>
    from openapi_client_generator.cli import main
  File "/ws/hahamed-sjc/pyats.dev/lib/python3.8/site-packages/openapi_client_generator/cli/__init__.py", line 3, in <module>
    from .main import main
  File "/ws/hahamed-sjc/pyats.dev/lib/python3.8/site-packages/openapi_client_generator/cli/main.py", line 6, in <module>
    from . import gen
  File "/ws/hahamed-sjc/pyats.dev/lib/python3.8/site-packages/openapi_client_generator/cli/gen.py", line 9, in <module>
    from openapi_type import parse_spec
  File "/ws/hahamed-sjc/pyats.dev/lib/python3.8/site-packages/openapi_type/__init__.py", line 10, in <module>
    from .custom_types import *
  File "/ws/hahamed-sjc/pyats.dev/lib/python3.8/site-packages/openapi_type/custom_types.py", line 4, in <module>
    import typeit
  File "/ws/hahamed-sjc/pyats.dev/lib/python3.8/site-packages/typeit/__init__.py", line 4, in <module>
    from .combinator.constructor import type_constructor, TypeConstructor
  File "/ws/hahamed-sjc/pyats.dev/lib/python3.8/site-packages/typeit/combinator/constructor.py", line 12, in <module>
    from ..parser import T, decide_node_type, OverrideT
  File "/ws/hahamed-sjc/pyats.dev/lib/python3.8/site-packages/typeit/parser/__init__.py", line 1, in <module>
    from types import UnionType
ImportError: cannot import name 'UnionType' from 'types' (/auto/pysw/cel7x/python64/3.8.2/lib/python3.8/types.py)

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.