oapi


Nameoapi JSON
Version 2.4.4 PyPI version JSON
download
home_pageNone
SummaryA library for generating web API clients from OpenAPI documents
upload_time2025-09-05 18:35:11
maintainerNone
docs_urlNone
authorNone
requires_python~=3.9
licenseNone
keywords openapi
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?branch=main)](https://github.com/enorganic/oapi/actions/workflows/test.yml)
[![PyPI version](https://badge.fury.io/py/oapi.svg?icon=si%3Apython)](https://badge.fury.io/py/oapi)

`oapi` is a library for authoring python client libraries for web APIs
based on an OpenAPI specification (both
OpenAPI/Swagger [version 2
](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md)
and [version 3
](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md)
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,
and their properties/items/members, cannot comprise data types which differ
from those specified in their OpenAPI document. Additionally, request and
response objects can be validated using `sob.validate` to verify that they
were not parsed from an object having attributes *not* defined in the
element's JSON schema, and *have* all required attributes. `oapi`
fully supports polymorphism when a schema has an "anyOf", "allOf", or
"oneOf" attribute (although `oapi` does not *require* a [discriminator
](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#discriminator-object)
to be defined).

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

- `oapi` generated data models and clients are fully type-annotated
- `oapi` generated data models and clients adhere to PEP-8 formatting
- `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 `oapi.write_client_module`.
- `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.write_model_module`.
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "oapi",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "~=3.9",
    "maintainer_email": null,
    "keywords": "OpenAPI",
    "author": null,
    "author_email": "david@belais.me",
    "download_url": "https://files.pythonhosted.org/packages/87/92/49edbccb4cdb85b95bd4e7bf945061bf31b6d8eea027bf0f70261be38b6f/oapi-2.4.4.tar.gz",
    "platform": null,
    "description": "# oapi\n\n[![test](https://github.com/enorganic/oapi/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/enorganic/oapi/actions/workflows/test.yml)\n[![PyPI version](https://badge.fury.io/py/oapi.svg?icon=si%3Apython)](https://badge.fury.io/py/oapi)\n\n`oapi` is a library for authoring python client libraries for web APIs\nbased on an OpenAPI specification (both\nOpenAPI/Swagger [version 2\n](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md)\nand [version 3\n](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md)\nare 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,\nand their properties/items/members, cannot comprise data types which differ\nfrom those specified in their OpenAPI document. Additionally, request and\nresponse objects can be validated using `sob.validate` to verify that they\nwere not parsed from an object having attributes *not* defined in the\nelement's JSON schema, and *have* all required attributes. `oapi`\nfully supports polymorphism when a schema has an \"anyOf\", \"allOf\", or\n\"oneOf\" attribute (although `oapi` does not *require* a [discriminator\n](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#discriminator-object)\nto be defined).\n\nNotable features of an `oapi` generated client/model library include:\n\n- `oapi` generated data models and clients are fully type-annotated\n- `oapi` generated data models and clients adhere to PEP-8 formatting\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 `oapi.write_client_module`.\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.write_model_module`.",
    "bugtrack_url": null,
    "license": null,
    "summary": "A library for generating web API clients from OpenAPI documents",
    "version": "2.4.4",
    "project_urls": {
        "Documentation": "https://oapi.enorganic.org",
        "Repository": "https://github.com/enorganic/oapi"
    },
    "split_keywords": [
        "openapi"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "3b9cccfeb4665d56f14ce3d3dc39e1d5a730b6a3198d589e110e802698dac3e1",
                "md5": "e64d531c27be2b7e090cb364d9428990",
                "sha256": "d52a48efce84a07bd35d60b1d97a48722f4ad834f54579ac922f7f70602cc49a"
            },
            "downloads": -1,
            "filename": "oapi-2.4.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e64d531c27be2b7e090cb364d9428990",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "~=3.9",
            "size": 69769,
            "upload_time": "2025-09-05T18:35:12",
            "upload_time_iso_8601": "2025-09-05T18:35:12.583735Z",
            "url": "https://files.pythonhosted.org/packages/3b/9c/ccfeb4665d56f14ce3d3dc39e1d5a730b6a3198d589e110e802698dac3e1/oapi-2.4.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "879249edbccb4cdb85b95bd4e7bf945061bf31b6d8eea027bf0f70261be38b6f",
                "md5": "a825a675d3213902e2bb25944e2fa953",
                "sha256": "cec81e0e90e92418d994cffe0cbb758758b5369cf7ce98c3005ff5db02e0a5e4"
            },
            "downloads": -1,
            "filename": "oapi-2.4.4.tar.gz",
            "has_sig": false,
            "md5_digest": "a825a675d3213902e2bb25944e2fa953",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.9",
            "size": 65584,
            "upload_time": "2025-09-05T18:35:11",
            "upload_time_iso_8601": "2025-09-05T18:35:11.066064Z",
            "url": "https://files.pythonhosted.org/packages/87/92/49edbccb4cdb85b95bd4e7bf945061bf31b6d8eea027bf0f70261be38b6f/oapi-2.4.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-05 18:35:11",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "enorganic",
    "github_project": "oapi",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "oapi"
}
        
Elapsed time: 3.81123s