Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -1861,7 +1861,7 @@ private String asTypeConstraint(PythonImports imports, boolean withAnnotations)

if (fieldParams.size() > 0) {
imports.add(PYDANTIC, "Field");
imports.add("typing_extensions", "Annotated");
imports.add("typing", "Annotated");
currentType = "Annotated[" + currentType + ", Field(" + StringUtils.join(fieldParams, ", ") + ")]";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ To be able to use it, you will need these dependencies in your own package that
* pycryptodome >= 3.9.0
{{/hasHttpSignatureMethods}}
* pydantic >= 2.11
* typing-extensions >= 4.7.1

## Getting Started

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import json
{{/x-python-has-json-header}}
import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated
from typing import Annotated, Any, Dict, List, Optional, Tuple, Union

{{#imports}}
{{import}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ import multiprocessing
import ssl
{{/async}}
import sys
from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict, Union
from typing import Any, ClassVar, Dict, List, Literal, NotRequired, Optional, Self, TypedDict, Union
{{^async}}
from urllib.parse import urlparse
from urllib.request import getproxies
{{/async}}
from typing_extensions import NotRequired, Self

{{^async}}
import urllib3
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{{>partial_header}}

from typing import Any, Optional
from typing_extensions import Self
from typing import Any, Optional, Self

class OpenApiException(Exception):
"""The base exception class for all OpenAPIExceptions"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import re # noqa: F401
{{#vendorExtensions.x-py-model-imports}}
{{{.}}}
{{/vendorExtensions.x-py-model-imports}}
from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
from typing_extensions import Literal, Self
from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict, Literal, Self
from pydantic import Field
{{#compatibleWithPythonLegacy}}
from pydantic_core import to_jsonable_python
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ from enum import Enum
{{#vendorExtensions.x-py-other-imports}}
{{{.}}}
{{/vendorExtensions.x-py-other-imports}}
from typing_extensions import Self
from typing import Self


class {{classname}}({{vendorExtensions.x-py-enum-type}}, Enum):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import json
{{#vendorExtensions.x-py-model-imports}}
{{{.}}}
{{/vendorExtensions.x-py-model-imports}}
from typing import Optional, Set
from typing_extensions import Self
from typing import Optional, Set, Self
from pydantic_core import to_jsonable_python
{{#vendorExtensions.x-py-has-public-name-properties}}
from typing import TYPE_CHECKING
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import pprint
{{{.}}}
{{/vendorExtensions.x-py-model-imports}}
from pydantic import StrictStr, Field
from typing import Union, List, Set, Optional, Dict
from typing_extensions import Literal, Self
from typing import Union, List, Set, Optional, Dict, Literal, Self
{{#compatibleWithPythonLegacy}}
from pydantic_core import to_jsonable_python

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ pem = ">= 19.3.0"
pycryptodome = ">= 3.9.0"
{{/hasHttpSignatureMethods}}
pydantic = ">= 2.11"
typing-extensions = ">= 4.7.1"
{{/poetry1}}
{{^poetry1}}
requires-python = ">=3.11"
Expand All @@ -82,7 +81,6 @@ dependencies = [
"pycryptodome (>=3.9.0)",
{{/hasHttpSignatureMethods}}
"pydantic (>=2.11)",
"typing-extensions (>=4.7.1)",
]

[project.urls]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ pem >= 19.3.0
pycryptodome >= 3.9.0
{{/hasHttpSignatureMethods}}
pydantic >= 2.11
typing-extensions >= 4.7.1
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ REQUIRES = [
"pycryptodome >= 3.9.0",
{{/hasHttpSignatureMethods}}
"pydantic >= 2.11",
"typing-extensions >= 4.7.1",
]

setup(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@

import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated
from typing import Annotated, Any, Dict, List, Optional, Tuple, Union

from pydantic import StrictStr

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@

import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated
from typing import Annotated, Any, Dict, List, Optional, Tuple, Union

from pydantic import Field, StrictBytes, StrictStr
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated
from typing import Annotated, Any, Dict, List, Optional, Tuple, Union
from openapi_client.models.pet import Pet
from openapi_client.models.string_enum_ref import StringEnumRef
from openapi_client.models.tag import Tag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@

import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated
from typing import Annotated, Any, Dict, List, Optional, Tuple, Union

from pydantic import StrictBool, StrictInt, StrictStr
from typing import Optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@

import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated
from typing import Annotated, Any, Dict, List, Optional, Tuple, Union

from pydantic import StrictBool, StrictInt, StrictStr, field_validator
from typing import Optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@

import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated
from typing import Annotated, Any, Dict, List, Optional, Tuple, Union

from pydantic import StrictInt, StrictStr, field_validator
from openapi_client.models.string_enum_ref import StringEnumRef
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@

import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated
from typing import Annotated, Any, Dict, List, Optional, Tuple, Union

from datetime import date, datetime
from pydantic import StrictBool, StrictInt, StrictStr, field_validator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@
import multiprocessing
import ssl
import sys
from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict, Union
from typing import Any, ClassVar, Dict, List, Literal, NotRequired, Optional, Self, TypedDict, Union
from urllib.parse import urlparse
from urllib.request import getproxies
from typing_extensions import NotRequired, Self

import urllib3

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
""" # noqa: E501


from typing import Any, Optional
from typing_extensions import Self
from typing import Any, Optional, Self

class OpenApiException(Exception):
"""The base exception class for all OpenAPIExceptions"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@

from pydantic import BaseModel, ConfigDict, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
from typing import Optional, Set, Self
from pydantic_core import to_jsonable_python

class Bird(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@

from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
from typing import Optional, Set, Self
from pydantic_core import to_jsonable_python

class Category(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
from pydantic import ConfigDict, Field, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from openapi_client.models.query import Query
from typing import Optional, Set
from typing_extensions import Self
from typing import Optional, Set, Self
from pydantic_core import to_jsonable_python

class DataQuery(Query):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr, field_validator
from typing import Any, ClassVar, Dict, List, Optional
from openapi_client.models.string_enum_ref import StringEnumRef
from typing import Optional, Set
from typing_extensions import Self
from typing import Optional, Set, Self
from pydantic_core import to_jsonable_python

class DefaultValue(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@
import json

from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt
from typing import Any, ClassVar, Dict, List, Optional, Union
from typing_extensions import Annotated
from typing import Optional, Set
from typing_extensions import Self
from typing import Annotated, Any, ClassVar, Dict, List, Optional, Union
from typing import Optional, Set, Self
from pydantic_core import to_jsonable_python

class NumberPropertiesOnly(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
from typing import Any, ClassVar, Dict, List, Optional
from openapi_client.models.category import Category
from openapi_client.models.tag import Tag
from typing import Optional, Set
from typing_extensions import Self
from typing import Optional, Set, Self
from pydantic_core import to_jsonable_python

class Pet(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@

from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
from typing import Optional, Set, Self
from pydantic_core import to_jsonable_python

class Query(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from __future__ import annotations
import json
from enum import Enum
from typing_extensions import Self
from typing import Self


class StringEnumRef(str, Enum):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@

from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
from typing import Optional, Set, Self
from pydantic_core import to_jsonable_python

class Tag(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@

from pydantic import BaseModel, ConfigDict, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
from typing import Optional, Set, Self
from pydantic_core import to_jsonable_python

class TestFormObjectMultipartRequestMarker(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@

from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
from typing import Optional, Set, Self
from pydantic_core import to_jsonable_python

class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@

from pydantic import BaseModel, StrictInt
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
from typing import Optional, Set, Self

class TestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter(BaseModel):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@

from pydantic import BaseModel, ConfigDict, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
from typing import Optional, Set, Self
from pydantic_core import to_jsonable_python

class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ dependencies = [
"urllib3 (>=2.7.0,<3.0.0)",
"python-dateutil (>=2.8.2)",
"pydantic (>=2.11)",
"typing-extensions (>=4.7.1)",
Comment thread
cubic-dev-ai[bot] marked this conversation as resolved.
Resolved
]

[project.urls]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
urllib3 >= 2.7.0, < 3.0.0
python_dateutil >= 2.8.2
pydantic >= 2.11
typing-extensions >= 4.7.1
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"urllib3 >= 2.7.0, < 3.0.0",
"python-dateutil >= 2.8.2",
"pydantic >= 2.11",
"typing-extensions >= 4.7.1",
]

setup(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@

import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated
from typing import Annotated, Any, Dict, List, Optional, Tuple, Union

from pydantic import StrictStr

Expand Down
6 changes: 2 additions & 4 deletions samples/client/echo_api/python/openapi_client/api/body_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@

import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated
from typing import Annotated, Any, Dict, List, Optional, Tuple, Union

from pydantic import Field, StrictBytes, StrictStr
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated
from typing import Annotated, Any, Dict, List, Optional, Tuple, Union
from openapi_client.models.pet import Pet
from openapi_client.models.string_enum_ref import StringEnumRef
from openapi_client.models.tag import Tag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@

import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated
from typing import Annotated, Any, Dict, List, Optional, Tuple, Union

from pydantic import StrictBool, StrictInt, StrictStr
from typing import Optional
Expand Down
Loading
Loading