pulp / pulp/pulp-openapi-generator

Update python client `openapi-generator-cli` version

Open
#83 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement Triage-Needed
Dominant language
Mustache
Stars
4
Forks
29
PR merge metrics
No merged PRs in 30d

Description

Upgrade openapi-generator-cli to version >=5.0.0.

Currently used python client openapi-generator-cli v4.3.1 contains bug java.time.OffsetDateTime cannot be cast to java.lang.String. This is fixed in version 5.0.0.
Related issues: https://github.com/OpenAPITools/openapi-generator/issues/6694, https://github.com/OpenAPITools/openapi-generator/issues/6433.
PR fix: https://github.com/OpenAPITools/openapi-generator/pull/6458

Taken from https://github.com/pulp/pulpcore/pull/3564#issuecomment-1437083254

Exception in thread "main" java.lang.RuntimeException: Could not process model 'Purge'.Please make sure that your schema is correct!
  	at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:496)
  	at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:1005)
  	at org.openapitools.codegen.cmd.Generate.execute(Generate.java:431)
  	at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
  	at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:61)
  Caused by: java.lang.ClassCastException: java.time.OffsetDateTime cannot be cast to java.lang.String
  	at org.openapitools.codegen.languages.PythonClientCodegen.toExampleValueRecursive(PythonClientCodegen.java:724)
  	at org.openapitools.codegen.languages.PythonClientCodegen.toExampleValue(PythonClientCodegen.java:703)
  	at org.openapitools.codegen.DefaultCodegen.fromProperty(DefaultCodegen.java:2846)
  	at org.openapitools.codegen.DefaultCodegen.addVars(DefaultCodegen.java:4534)
  	at org.openapitools.codegen.DefaultCodegen.addVars(DefaultCodegen.java:4482)
  	at org.openapitools.codegen.DefaultCodegen.fromModel(DefaultCodegen.java:2[378](https://github.com/pulp/pulpcore/actions/runs/4224067517/jobs/7334573002#step:8:379))
  	at org.openapitools.codegen.DefaultGenerator.processModels(DefaultGenerator.java:1289)
  	at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:491)
  	... 4 more
  Error: Process completed with exit code 1.

(CI job: https://github.com/pulp/pulpcore/actions/runs/4224067517/jobs/7334573002)

It would be worth upgrading to the latest or at least version >=5.0.0 to fix this, even with possible breaking changes.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the repository configuration that pins the Python client's openapi-generator-cli version, then compare it with the requested minimum of 5.0.0. Use the linked CI job as the failure reference; done means generation no longer produces the OffsetDateTime casting error and the relevant checks pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.