[python] fix #23032 add sync httpx support#23044
[python] fix #23032 add sync httpx support#23044soapun wants to merge 4 commits intoOpenAPITools:masterfrom
Conversation
There was a problem hiding this comment.
40 issues found across 402 files
Note: This PR contains a large number of files. cubic only reviews up to 75 files per PR, so some files may not have been reviewed.
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="modules/openapi-generator/src/main/resources/python/api_client.mustache">
<violation number="1" location="modules/openapi-generator/src/main/resources/python/api_client.mustache:107">
P2: ApiClient.__exit__ now calls rest_client.close() in sync mode, but the default synchronous RESTClientObject (urllib3 template) does not implement close(), causing AttributeError when using ApiClient as a context manager.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/FormatTest.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/FormatTest.md:36">
P2: Docs call `to_json` on the class, but `to_json` is an instance method; this example will fail with a missing `self` error and won’t serialize the created instance.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/HealthCheckResult.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/HealthCheckResult.md:21">
P2: Documentation example calls to_json as a class method, but to_json is an instance method; the example should use the created instance.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/FirstRef.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/FirstRef.md:21">
P2: Example calls to_json as a class method; to_json is an instance method, so the snippet will fail. Use the instance created from from_json().</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/AdditionalPropertiesAnyType.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/AdditionalPropertiesAnyType.md:20">
P2: Example calls to_json on the class, but to_json is an instance method; the example should call it on the created instance.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/InnerDictWithProperty.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/InnerDictWithProperty.md:20">
P2: Documentation example calls `to_json()` on the class rather than the created instance, but `to_json` is an instance method. This will raise a missing `self` error if copied.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/FooGetDefaultResponse.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/FooGetDefaultResponse.md:20">
P2: Example calls to_json on the class instead of the instance, which will raise a TypeError because to_json is an instance method.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/Category.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/Category.md:21">
P2: The example calls to_json() on the class, but to_json is an instance method; this call will fail and should use category_instance.to_json().</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/Feeding.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/Feeding.md:22">
P2: Documentation calls Feeding.to_json() as a class method, but to_json is an instance method. This will raise a missing self TypeError; use feeding_instance.to_json().</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/ListClass.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/ListClass.md:20">
P2: Documentation calls `to_json` on the class, but `to_json` is an instance method. This example will fail at runtime and should call the instance instead.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/Client.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/Client.md:20">
P2: Client.to_json() is an instance method in the generated model, but the documentation example calls it as a class method, which will raise a TypeError. Use the instance instead.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/DiscriminatorAllOfSuper.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/DiscriminatorAllOfSuper.md:20">
P2: The doc example calls `to_json` on the class, but `to_json` is an instance method in the generated model. This will raise a `TypeError` and fails to serialize the created instance.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/Creature.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/Creature.md:21">
P2: Documentation calls `Creature.to_json()` on the class even though `to_json` is an instance method; this will raise a missing `self` error and misleads usage. Use the created instance instead.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/BaseDiscriminator.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/BaseDiscriminator.md:20">
P2: Doc example calls BaseDiscriminator.to_json() as a class method, but to_json is an instance method. This example will fail or mislead users; call it on base_discriminator_instance instead.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/DeprecatedObject.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/DeprecatedObject.md:20">
P2: Documentation example calls `to_json` as a class method, but `to_json` is an instance method on `DeprecatedObject`, so the sample would fail at runtime.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/AnyOfColor.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/AnyOfColor.md:20">
P2: Doc example calls AnyOfColor.to_json() as a class method, but to_json is an instance method on AnyOfColor. This will raise a TypeError and does not serialize the created instance.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/HuntingDog.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/HuntingDog.md:20">
P2: Example calls `to_json` on the class even though `to_json` is an instance method, which will raise a TypeError at runtime; it should be called on `hunting_dog_instance`.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/DummyModel.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/DummyModel.md:21">
P2: The example calls `DummyModel.to_json()` on the class, but `to_json` is an instance method. This will fail or mislead users; call it on `dummy_model_instance` instead.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/Animal.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/Animal.md:21">
P2: The doc example calls to_json on the Animal class, but to_json is an instance method. This will raise a TypeError for missing self; use the instance instead.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/File.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/File.md:21">
P2: Docs example calls File.to_json() on the class, but to_json is an instance method; this will raise a TypeError and should be called on file_instance.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/ArrayOfNumberOnly.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/ArrayOfNumberOnly.md:20">
P2: Docs example calls `to_json()` on the class, but the generated model defines `to_json` as an instance method. This example will raise a TypeError/mislead users; use the instance instead.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/AdditionalPropertiesObject.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/AdditionalPropertiesObject.md:20">
P2: Documentation calls `to_json()` on the class, but the generated model defines `to_json` as an instance method. This example will fail or mislead users; it should call `additional_properties_object_instance.to_json()`.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/ClassModel.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/ClassModel.md:21">
P2: Documentation example calls to_json as a class method, but ClassModel.to_json is an instance method. This would fail or not serialize the created instance.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/AdditionalPropertiesWithDescriptionOnly.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/AdditionalPropertiesWithDescriptionOnly.md:20">
P2: Doc example calls to_json on the class, but to_json is an instance method; this will error or produce incorrect output.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/CreatureInfo.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/CreatureInfo.md:20">
P2: Docs example calls `CreatureInfo.to_json()` as a class method, but `to_json` is an instance method, so this usage will fail and mislead users. Use the created instance instead.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/FileSchemaTestClass.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/FileSchemaTestClass.md:21">
P2: The example calls to_json on the class instead of the instance returned by from_json, which will raise a TypeError because to_json is an instance method.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/EnumRefWithDefaultValue.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/EnumRefWithDefaultValue.md:20">
P2: Documentation example calls to_json() on the class, but to_json is an instance method; this will raise a TypeError when copied.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/BasquePig.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/BasquePig.md:21">
P2: Docs example calls to_json on the class, but to_json is an instance method; this will error and won’t serialize the created instance.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/FakeApi.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/FakeApi.md:134">
P2: The example uses invalid Python syntax for the enum value (`enum_ref = -efg`). `EnumClass` defines the value as the string `'-efg'`, so this should be `EnumClass.MINUS_EFG` (or "-efg") to be valid code.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/Bathing.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/Bathing.md:22">
P2: Documentation calls Bathing.to_json() as a class method, but to_json is an instance method; this example will raise a TypeError and mislead users.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/Foo.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/Foo.md:20">
P2: Documentation calls `Foo.to_json()` on the class even though `to_json` is an instance method; this would raise a missing `self` error and misleads usage. Call `foo_instance.to_json()` instead.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/CircularReferenceModel.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/CircularReferenceModel.md:21">
P2: Documentation calls `to_json` as a class method, but `to_json` is an instance method. The example should serialize the created instance.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/HasOnlyReadOnly.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/HasOnlyReadOnly.md:21">
P2: The example calls `to_json` on the class, but `to_json` is an instance method. This will raise a TypeError and misleads users; call it on the created instance instead.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/ArrayTest.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/ArrayTest.md:23">
P2: Documentation example calls `to_json()` on the class instead of the instance, which will raise a `TypeError` because `to_json` is an instance method. The example should call `array_test_instance.to_json()`.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/EnumTest.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/EnumTest.md:32">
P2: Example calls EnumTest.to_json() as a class method, but to_json is an instance method; this will fail or serialize incorrectly. Use the instance created from JSON.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/DiscriminatorAllOfSub.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/DiscriminatorAllOfSub.md:19">
P3: The example calls `to_json` on the class instead of the instance. `to_json` is an instance method, so this call is invalid and the example will fail or mislead users.</violation>
</file>
<file name=".github/workflows/samples-python-petstore.yaml">
<violation number="1" location=".github/workflows/samples-python-petstore.yaml:38">
P2: The new python-httpx-sync sample is included in the test matrix but missing from the pull_request path filters, so changes limited to that directory won’t trigger CI for this workflow.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/Dog.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/Dog.md:20">
P2: Dog.to_json() is an instance method; calling it on the class in the example will raise a missing-self TypeError and mislead users. Use dog_instance.to_json() instead.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/FakeClassnameTags123Api.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/FakeClassnameTags123Api.md:39">
P2: Example snippet uses `os.environ` without importing `os`, causing NameError if copied.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/CircularAllOfRef.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/CircularAllOfRef.md:21">
P2: Example calls to_json on the class, but to_json is an instance method; this will raise a TypeError. Use the created instance instead.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Add one-off context when rerunning by tagging
@cubic-dev-aiwith guidance or docs links (includingllms.txt) - Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| self.close() | ||
|
|
||
| def close(self): | ||
| self.rest_client.close() |
There was a problem hiding this comment.
P2: ApiClient.exit now calls rest_client.close() in sync mode, but the default synchronous RESTClientObject (urllib3 template) does not implement close(), causing AttributeError when using ApiClient as a context manager.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At modules/openapi-generator/src/main/resources/python/api_client.mustache, line 107:
<comment>ApiClient.__exit__ now calls rest_client.close() in sync mode, but the default synchronous RESTClientObject (urllib3 template) does not implement close(), causing AttributeError when using ApiClient as a context manager.</comment>
<file context>
@@ -101,7 +101,10 @@ class ApiClient:
+ self.close()
+
+ def close(self):
+ self.rest_client.close()
{{/async}}
</file context>
| # create an instance of FormatTest from a JSON string | ||
| format_test_instance = FormatTest.from_json(json) | ||
| # print the JSON string representation of the object | ||
| print(FormatTest.to_json()) |
There was a problem hiding this comment.
P2: Docs call to_json on the class, but to_json is an instance method; this example will fail with a missing self error and won’t serialize the created instance.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/openapi3/client/petstore/python-httpx-sync/docs/FormatTest.md, line 36:
<comment>Docs call `to_json` on the class, but `to_json` is an instance method; this example will fail with a missing `self` error and won’t serialize the created instance.</comment>
<file context>
@@ -0,0 +1,45 @@
+# create an instance of FormatTest from a JSON string
+format_test_instance = FormatTest.from_json(json)
+# print the JSON string representation of the object
+print(FormatTest.to_json())
+
+# convert the object into a dict
</file context>
There was a problem hiding this comment.
I can do separate pr with fix of this line, since it requires samples regeneration for all "python" generator libraries
| # create an instance of HealthCheckResult from a JSON string | ||
| health_check_result_instance = HealthCheckResult.from_json(json) | ||
| # print the JSON string representation of the object | ||
| print(HealthCheckResult.to_json()) |
There was a problem hiding this comment.
P2: Documentation example calls to_json as a class method, but to_json is an instance method; the example should use the created instance.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/openapi3/client/petstore/python-httpx-sync/docs/HealthCheckResult.md, line 21:
<comment>Documentation example calls to_json as a class method, but to_json is an instance method; the example should use the created instance.</comment>
<file context>
@@ -0,0 +1,30 @@
+# create an instance of HealthCheckResult from a JSON string
+health_check_result_instance = HealthCheckResult.from_json(json)
+# print the JSON string representation of the object
+print(HealthCheckResult.to_json())
+
+# convert the object into a dict
</file context>
| # create an instance of FirstRef from a JSON string | ||
| first_ref_instance = FirstRef.from_json(json) | ||
| # print the JSON string representation of the object | ||
| print(FirstRef.to_json()) |
There was a problem hiding this comment.
P2: Example calls to_json as a class method; to_json is an instance method, so the snippet will fail. Use the instance created from from_json().
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/openapi3/client/petstore/python-httpx-sync/docs/FirstRef.md, line 21:
<comment>Example calls to_json as a class method; to_json is an instance method, so the snippet will fail. Use the instance created from from_json().</comment>
<file context>
@@ -0,0 +1,30 @@
+# create an instance of FirstRef from a JSON string
+first_ref_instance = FirstRef.from_json(json)
+# print the JSON string representation of the object
+print(FirstRef.to_json())
+
+# convert the object into a dict
</file context>
| # create an instance of AdditionalPropertiesAnyType from a JSON string | ||
| additional_properties_any_type_instance = AdditionalPropertiesAnyType.from_json(json) | ||
| # print the JSON string representation of the object | ||
| print(AdditionalPropertiesAnyType.to_json()) |
There was a problem hiding this comment.
P2: Example calls to_json on the class, but to_json is an instance method; the example should call it on the created instance.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/openapi3/client/petstore/python-httpx-sync/docs/AdditionalPropertiesAnyType.md, line 20:
<comment>Example calls to_json on the class, but to_json is an instance method; the example should call it on the created instance.</comment>
<file context>
@@ -0,0 +1,29 @@
+# create an instance of AdditionalPropertiesAnyType from a JSON string
+additional_properties_any_type_instance = AdditionalPropertiesAnyType.from_json(json)
+# print the JSON string representation of the object
+print(AdditionalPropertiesAnyType.to_json())
+
+# convert the object into a dict
</file context>
| sample: | ||
| - samples/openapi3/client/petstore/python-aiohttp | ||
| - samples/openapi3/client/petstore/python-httpx | ||
| - samples/openapi3/client/petstore/python-httpx-sync |
There was a problem hiding this comment.
P2: The new python-httpx-sync sample is included in the test matrix but missing from the pull_request path filters, so changes limited to that directory won’t trigger CI for this workflow.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/samples-python-petstore.yaml, line 38:
<comment>The new python-httpx-sync sample is included in the test matrix but missing from the pull_request path filters, so changes limited to that directory won’t trigger CI for this workflow.</comment>
<file context>
@@ -35,6 +35,7 @@ jobs:
sample:
- samples/openapi3/client/petstore/python-aiohttp
- samples/openapi3/client/petstore/python-httpx
+ - samples/openapi3/client/petstore/python-httpx-sync
- samples/openapi3/client/petstore/python
- samples/openapi3/client/petstore/python-lazyImports
</file context>
| # create an instance of Dog from a JSON string | ||
| dog_instance = Dog.from_json(json) | ||
| # print the JSON string representation of the object | ||
| print(Dog.to_json()) |
There was a problem hiding this comment.
P2: Dog.to_json() is an instance method; calling it on the class in the example will raise a missing-self TypeError and mislead users. Use dog_instance.to_json() instead.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/openapi3/client/petstore/python-httpx-sync/docs/Dog.md, line 20:
<comment>Dog.to_json() is an instance method; calling it on the class in the example will raise a missing-self TypeError and mislead users. Use dog_instance.to_json() instead.</comment>
<file context>
@@ -0,0 +1,29 @@
+# create an instance of Dog from a JSON string
+dog_instance = Dog.from_json(json)
+# print the JSON string representation of the object
+print(Dog.to_json())
+
+# convert the object into a dict
</file context>
| # satisfies your auth use case. | ||
|
|
||
| # Configure API key authorization: api_key_query | ||
| configuration.api_key['api_key_query'] = os.environ["API_KEY"] |
There was a problem hiding this comment.
P2: Example snippet uses os.environ without importing os, causing NameError if copied.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/openapi3/client/petstore/python-httpx-sync/docs/FakeClassnameTags123Api.md, line 39:
<comment>Example snippet uses `os.environ` without importing `os`, causing NameError if copied.</comment>
<file context>
@@ -0,0 +1,88 @@
+# satisfies your auth use case.
+
+# Configure API key authorization: api_key_query
+configuration.api_key['api_key_query'] = os.environ["API_KEY"]
+
+# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
</file context>
| # create an instance of CircularAllOfRef from a JSON string | ||
| circular_all_of_ref_instance = CircularAllOfRef.from_json(json) | ||
| # print the JSON string representation of the object | ||
| print(CircularAllOfRef.to_json()) |
There was a problem hiding this comment.
P2: Example calls to_json on the class, but to_json is an instance method; this will raise a TypeError. Use the created instance instead.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/openapi3/client/petstore/python-httpx-sync/docs/CircularAllOfRef.md, line 21:
<comment>Example calls to_json on the class, but to_json is an instance method; this will raise a TypeError. Use the created instance instead.</comment>
<file context>
@@ -0,0 +1,30 @@
+# create an instance of CircularAllOfRef from a JSON string
+circular_all_of_ref_instance = CircularAllOfRef.from_json(json)
+# print the JSON string representation of the object
+print(CircularAllOfRef.to_json())
+
+# convert the object into a dict
</file context>
| # create an instance of DiscriminatorAllOfSub from a JSON string | ||
| discriminator_all_of_sub_instance = DiscriminatorAllOfSub.from_json(json) | ||
| # print the JSON string representation of the object | ||
| print(DiscriminatorAllOfSub.to_json()) |
There was a problem hiding this comment.
P3: The example calls to_json on the class instead of the instance. to_json is an instance method, so this call is invalid and the example will fail or mislead users.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/openapi3/client/petstore/python-httpx-sync/docs/DiscriminatorAllOfSub.md, line 19:
<comment>The example calls `to_json` on the class instead of the instance. `to_json` is an instance method, so this call is invalid and the example will fail or mislead users.</comment>
<file context>
@@ -0,0 +1,28 @@
+# create an instance of DiscriminatorAllOfSub from a JSON string
+discriminator_all_of_sub_instance = DiscriminatorAllOfSub.from_json(json)
+# print the JSON string representation of the object
+print(DiscriminatorAllOfSub.to_json())
+
+# convert the object into a dict
</file context>
There was a problem hiding this comment.
40 issues found across 402 files
Note: This PR contains a large number of files. cubic only reviews up to 75 files per PR, so some files may not have been reviewed.
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="modules/openapi-generator/src/main/resources/python/api_client.mustache">
<violation number="1" location="modules/openapi-generator/src/main/resources/python/api_client.mustache:107">
P2: ApiClient.__exit__ now calls rest_client.close() in sync mode, but the default synchronous RESTClientObject (urllib3 template) does not implement close(), causing AttributeError when using ApiClient as a context manager.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/FormatTest.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/FormatTest.md:36">
P2: Docs call `to_json` on the class, but `to_json` is an instance method; this example will fail with a missing `self` error and won’t serialize the created instance.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/HealthCheckResult.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/HealthCheckResult.md:21">
P2: Documentation example calls to_json as a class method, but to_json is an instance method; the example should use the created instance.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/FirstRef.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/FirstRef.md:21">
P2: Example calls to_json as a class method; to_json is an instance method, so the snippet will fail. Use the instance created from from_json().</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/AdditionalPropertiesAnyType.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/AdditionalPropertiesAnyType.md:20">
P2: Example calls to_json on the class, but to_json is an instance method; the example should call it on the created instance.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/InnerDictWithProperty.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/InnerDictWithProperty.md:20">
P2: Documentation example calls `to_json()` on the class rather than the created instance, but `to_json` is an instance method. This will raise a missing `self` error if copied.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/FooGetDefaultResponse.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/FooGetDefaultResponse.md:20">
P2: Example calls to_json on the class instead of the instance, which will raise a TypeError because to_json is an instance method.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/Category.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/Category.md:21">
P2: The example calls to_json() on the class, but to_json is an instance method; this call will fail and should use category_instance.to_json().</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/Feeding.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/Feeding.md:22">
P2: Documentation calls Feeding.to_json() as a class method, but to_json is an instance method. This will raise a missing self TypeError; use feeding_instance.to_json().</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/ListClass.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/ListClass.md:20">
P2: Documentation calls `to_json` on the class, but `to_json` is an instance method. This example will fail at runtime and should call the instance instead.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/Client.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/Client.md:20">
P2: Client.to_json() is an instance method in the generated model, but the documentation example calls it as a class method, which will raise a TypeError. Use the instance instead.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/DiscriminatorAllOfSuper.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/DiscriminatorAllOfSuper.md:20">
P2: The doc example calls `to_json` on the class, but `to_json` is an instance method in the generated model. This will raise a `TypeError` and fails to serialize the created instance.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/Creature.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/Creature.md:21">
P2: Documentation calls `Creature.to_json()` on the class even though `to_json` is an instance method; this will raise a missing `self` error and misleads usage. Use the created instance instead.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/BaseDiscriminator.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/BaseDiscriminator.md:20">
P2: Doc example calls BaseDiscriminator.to_json() as a class method, but to_json is an instance method. This example will fail or mislead users; call it on base_discriminator_instance instead.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/DeprecatedObject.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/DeprecatedObject.md:20">
P2: Documentation example calls `to_json` as a class method, but `to_json` is an instance method on `DeprecatedObject`, so the sample would fail at runtime.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/AnyOfColor.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/AnyOfColor.md:20">
P2: Doc example calls AnyOfColor.to_json() as a class method, but to_json is an instance method on AnyOfColor. This will raise a TypeError and does not serialize the created instance.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/HuntingDog.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/HuntingDog.md:20">
P2: Example calls `to_json` on the class even though `to_json` is an instance method, which will raise a TypeError at runtime; it should be called on `hunting_dog_instance`.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/DummyModel.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/DummyModel.md:21">
P2: The example calls `DummyModel.to_json()` on the class, but `to_json` is an instance method. This will fail or mislead users; call it on `dummy_model_instance` instead.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/Animal.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/Animal.md:21">
P2: The doc example calls to_json on the Animal class, but to_json is an instance method. This will raise a TypeError for missing self; use the instance instead.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/File.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/File.md:21">
P2: Docs example calls File.to_json() on the class, but to_json is an instance method; this will raise a TypeError and should be called on file_instance.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/ArrayOfNumberOnly.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/ArrayOfNumberOnly.md:20">
P2: Docs example calls `to_json()` on the class, but the generated model defines `to_json` as an instance method. This example will raise a TypeError/mislead users; use the instance instead.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/AdditionalPropertiesObject.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/AdditionalPropertiesObject.md:20">
P2: Documentation calls `to_json()` on the class, but the generated model defines `to_json` as an instance method. This example will fail or mislead users; it should call `additional_properties_object_instance.to_json()`.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/ClassModel.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/ClassModel.md:21">
P2: Documentation example calls to_json as a class method, but ClassModel.to_json is an instance method. This would fail or not serialize the created instance.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/AdditionalPropertiesWithDescriptionOnly.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/AdditionalPropertiesWithDescriptionOnly.md:20">
P2: Doc example calls to_json on the class, but to_json is an instance method; this will error or produce incorrect output.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/CreatureInfo.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/CreatureInfo.md:20">
P2: Docs example calls `CreatureInfo.to_json()` as a class method, but `to_json` is an instance method, so this usage will fail and mislead users. Use the created instance instead.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/FileSchemaTestClass.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/FileSchemaTestClass.md:21">
P2: The example calls to_json on the class instead of the instance returned by from_json, which will raise a TypeError because to_json is an instance method.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/EnumRefWithDefaultValue.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/EnumRefWithDefaultValue.md:20">
P2: Documentation example calls to_json() on the class, but to_json is an instance method; this will raise a TypeError when copied.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/BasquePig.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/BasquePig.md:21">
P2: Docs example calls to_json on the class, but to_json is an instance method; this will error and won’t serialize the created instance.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/FakeApi.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/FakeApi.md:134">
P2: The example uses invalid Python syntax for the enum value (`enum_ref = -efg`). `EnumClass` defines the value as the string `'-efg'`, so this should be `EnumClass.MINUS_EFG` (or "-efg") to be valid code.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/Bathing.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/Bathing.md:22">
P2: Documentation calls Bathing.to_json() as a class method, but to_json is an instance method; this example will raise a TypeError and mislead users.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/Foo.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/Foo.md:20">
P2: Documentation calls `Foo.to_json()` on the class even though `to_json` is an instance method; this would raise a missing `self` error and misleads usage. Call `foo_instance.to_json()` instead.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/CircularReferenceModel.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/CircularReferenceModel.md:21">
P2: Documentation calls `to_json` as a class method, but `to_json` is an instance method. The example should serialize the created instance.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/HasOnlyReadOnly.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/HasOnlyReadOnly.md:21">
P2: The example calls `to_json` on the class, but `to_json` is an instance method. This will raise a TypeError and misleads users; call it on the created instance instead.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/ArrayTest.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/ArrayTest.md:23">
P2: Documentation example calls `to_json()` on the class instead of the instance, which will raise a `TypeError` because `to_json` is an instance method. The example should call `array_test_instance.to_json()`.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/EnumTest.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/EnumTest.md:32">
P2: Example calls EnumTest.to_json() as a class method, but to_json is an instance method; this will fail or serialize incorrectly. Use the instance created from JSON.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/DiscriminatorAllOfSub.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/DiscriminatorAllOfSub.md:19">
P3: The example calls `to_json` on the class instead of the instance. `to_json` is an instance method, so this call is invalid and the example will fail or mislead users.</violation>
</file>
<file name=".github/workflows/samples-python-petstore.yaml">
<violation number="1" location=".github/workflows/samples-python-petstore.yaml:38">
P2: The new python-httpx-sync sample is included in the test matrix but missing from the pull_request path filters, so changes limited to that directory won’t trigger CI for this workflow.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/Dog.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/Dog.md:20">
P2: Dog.to_json() is an instance method; calling it on the class in the example will raise a missing-self TypeError and mislead users. Use dog_instance.to_json() instead.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/FakeClassnameTags123Api.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/FakeClassnameTags123Api.md:39">
P2: Example snippet uses `os.environ` without importing `os`, causing NameError if copied.</violation>
</file>
<file name="samples/openapi3/client/petstore/python-httpx-sync/docs/CircularAllOfRef.md">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/docs/CircularAllOfRef.md:21">
P2: Example calls to_json on the class, but to_json is an instance method; this will raise a TypeError. Use the created instance instead.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Add one-off context when rerunning by tagging
@cubic-dev-aiwith guidance or docs links (includingllms.txt) - Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| self.close() | ||
|
|
||
| def close(self): | ||
| self.rest_client.close() |
There was a problem hiding this comment.
P2: ApiClient.exit now calls rest_client.close() in sync mode, but the default synchronous RESTClientObject (urllib3 template) does not implement close(), causing AttributeError when using ApiClient as a context manager.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At modules/openapi-generator/src/main/resources/python/api_client.mustache, line 107:
<comment>ApiClient.__exit__ now calls rest_client.close() in sync mode, but the default synchronous RESTClientObject (urllib3 template) does not implement close(), causing AttributeError when using ApiClient as a context manager.</comment>
<file context>
@@ -101,7 +101,10 @@ class ApiClient:
+ self.close()
+
+ def close(self):
+ self.rest_client.close()
{{/async}}
</file context>
| # create an instance of FormatTest from a JSON string | ||
| format_test_instance = FormatTest.from_json(json) | ||
| # print the JSON string representation of the object | ||
| print(FormatTest.to_json()) |
There was a problem hiding this comment.
P2: Docs call to_json on the class, but to_json is an instance method; this example will fail with a missing self error and won’t serialize the created instance.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/openapi3/client/petstore/python-httpx-sync/docs/FormatTest.md, line 36:
<comment>Docs call `to_json` on the class, but `to_json` is an instance method; this example will fail with a missing `self` error and won’t serialize the created instance.</comment>
<file context>
@@ -0,0 +1,45 @@
+# create an instance of FormatTest from a JSON string
+format_test_instance = FormatTest.from_json(json)
+# print the JSON string representation of the object
+print(FormatTest.to_json())
+
+# convert the object into a dict
</file context>
| # create an instance of HealthCheckResult from a JSON string | ||
| health_check_result_instance = HealthCheckResult.from_json(json) | ||
| # print the JSON string representation of the object | ||
| print(HealthCheckResult.to_json()) |
There was a problem hiding this comment.
P2: Documentation example calls to_json as a class method, but to_json is an instance method; the example should use the created instance.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/openapi3/client/petstore/python-httpx-sync/docs/HealthCheckResult.md, line 21:
<comment>Documentation example calls to_json as a class method, but to_json is an instance method; the example should use the created instance.</comment>
<file context>
@@ -0,0 +1,30 @@
+# create an instance of HealthCheckResult from a JSON string
+health_check_result_instance = HealthCheckResult.from_json(json)
+# print the JSON string representation of the object
+print(HealthCheckResult.to_json())
+
+# convert the object into a dict
</file context>
| # create an instance of FirstRef from a JSON string | ||
| first_ref_instance = FirstRef.from_json(json) | ||
| # print the JSON string representation of the object | ||
| print(FirstRef.to_json()) |
There was a problem hiding this comment.
P2: Example calls to_json as a class method; to_json is an instance method, so the snippet will fail. Use the instance created from from_json().
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/openapi3/client/petstore/python-httpx-sync/docs/FirstRef.md, line 21:
<comment>Example calls to_json as a class method; to_json is an instance method, so the snippet will fail. Use the instance created from from_json().</comment>
<file context>
@@ -0,0 +1,30 @@
+# create an instance of FirstRef from a JSON string
+first_ref_instance = FirstRef.from_json(json)
+# print the JSON string representation of the object
+print(FirstRef.to_json())
+
+# convert the object into a dict
</file context>
| # create an instance of AdditionalPropertiesAnyType from a JSON string | ||
| additional_properties_any_type_instance = AdditionalPropertiesAnyType.from_json(json) | ||
| # print the JSON string representation of the object | ||
| print(AdditionalPropertiesAnyType.to_json()) |
There was a problem hiding this comment.
P2: Example calls to_json on the class, but to_json is an instance method; the example should call it on the created instance.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/openapi3/client/petstore/python-httpx-sync/docs/AdditionalPropertiesAnyType.md, line 20:
<comment>Example calls to_json on the class, but to_json is an instance method; the example should call it on the created instance.</comment>
<file context>
@@ -0,0 +1,29 @@
+# create an instance of AdditionalPropertiesAnyType from a JSON string
+additional_properties_any_type_instance = AdditionalPropertiesAnyType.from_json(json)
+# print the JSON string representation of the object
+print(AdditionalPropertiesAnyType.to_json())
+
+# convert the object into a dict
</file context>
| sample: | ||
| - samples/openapi3/client/petstore/python-aiohttp | ||
| - samples/openapi3/client/petstore/python-httpx | ||
| - samples/openapi3/client/petstore/python-httpx-sync |
There was a problem hiding this comment.
P2: The new python-httpx-sync sample is included in the test matrix but missing from the pull_request path filters, so changes limited to that directory won’t trigger CI for this workflow.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/samples-python-petstore.yaml, line 38:
<comment>The new python-httpx-sync sample is included in the test matrix but missing from the pull_request path filters, so changes limited to that directory won’t trigger CI for this workflow.</comment>
<file context>
@@ -35,6 +35,7 @@ jobs:
sample:
- samples/openapi3/client/petstore/python-aiohttp
- samples/openapi3/client/petstore/python-httpx
+ - samples/openapi3/client/petstore/python-httpx-sync
- samples/openapi3/client/petstore/python
- samples/openapi3/client/petstore/python-lazyImports
</file context>
| # create an instance of Dog from a JSON string | ||
| dog_instance = Dog.from_json(json) | ||
| # print the JSON string representation of the object | ||
| print(Dog.to_json()) |
There was a problem hiding this comment.
P2: Dog.to_json() is an instance method; calling it on the class in the example will raise a missing-self TypeError and mislead users. Use dog_instance.to_json() instead.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/openapi3/client/petstore/python-httpx-sync/docs/Dog.md, line 20:
<comment>Dog.to_json() is an instance method; calling it on the class in the example will raise a missing-self TypeError and mislead users. Use dog_instance.to_json() instead.</comment>
<file context>
@@ -0,0 +1,29 @@
+# create an instance of Dog from a JSON string
+dog_instance = Dog.from_json(json)
+# print the JSON string representation of the object
+print(Dog.to_json())
+
+# convert the object into a dict
</file context>
| # satisfies your auth use case. | ||
|
|
||
| # Configure API key authorization: api_key_query | ||
| configuration.api_key['api_key_query'] = os.environ["API_KEY"] |
There was a problem hiding this comment.
P2: Example snippet uses os.environ without importing os, causing NameError if copied.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/openapi3/client/petstore/python-httpx-sync/docs/FakeClassnameTags123Api.md, line 39:
<comment>Example snippet uses `os.environ` without importing `os`, causing NameError if copied.</comment>
<file context>
@@ -0,0 +1,88 @@
+# satisfies your auth use case.
+
+# Configure API key authorization: api_key_query
+configuration.api_key['api_key_query'] = os.environ["API_KEY"]
+
+# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
</file context>
| # create an instance of CircularAllOfRef from a JSON string | ||
| circular_all_of_ref_instance = CircularAllOfRef.from_json(json) | ||
| # print the JSON string representation of the object | ||
| print(CircularAllOfRef.to_json()) |
There was a problem hiding this comment.
P2: Example calls to_json on the class, but to_json is an instance method; this will raise a TypeError. Use the created instance instead.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/openapi3/client/petstore/python-httpx-sync/docs/CircularAllOfRef.md, line 21:
<comment>Example calls to_json on the class, but to_json is an instance method; this will raise a TypeError. Use the created instance instead.</comment>
<file context>
@@ -0,0 +1,30 @@
+# create an instance of CircularAllOfRef from a JSON string
+circular_all_of_ref_instance = CircularAllOfRef.from_json(json)
+# print the JSON string representation of the object
+print(CircularAllOfRef.to_json())
+
+# convert the object into a dict
</file context>
| # create an instance of DiscriminatorAllOfSub from a JSON string | ||
| discriminator_all_of_sub_instance = DiscriminatorAllOfSub.from_json(json) | ||
| # print the JSON string representation of the object | ||
| print(DiscriminatorAllOfSub.to_json()) |
There was a problem hiding this comment.
P3: The example calls to_json on the class instead of the instance. to_json is an instance method, so this call is invalid and the example will fail or mislead users.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/openapi3/client/petstore/python-httpx-sync/docs/DiscriminatorAllOfSub.md, line 19:
<comment>The example calls `to_json` on the class instead of the instance. `to_json` is an instance method, so this call is invalid and the example will fail or mislead users.</comment>
<file context>
@@ -0,0 +1,28 @@
+# create an instance of DiscriminatorAllOfSub from a JSON string
+discriminator_all_of_sub_instance = DiscriminatorAllOfSub.from_json(json)
+# print the JSON string representation of the object
+print(DiscriminatorAllOfSub.to_json())
+
+# convert the object into a dict
</file context>
There was a problem hiding this comment.
1 issue found across 3 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="samples/openapi3/client/petstore/python-httpx-sync/tests/test_pet_api.py">
<violation number="1" location="samples/openapi3/client/petstore/python-httpx-sync/tests/test_pet_api.py:230">
P3: Test asserts a platform-specific httpx error message ("[Errno 111] Connection refused"), which varies by OS/version and can cause flaky failures; prefer a stable pattern or only assert the exception type.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Add httpx (sync) as library for python generator
to fix #23032
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
master(upcoming7.x.0minor release - breaking changes with fallbacks),8.0.x(breaking changes without fallbacks)"fixes #123"present in the PR description)Summary by cubic
Adds httpx-sync as a new Python generator library to produce synchronous httpx clients, fixing #23032. Generate clients via --library httpx-sync (or set library: httpx-sync in config).
New Features
Bug Fixes
Written for commit ea0fddd. Summary will update on new commits.