Metadata-Version: 2.4
Name: oas-client
Version: 0.1.7
Summary: Generate typed python client from OpenAPI specification
Author-email: Pradish Bijukchhe <pradish@sandbox.com.np>
License: Copyright (c) 2025 Pradish Bijukchhe
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/sandbox-pokhara/oas-client
Project-URL: Issues, https://github.com/sandbox-pokhara/oas-client/issues
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx>=0.22.0
Requires-Dist: jinja2>=2.11.3
Requires-Dist: typing-extensions>=4.7.1
Provides-Extra: pre-commit
Requires-Dist: pre-commit; extra == "pre-commit"
Dynamic: license-file

# oas-client

Generate typed python client from OpenAPI specification

## Installation

You can install the package via pip:

```
pip install oas-client
```

## Usage

Use this command to generate client.

```
oas-client <path_or_url>
```

To use the generate client,

```py
from client.client import APIClient

client = APIClient(
    base_url="https://api.example.com",
    headers={
        "Authorization": "Bearer MY_SECRET_TOKEN",
    },
    # supports all configurations from httpx.Client
)
print(
    client.core_api_list_servers(
        follow_redirects=False,
        timeout=10,
        # supports all configurations from httpx request
    )
)

```

## Why not pydantic?

Request bodies are meant to support partial data, especially in `PATCH` requests, which is not supported by `pydantic` model. So, we use `TypedDict` with `NotRequired` modifier.

```py
class PartialUpdateAccountSchema(TypedDict):
    email: NotRequired[str]
    address: NotRequired[str]
    country: NotRequired[str]
    dob: NotRequired[str]
```

## Why duplicate schemas in requests.py and responses.py?

There is a possibility of duplicate schemas for request body and reponse body because `NotRequired` modifier is necessary for only request body and is not relevant for respose body.

## Limitations

- Only supports OAS 3
- No aysnc support

## License

This project is licensed under the terms of the MIT license.
