Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #14725
Closed
Open
Issue created Feb 16, 2023 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[BUG] [python-nextgen] Generated ApiClient Throws Error With Dict Query Params

Created by: emma-campbell

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

The generated ApiClient method parameters_to_url_query converts int, float, and bool values to strings. It does not do the same for dict. As a result passing a dict query param to the client results in the following error.

TypeError: sequence item 1: expected str instance, dict found

Expected output would be to not have this error.

openapi-generator version

Tested against 6.3.0 as well as master.

OpenAPI declaration file content or url

OpenApi Gist Here

Generation Details
./run-in-docker.sh generate -i result_api.json -g python-nextgen -o python-sdk -p disallowAdditionalPropertiesIfNotPresent=false,generateSourceCodeOnly=true,packageName=result_sdk
Steps to reproduce
  1. Generate the client using the CLI options above
  2. Use the output client in a python script
from result_sdk.api.runner_api import RunnerApi
from datetime import datetime, timedelta

api = RunnerApi()

end = datetime.utcnow()
start = end - timedelta(days=5)

filter = {
	"$and": [
		{
			"createdOn": {
				"$lte": end.isoformat()
			}
		},
		{
			"createdOn": {
				"$gte": start.isoformat()
			}
		}
	]
}

results = api.get_runner_results(filter=filter)

print(results)

Error mentioned before will throw on the results = line.

Related issues/PRs

Pretty similar to #14334, but here applying to dict types.

Suggest a fix

I will have a PR shortly for the mustache template.

Assignee
Assign to
Time tracking