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
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .github/workflows/samples-python-petstore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Fix with Cubic

- samples/openapi3/client/petstore/python
- samples/openapi3/client/petstore/python-lazyImports
services:
Expand Down
15 changes: 15 additions & 0 deletions bin/configs/python-httpx-sync.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
generatorName: python
outputDir: samples/openapi3/client/petstore/python-httpx-sync
inputSpec: modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/python
library: httpx-sync
additionalProperties:
packageName: petstore_api
mapNumberTo: float
poetry1: false
nameMappings:
_type: underscore_type
type_: type_with_underscore
modelNameMappings:
# The OpenAPI spec ApiResponse conflicts with the internal ApiResponse
ApiResponse: ModelApiResponse
2 changes: 1 addition & 1 deletion docs/generators/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|generateSourceCodeOnly|Specifies that only a library source code is to be generated.| |false|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|lazyImports|Enable lazy imports.| |false|
|library|library template (sub-template) to use: asyncio, tornado (deprecated), urllib3, httpx| |urllib3|
|library|library template (sub-template) to use: asyncio, tornado (deprecated), urllib3, httpx, httpx-sync| |urllib3|
|mapNumberTo|Map number to Union[StrictFloat, StrictInt], StrictStr or float.| |Union[StrictFloat, StrictInt]|
|packageName|python package name (convention: snake_case).| |openapi_client|
|packageUrl|python package URL.| |null|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ public PythonClientCodegen() {
supportedLibraries.put("asyncio", "asyncio-based client");
supportedLibraries.put("tornado", "tornado-based client (deprecated)");
supportedLibraries.put("httpx", "httpx-based client");
CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use: asyncio, tornado (deprecated), urllib3, httpx");
supportedLibraries.put("httpx-sync", "httpx-based sync client");
CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use: asyncio, tornado (deprecated), urllib3, httpx, httpx-sync");
libraryOption.setDefault(DEFAULT_LIBRARY);
cliOptions.add(libraryOption);
setLibrary(DEFAULT_LIBRARY);
Expand Down Expand Up @@ -326,7 +327,6 @@ public void processOpts() {
supportingFiles.add(new SupportingFile("__init__.mustache", testFolder, "__init__.py"));
}

supportingFiles.add(new SupportingFile("api_client.mustache", packagePath(), "api_client.py"));
supportingFiles.add(new SupportingFile("api_response.mustache", packagePath(), "api_response.py"));

if ("asyncio".equals(getLibrary())) {
Expand All @@ -338,10 +338,15 @@ public void processOpts() {
additionalProperties.put("tornado", "true");
} else if ("httpx".equals(getLibrary())) {
supportingFiles.add(new SupportingFile("httpx/rest.mustache", packagePath(), "rest.py"));
supportingFiles.add(new SupportingFile("httpx/api_client.mustache", packagePath(), "api_client.py"));
additionalProperties.put("async", "true");
additionalProperties.put("httpx", "true");
} else if ("httpx-sync".equals(getLibrary())) {
supportingFiles.add(new SupportingFile("httpx/rest.mustache", packagePath(), "rest.py"));
additionalProperties.put("httpx", "true");
} else {
supportingFiles.add(new SupportingFile("rest.mustache", packagePath(), "rest.py"));
supportingFiles.add(new SupportingFile("api_client.mustache", packagePath(), "api_client.py"));
}

modelPackage = this.packageName + "." + modelPackage;
Expand Down
Loading
Loading