oapi


Nameoapi JSON
Version 1.62.5 PyPI version JSON
download
home_pagehttps://github.com/enorganic/oapi
SummaryAn SDK for parsing OpenAPI (Swagger) 2.0 - 3.0 specifications
upload_time2024-02-20 18:28:45
maintainer
docs_urlNone
author
requires_python~=3.8
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # oapi

[![test](https://github.com/enorganic/oapi/actions/workflows/test.yml/badge.svg)](https://github.com/enorganic/oapi/actions/workflows/test.yml)
[![distribute](https://github.com/enorganic/oapi/actions/workflows/distribute.yml/badge.svg)](https://github.com/enorganic/oapi/actions/workflows/distribute.yml)

`oapi` is a library and CLI for authoring python data models (for clients
*or* servers), and/or client libraries, for web APIs, based on an
OpenAPI specification (both OpenAPI/Swagger [version 2](https://bit.ly/36VneDU)
and [version 3](https://bit.ly/3OHGRQV) are supported).

`oapi`-generated packages/modules differ from those generated by other tools
(including but not limited to
[swagger-codegen](https://github.com/swagger-api/swagger-codegen)) in that
`oapi` generates a data model which enforces the schemas defined
in the OpenAPI specification. This means that request and response objects
cannot comprise data types which differ from those specified in the spec,
and objects cannot have properties which are not defined. If an API
will add properties to an object which are not explicitly defined
in the schema properties, that object should have an
["additionalProperties"](https://bit.ly/3LuUlxm) attribute, in which
case `oapi` will treat these objects as dictionaries/mappings. `oapi` also
fully supports polymorphism when a schema has an "anyOf", "allOf", or
"oneOf" attribute (although `oapi` does not *require* a
[discriminator](https://bit.ly/3vPvMEW) to be defined). This design decision
could prove to be an annoyance to lazy developers of client applications, since
inaccurate OpenAPI schemas are endemic to many organizations. The author
of this library, however, asserts that end-to-end data validation is
absolutely essential for applications which are part of a critical data
pipeline. The author of this library is also of the opinion that when
encountering inaccurate OpenAPI specifications, you should fix the spec, and
if you are not the owner of the spec (and can't convince the owner to fix it),
you should script your fix in order to apply that same fix to future versions
of the specification.

Notable features of an `oapi` generated client/model library include:

- `oapi` generated data models and clients are fully type-hinted (they
   will pass inspection by `mypy`).
- `oapi` generated data models and clients adhere to PEP-8 formatting
  standards, and will pass inspection by `flake8` (with the default options).
- `oapi` generated data models and clients include docstrings for all models,
  model properties, client methods, and client method parameters, inferred
  from "description" and "summary" attributes of elements within the
  specification.
- `oapi` generated clients will handle the most common server-to-server
  authentication methods out-of-box, including the OAuth2 authorization
  code flow (client_id/client_secret), API keys, bearer tokens, HTTP basic
  auth, and most cookie-based authentication patterns. Custom authentication 
  methods are also easily accomplished by specifying custom base classes
  and/or passing initialization decorators to the `oapi client` shell
  command or to the `oapi.client.create()` function.
- `oapi` generated clients and models are easily updated. For instance: `oapi`
  generated data model classes can be renamed using your favorite IDE's
  refactoring tools, and subsequent updates to that data model (such as
  to reflect minor-version updates to the spec which add endpoints, schemas,
  parameters, etc.) will retain your new class names, so long as the
  schema from which the class was generated remains in the same location
  within the spec. Class naming can also be customized by passing a custom
  hook to the *get_class_name_from_pointer* parameter for
  `oapi.model.Module` or `oapi.model.create`.

TODO: Finish README.md

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/enorganic/oapi",
    "name": "oapi",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "~=3.8",
    "maintainer_email": "",
    "keywords": "",
    "author": "",
    "author_email": "david@belais.me",
    "download_url": "https://files.pythonhosted.org/packages/ad/e8/1c74977c5e66aa54074fb863b2a0d1c968b882ad4dbcbe8869316b6d74f6/oapi-1.62.5.tar.gz",
    "platform": null,
    "description": "# oapi\n\n[![test](https://github.com/enorganic/oapi/actions/workflows/test.yml/badge.svg)](https://github.com/enorganic/oapi/actions/workflows/test.yml)\n[![distribute](https://github.com/enorganic/oapi/actions/workflows/distribute.yml/badge.svg)](https://github.com/enorganic/oapi/actions/workflows/distribute.yml)\n\n`oapi` is a library and CLI for authoring python data models (for clients\n*or* servers), and/or client libraries, for web APIs, based on an\nOpenAPI specification (both OpenAPI/Swagger [version 2](https://bit.ly/36VneDU)\nand [version 3](https://bit.ly/3OHGRQV) are supported).\n\n`oapi`-generated packages/modules differ from those generated by other tools\n(including but not limited to\n[swagger-codegen](https://github.com/swagger-api/swagger-codegen)) in that\n`oapi` generates a data model which enforces the schemas defined\nin the OpenAPI specification. This means that request and response objects\ncannot comprise data types which differ from those specified in the spec,\nand objects cannot have properties which are not defined. If an API\nwill add properties to an object which are not explicitly defined\nin the schema properties, that object should have an\n[\"additionalProperties\"](https://bit.ly/3LuUlxm) attribute, in which\ncase `oapi` will treat these objects as dictionaries/mappings. `oapi` also\nfully supports polymorphism when a schema has an \"anyOf\", \"allOf\", or\n\"oneOf\" attribute (although `oapi` does not *require* a\n[discriminator](https://bit.ly/3vPvMEW) to be defined). This design decision\ncould prove to be an annoyance to lazy developers of client applications, since\ninaccurate OpenAPI schemas are endemic to many organizations. The author\nof this library, however, asserts that end-to-end data validation is\nabsolutely essential for applications which are part of a critical data\npipeline. The author of this library is also of the opinion that when\nencountering inaccurate OpenAPI specifications, you should fix the spec, and\nif you are not the owner of the spec (and can't convince the owner to fix it),\nyou should script your fix in order to apply that same fix to future versions\nof the specification.\n\nNotable features of an `oapi` generated client/model library include:\n\n- `oapi` generated data models and clients are fully type-hinted (they\n   will pass inspection by `mypy`).\n- `oapi` generated data models and clients adhere to PEP-8 formatting\n  standards, and will pass inspection by `flake8` (with the default options).\n- `oapi` generated data models and clients include docstrings for all models,\n  model properties, client methods, and client method parameters, inferred\n  from \"description\" and \"summary\" attributes of elements within the\n  specification.\n- `oapi` generated clients will handle the most common server-to-server\n  authentication methods out-of-box, including the OAuth2 authorization\n  code flow (client_id/client_secret), API keys, bearer tokens, HTTP basic\n  auth, and most cookie-based authentication patterns. Custom authentication \n  methods are also easily accomplished by specifying custom base classes\n  and/or passing initialization decorators to the `oapi client` shell\n  command or to the `oapi.client.create()` function.\n- `oapi` generated clients and models are easily updated. For instance: `oapi`\n  generated data model classes can be renamed using your favorite IDE's\n  refactoring tools, and subsequent updates to that data model (such as\n  to reflect minor-version updates to the spec which add endpoints, schemas,\n  parameters, etc.) will retain your new class names, so long as the\n  schema from which the class was generated remains in the same location\n  within the spec. Class naming can also be customized by passing a custom\n  hook to the *get_class_name_from_pointer* parameter for\n  `oapi.model.Module` or `oapi.model.create`.\n\nTODO: Finish README.md\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "An SDK for parsing OpenAPI (Swagger) 2.0 - 3.0 specifications",
    "version": "1.62.5",
    "project_urls": {
        "Homepage": "https://github.com/enorganic/oapi"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b4193a419ca1643b3beaf3abfa7d9e47b6fa259505345aba36dd3aa4707fc9fc",
                "md5": "744145a6e6b3cb45ba2d22ec88f5b292",
                "sha256": "d93423be5f3aae2301a53d67cd984d78d4e654916792e8d69d181ae3ff357aa5"
            },
            "downloads": -1,
            "filename": "oapi-1.62.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "744145a6e6b3cb45ba2d22ec88f5b292",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "~=3.8",
            "size": 63356,
            "upload_time": "2024-02-20T18:28:43",
            "upload_time_iso_8601": "2024-02-20T18:28:43.009435Z",
            "url": "https://files.pythonhosted.org/packages/b4/19/3a419ca1643b3beaf3abfa7d9e47b6fa259505345aba36dd3aa4707fc9fc/oapi-1.62.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ade81c74977c5e66aa54074fb863b2a0d1c968b882ad4dbcbe8869316b6d74f6",
                "md5": "cee640187c40105bc7bac2d4114654f9",
                "sha256": "533d149b0d9b675d5cbfd884de6793f833ac9b9db4419c371e94788708cc9bb6"
            },
            "downloads": -1,
            "filename": "oapi-1.62.5.tar.gz",
            "has_sig": false,
            "md5_digest": "cee640187c40105bc7bac2d4114654f9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.8",
            "size": 63215,
            "upload_time": "2024-02-20T18:28:45",
            "upload_time_iso_8601": "2024-02-20T18:28:45.957999Z",
            "url": "https://files.pythonhosted.org/packages/ad/e8/1c74977c5e66aa54074fb863b2a0d1c968b882ad4dbcbe8869316b6d74f6/oapi-1.62.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-20 18:28:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "enorganic",
    "github_project": "oapi",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "tox": true,
    "lcname": "oapi"
}
        
Elapsed time: 0.24680s