A library for generating web API clients from OpenAPI documents
Project description
oapi
oapi is a library for authoring python client libraries for web APIs
based on an OpenAPI specification (both
OpenAPI/Swagger version 2
and version 3
are supported).
oapi-generated packages/modules differ from those generated by other tools
(including but not limited to
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
to be defined).
Notable features of an oapi generated client/model library include:
oapigenerated data models and clients are fully type-annotatedoapigenerated data models and clients adhere to PEP-8 formattingoapigenerated 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 specificationoapigenerated 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 tooapi.write_client_module.oapigenerated clients and models are easily updated. For instance:oapigenerated 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 foroapi.write_model_module.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file oapi-2.4.4.tar.gz.
File metadata
- Download URL: oapi-2.4.4.tar.gz
- Upload date:
- Size: 65.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cec81e0e90e92418d994cffe0cbb758758b5369cf7ce98c3005ff5db02e0a5e4
|
|
| MD5 |
a825a675d3213902e2bb25944e2fa953
|
|
| BLAKE2b-256 |
879249edbccb4cdb85b95bd4e7bf945061bf31b6d8eea027bf0f70261be38b6f
|
File details
Details for the file oapi-2.4.4-py3-none-any.whl.
File metadata
- Download URL: oapi-2.4.4-py3-none-any.whl
- Upload date:
- Size: 69.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d52a48efce84a07bd35d60b1d97a48722f4ad834f54579ac922f7f70602cc49a
|
|
| MD5 |
e64d531c27be2b7e090cb364d9428990
|
|
| BLAKE2b-256 |
3b9cccfeb4665d56f14ce3d3dc39e1d5a730b6a3198d589e110e802698dac3e1
|