-
-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Closed
Labels
Description
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
I'm currently working on a project where I need to generate a Python client for the Allegro API. However, I'm encountering a ClassCastException when the generator tries to handle a UUID. It seems like the generator is trying to cast a UUID to a string, but it's failing. I've tried looking for solutions online, but haven't found anything that works yet. However, it is kind of similar to previous issue solved as marked: #15114
Error message:
Exception in thread "main" java.lang.RuntimeException: Could not process operation:
Tag: class Tag {
name: Advance Ship Notices
description: null
externalDocs: null
}
Operation: deleteAdvanceShipNotice
Resource: delete /fulfillment/advance-ship-notices/{id}
Schemas: {BillingEntries=class ObjectSchema {
class Schema {
(...)
}}
Exception: class java.util.UUID cannot be cast to class java.lang.String (java.util.UUID and java.lang.String are in module java.base of loader 'bootstrap')
at org.openapitools.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:1225)
at org.openapitools.codegen.DefaultGenerator.processPaths(DefaultGenerator.java:1120)
at org.openapitools.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:590)
at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:953)
at org.openapitools.codegen.cmd.Generate.execute(Generate.java:511)
at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
Caused by: java.lang.ClassCastException: class java.util.UUID cannot be cast to class java.lang.String (java.util.UUID and java.lang.String are in module java.base of loader 'bootstrap')
at org.openapitools.codegen.languages.AbstractPythonCodegen.toDefaultValue(AbstractPythonCodegen.java:185)
at org.openapitools.codegen.DefaultCodegen.toDefaultValue(DefaultCodegen.java:2261)
at org.openapitools.codegen.DefaultCodegen.fromProperty(DefaultCodegen.java:4129)
at org.openapitools.codegen.DefaultCodegen.fromProperty(DefaultCodegen.java:3841)
at org.openapitools.codegen.DefaultCodegen.fromParameter(DefaultCodegen.java:5116)
at org.openapitools.codegen.DefaultCodegen.fromOperation(DefaultCodegen.java:4636)
at org.openapitools.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:1193)
... 6 more
openapi-generator version
7.0.0
OpenAPI declaration file content or url
https://developer.allegro.pl/swagger.yaml
Relevant part causing error:
/fulfillment/advance-ship-notices/{id}/labels:
get:
summary: 'Get labels for Advance Ship Notice'
description: 'Use this resource to get labels for Advance Ship Notice after being created with "create labels command".'
tags:
- Advance Ship Notices
operationId: getAdvanceShipNoticeLabels
parameters:
- name: id
in: path
description: An identifier of the Advance Ship Notice.
required: true
schema:
type: string
format: uuid
example: 84529ad2-2265-4e15-b76b-c17025d848f6
- name: accept
in: header
description: Content-type of generated labels
required: true
schema:
type: string
enum:
- application/pdf
- x-application/zpl
Generation Details
openapi-generator-cli generate -g python -i https://developer.allegro.pl/swagger.yaml -o /home/user/client
Steps to reproduce
openapi-generator-cli generate -g python -i https://developer.allegro.pl/swagger.yaml -o /home/user/client
Related issues/PRs
(#15114)