OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.73k stars 6.56k forks source link

[BUG] [PYTHON] A schema named Schema with type array generates broken model null<SchemaInner> in 7.2, works in 6.0 #17755

Open doctorpangloss opened 9 months ago

doctorpangloss commented 9 months ago

Bug Report Checklist

Description
    QueueTuple:
      type: array
      description: ...
      items:
        oneOf:
          - type: number
          - type: string
          - $ref: "#/components/schemas/Prompt"
          - $ref: "#/components/schemas/ExtraData"

A schema of type: array with a oneOf in items produces snippets of broken Python code like:

from comfy.api.models.null<queue_tuple_inner> import null<QueueTupleInner>
...

class QueueTuple(null<QueueTupleInner>):
    """
    The first item is the queue priority The second item is the hash id of the prompt object The third item is a Prompt The fourth item is optionally an ExtraData The fifth item is optionally a list of \"Good Outputs\" node IDs. 
    """ # noqa: E501
    __properties: ClassVar[List[str]] = []
   ...
openapi-generator version

7.2.0 (regression compared to 6.x)

OpenAPI declaration file content or url

https://github.com/hiddenswitch/ComfyUI/blob/wip/api/comfy/api/openapi.yaml

Logs on 7.3.0 (master):

``` [main] INFO o.o.codegen.DefaultGenerator - Generating with dryRun=false [main] INFO o.o.c.ignore.CodegenIgnoreProcessor - No .openapi-generator-ignore file found. [main] INFO o.o.codegen.DefaultGenerator - OpenAPI Generator: python (client) [main] INFO o.o.codegen.DefaultGenerator - Generator 'python' is considered stable. [main] INFO o.o.c.l.AbstractPythonCodegen - Environment variable PYTHON_POST_PROCESS_FILE not defined so the Python code may not be properly formatted. To define it, try 'export PYTHON_POST_PROCESS_FILE="/usr/local/bin/yapf -i"' (Linux/Mac) [main] INFO o.o.c.l.AbstractPythonCodegen - NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI). [main] INFO o.o.c.languages.PythonClientCodegen - Environment variable PYTHON_POST_PROCESS_FILE not defined so the Python code may not be properly formatted. To define it, try 'export PYTHON_POST_PROCESS_FILE="/usr/local/bin/yapf -i"' (Linux/Mac) [main] INFO o.o.c.languages.PythonClientCodegen - NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI). [main] INFO o.o.codegen.InlineModelResolver - Inline schema created as upload_image_request. To have complete control of the model name, set the `title` field or use the modelNameMapping option (e.g. --model-name-mappings upload_image_request=NewModel,ModelA=NewModelA in CLI) or inlineSchemaNameMapping option (--inline-schema-name-mappings upload_image_request=NewModel,ModelA=NewModelA in CLI). [main] INFO o.o.codegen.InlineModelResolver - Inline schema created as upload_image_200_response. To have complete control of the model name, set the `title` field or use the modelNameMapping option (e.g. --model-name-mappings upload_image_200_response=NewModel,ModelA=NewModelA in CLI) or inlineSchemaNameMapping option (--inline-schema-name-mappings upload_image_200_response=NewModel,ModelA=NewModelA in CLI). [main] INFO o.o.codegen.InlineModelResolver - Inline schema created as get_prompt_200_response_exec_info. To have complete control of the model name, set the `title` field or use the modelNameMapping option (e.g. --model-name-mappings get_prompt_200_response_exec_info=NewModel,ModelA=NewModelA in CLI) or inlineSchemaNameMapping option (--inline-schema-name-mappings get_prompt_200_response_exec_info=NewModel,ModelA=NewModelA in CLI). [main] INFO o.o.codegen.InlineModelResolver - Inline schema created as get_prompt_200_response. To have complete control of the model name, set the `title` field or use the modelNameMapping option (e.g. --model-name-mappings get_prompt_200_response=NewModel,ModelA=NewModelA in CLI) or inlineSchemaNameMapping option (--inline-schema-name-mappings get_prompt_200_response=NewModel,ModelA=NewModelA in CLI). [main] INFO o.o.codegen.InlineModelResolver - Inline schema created as get_history_200_response_value. To have complete control of the model name, set the `title` field or use the modelNameMapping option (e.g. --model-name-mappings get_history_200_response_value=NewModel,ModelA=NewModelA in CLI) or inlineSchemaNameMapping option (--inline-schema-name-mappings get_history_200_response_value=NewModel,ModelA=NewModelA in CLI). [main] INFO o.o.codegen.InlineModelResolver - Inline schema created as post_history_request. To have complete control of the model name, set the `title` field or use the modelNameMapping option (e.g. --model-name-mappings post_history_request=NewModel,ModelA=NewModelA in CLI) or inlineSchemaNameMapping option (--inline-schema-name-mappings post_history_request=NewModel,ModelA=NewModelA in CLI). [main] INFO o.o.codegen.InlineModelResolver - Inline schema created as get_queue_200_response. To have complete control of the model name, set the `title` field or use the modelNameMapping option (e.g. --model-name-mappings get_queue_200_response=NewModel,ModelA=NewModelA in CLI) or inlineSchemaNameMapping option (--inline-schema-name-mappings get_queue_200_response=NewModel,ModelA=NewModelA in CLI). [main] INFO o.o.codegen.InlineModelResolver - Inline schema created as _api_v1_prompts_post_request. To have complete control of the model name, set the `title` field or use the modelNameMapping option (e.g. --model-name-mappings _api_v1_prompts_post_request=NewModel,ModelA=NewModelA in CLI) or inlineSchemaNameMapping option (--inline-schema-name-mappings _api_v1_prompts_post_request=NewModel,ModelA=NewModelA in CLI). [main] INFO o.o.codegen.InlineModelResolver - Inline schema created as _api_v1_prompts_post_200_response. To have complete control of the model name, set the `title` field or use the modelNameMapping option (e.g. --model-name-mappings _api_v1_prompts_post_200_response=NewModel,ModelA=NewModelA in CLI) or inlineSchemaNameMapping option (--inline-schema-name-mappings _api_v1_prompts_post_200_response=NewModel,ModelA=NewModelA in CLI). [main] INFO o.o.codegen.InlineModelResolver - Inline schema created as Node_input_required_value_inner_oneOf. To have complete control of the model name, set the `title` field or use the modelNameMapping option (e.g. --model-name-mappings Node_input_required_value_inner_oneOf=NewModel,ModelA=NewModelA in CLI) or inlineSchemaNameMapping option (--inline-schema-name-mappings Node_input_required_value_inner_oneOf=NewModel,ModelA=NewModelA in CLI). [main] INFO o.o.codegen.InlineModelResolver - Inline schema created as Node_input_required_value_inner. To have complete control of the model name, set the `title` field or use the modelNameMapping option (e.g. --model-name-mappings Node_input_required_value_inner=NewModel,ModelA=NewModelA in CLI) or inlineSchemaNameMapping option (--inline-schema-name-mappings Node_input_required_value_inner=NewModel,ModelA=NewModelA in CLI). [main] INFO o.o.codegen.InlineModelResolver - Inline schema created as Node_input. To have complete control of the model name, set the `title` field or use the modelNameMapping option (e.g. --model-name-mappings Node_input=NewModel,ModelA=NewModelA in CLI) or inlineSchemaNameMapping option (--inline-schema-name-mappings Node_input=NewModel,ModelA=NewModelA in CLI). [main] INFO o.o.codegen.InlineModelResolver - Inline schema created as ExtraData_extra_pnginfo. To have complete control of the model name, set the `title` field or use the modelNameMapping option (e.g. --model-name-mappings ExtraData_extra_pnginfo=NewModel,ModelA=NewModelA in CLI) or inlineSchemaNameMapping option (--inline-schema-name-mappings ExtraData_extra_pnginfo=NewModel,ModelA=NewModelA in CLI). [main] INFO o.o.codegen.InlineModelResolver - Inline schema created as PromptNode_inputs_value_oneOf_inner. To have complete control of the model name, set the `title` field or use the modelNameMapping option (e.g. --model-name-mappings PromptNode_inputs_value_oneOf_inner=NewModel,ModelA=NewModelA in CLI) or inlineSchemaNameMapping option (--inline-schema-name-mappings PromptNode_inputs_value_oneOf_inner=NewModel,ModelA=NewModelA in CLI). [main] INFO o.o.codegen.InlineModelResolver - Inline schema created as PromptNode_inputs_value. To have complete control of the model name, set the `title` field or use the modelNameMapping option (e.g. --model-name-mappings PromptNode_inputs_value=NewModel,ModelA=NewModelA in CLI) or inlineSchemaNameMapping option (--inline-schema-name-mappings PromptNode_inputs_value=NewModel,ModelA=NewModelA in CLI). [main] INFO o.o.codegen.InlineModelResolver - Inline schema created as PromptNode_is_changed. To have complete control of the model name, set the `title` field or use the modelNameMapping option (e.g. --model-name-mappings PromptNode_is_changed=NewModel,ModelA=NewModelA in CLI) or inlineSchemaNameMapping option (--inline-schema-name-mappings PromptNode_is_changed=NewModel,ModelA=NewModelA in CLI). [main] INFO o.o.codegen.InlineModelResolver - Inline schema created as Workflow_nodes_inner_size. To have complete control of the model name, set the `title` field or use the modelNameMapping option (e.g. --model-name-mappings Workflow_nodes_inner_size=NewModel,ModelA=NewModelA in CLI) or inlineSchemaNameMapping option (--inline-schema-name-mappings Workflow_nodes_inner_size=NewModel,ModelA=NewModelA in CLI). [main] INFO o.o.codegen.InlineModelResolver - Inline schema created as Workflow_nodes_inner_inputs_inner. To have complete control of the model name, set the `title` field or use the modelNameMapping option (e.g. --model-name-mappings Workflow_nodes_inner_inputs_inner=NewModel,ModelA=NewModelA in CLI) or inlineSchemaNameMapping option (--inline-schema-name-mappings Workflow_nodes_inner_inputs_inner=NewModel,ModelA=NewModelA in CLI). [main] INFO o.o.codegen.InlineModelResolver - Inline schema created as Workflow_nodes_inner_outputs_inner. To have complete control of the model name, set the `title` field or use the modelNameMapping option (e.g. --model-name-mappings Workflow_nodes_inner_outputs_inner=NewModel,ModelA=NewModelA in CLI) or inlineSchemaNameMapping option (--inline-schema-name-mappings Workflow_nodes_inner_outputs_inner=NewModel,ModelA=NewModelA in CLI). [main] INFO o.o.codegen.InlineModelResolver - Inline schema created as Workflow_nodes_inner. To have complete control of the model name, set the `title` field or use the modelNameMapping option (e.g. --model-name-mappings Workflow_nodes_inner=NewModel,ModelA=NewModelA in CLI) or inlineSchemaNameMapping option (--inline-schema-name-mappings Workflow_nodes_inner=NewModel,ModelA=NewModelA in CLI). [main] INFO o.o.codegen.InlineModelResolver - Inline schema created as Workflow_links_inner_inner. To have complete control of the model name, set the `title` field or use the modelNameMapping option (e.g. --model-name-mappings Workflow_links_inner_inner=NewModel,ModelA=NewModelA in CLI) or inlineSchemaNameMapping option (--inline-schema-name-mappings Workflow_links_inner_inner=NewModel,ModelA=NewModelA in CLI). [main] INFO o.o.codegen.InlineModelResolver - Inline schema created as QueueTuple_inner. To have complete control of the model name, set the `title` field or use the modelNameMapping option (e.g. --model-name-mappings QueueTuple_inner=NewModel,ModelA=NewModelA in CLI) or inlineSchemaNameMapping option (--inline-schema-name-mappings QueueTuple_inner=NewModel,ModelA=NewModelA in CLI). [main] INFO o.o.codegen.DefaultGenerator - Model upload_image_request not generated since it's marked as unused (due to form parameters) and `skipFormModel` (global property) set to true (default) [main] WARN o.o.c.l.AbstractPythonCodegen - Codegen property is null (e.g. map/dict of undefined type). Default to typing.Any. [main] WARN o.o.c.l.AbstractPythonCodegen - Codegen property is null (e.g. map/dict of undefined type). Default to typing.Any. [main] WARN o.o.c.l.AbstractPythonCodegen - Codegen property is null (e.g. map/dict of undefined type). Default to typing.Any. [main] WARN o.o.c.l.AbstractPythonCodegen - Codegen property is null (e.g. map/dict of undefined type). Default to typing.Any. [main] WARN o.o.c.l.AbstractPythonCodegen - Codegen property is null (e.g. map/dict of undefined type). Default to typing.Any. [main] WARN o.o.c.l.AbstractPythonCodegen - Codegen property is null (e.g. map/dict of undefined type). Default to typing.Any. [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\models\api_v1_prompts_post200_response.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\test\test_api_v1_prompts_post200_response.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\docs\ApiV1PromptsPost200Response.md [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\models\api_v1_prompts_post_request.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\test\test_api_v1_prompts_post_request.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\docs\ApiV1PromptsPostRequest.md [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\models\extra_data.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\test\test_extra_data.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\docs\ExtraData.md [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\models\extra_data_extra_pnginfo.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\test\test_extra_data_extra_pnginfo.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\docs\ExtraDataExtraPnginfo.md [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\models\get_history200_response_value.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\test\test_get_history200_response_value.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\docs\GetHistory200ResponseValue.md [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\models\get_prompt200_response.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\test\test_get_prompt200_response.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\docs\GetPrompt200Response.md [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\models\get_prompt200_response_exec_info.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\test\test_get_prompt200_response_exec_info.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\docs\GetPrompt200ResponseExecInfo.md [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\models\get_queue200_response.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\test\test_get_queue200_response.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\docs\GetQueue200Response.md [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\models\node.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\test\test_node.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\docs\Node.md [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\models\node_input.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\test\test_node_input.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\docs\NodeInput.md [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\models\node_input_required_value_inner.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\test\test_node_input_required_value_inner.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\docs\NodeInputRequiredValueInner.md [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\models\node_input_required_value_inner_one_of.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\test\test_node_input_required_value_inner_one_of.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\docs\NodeInputRequiredValueInnerOneOf.md [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\models\post_history_request.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\test\test_post_history_request.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\docs\PostHistoryRequest.md [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\models\prompt.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\test\test_prompt.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\docs\Prompt.md [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\models\prompt_node.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\test\test_prompt_node.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\docs\PromptNode.md [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\models\prompt_node_inputs_value.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\test\test_prompt_node_inputs_value.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\docs\PromptNodeInputsValue.md [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\models\prompt_node_inputs_value_one_of_inner.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\test\test_prompt_node_inputs_value_one_of_inner.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\docs\PromptNodeInputsValueOneOfInner.md [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\models\prompt_node_is_changed.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\test\test_prompt_node_is_changed.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\docs\PromptNodeIsChanged.md [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\models\prompt_request.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\test\test_prompt_request.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\docs\PromptRequest.md [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\models\queue_tuple.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\test\test_queue_tuple.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\docs\QueueTuple.md [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\models\queue_tuple_inner.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\test\test_queue_tuple_inner.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\docs\QueueTupleInner.md [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\models\upload_image200_response.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\test\test_upload_image200_response.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\docs\UploadImage200Response.md [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\models\workflow.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\test\test_workflow.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\docs\Workflow.md [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\models\workflow_links_inner_inner.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\test\test_workflow_links_inner_inner.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\docs\WorkflowLinksInnerInner.md [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\models\workflow_nodes_inner.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\test\test_workflow_nodes_inner.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\docs\WorkflowNodesInner.md [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\models\workflow_nodes_inner_inputs_inner.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\test\test_workflow_nodes_inner_inputs_inner.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\docs\WorkflowNodesInnerInputsInner.md [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\models\workflow_nodes_inner_outputs_inner.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\test\test_workflow_nodes_inner_outputs_inner.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\docs\WorkflowNodesInnerOutputsInner.md [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\models\workflow_nodes_inner_size.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\test\test_workflow_nodes_inner_size.py [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\docs\WorkflowNodesInnerSize.md [main] INFO o.o.codegen.DefaultGenerator - Skipping generation of APIs. [main] INFO o.o.codegen.DefaultGenerator - Skipping generation of Webhooks. [main] INFO o.o.codegen.TemplateManager - Skipped .\comfy\api_README.md (Skipped by supportingFiles options supplied by user.) [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\configuration.py [main] INFO o.o.codegen.TemplateManager - Skipped .\comfy\api\__init__.py (Skipped by supportingFiles options supplied by user.) [main] INFO o.o.codegen.TemplateManager - Skipped .\comfy\api\models\__init__.py (Skipped by supportingFiles options supplied by user.) [main] INFO o.o.codegen.TemplateManager - Skipped .\comfy\api\api\__init__.py (Skipped by supportingFiles options supplied by user.) [main] INFO o.o.codegen.TemplateManager - Skipped .\comfy\__init__.py (Skipped by supportingFiles options supplied by user.) [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\exceptions.py [main] INFO o.o.codegen.TemplateManager - Skipped .\comfy\api\test\__init__.py (Skipped by supportingFiles options supplied by user.) [main] INFO o.o.codegen.TemplateManager - Skipped .\comfy\api\api_client.py (Skipped by supportingFiles options supplied by user.) [main] INFO o.o.codegen.TemplateManager - writing file .\comfy\api\api_response.py [main] INFO o.o.codegen.TemplateManager - Skipped .\comfy\api\rest.py (Skipped by supportingFiles options supplied by user.) [main] INFO o.o.codegen.TemplateManager - Skipped .\.openapi-generator-ignore (Skipped by supportingFiles options supplied by user.) [main] INFO o.o.codegen.TemplateManager - writing file ./\.openapi-generator\VERSION [main] INFO o.o.codegen.TemplateManager - writing file ./\.openapi-generator\FILES ################################################################################ # Thanks for using OpenAPI Generator. # # Please consider donation to help us maintain this project ? # # https://opencollective.com/openapi_generator/donate # ################################################################################ ```
Generation Details

openapi_python_config.yaml:

inputSpec: ./openapi.yaml
outputDir: ./
generatorName: python
globalProperties:
  supportingFiles:
    - "schemas.py"
    - "exceptions.py"
    - "configuration.py"
    - "api_response.py"
additionalProperties:
  generateSourceCodeOnly: true
  packageName: comfy.api
  generateAliasAsModel: true
java --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -jar openapi-generator-cli-7.2.0.jar generate --input-spec ./comfy/api/openapi.yaml --global-property models --config ./comfy/api/openapi_python_config.yaml
Steps to reproduce

See Collab notebook here https://colab.research.google.com/drive/18sXET4mnQLMrsxru2vumN7iuk1fVJEVr?usp=sharing

git clone https://github.com/hiddenswitch/ComfyUI.git --branch wip/api repro
git clone https://github.com/OpenAPITools/openapi-generator.git --depth=1
(cd openapi-generator && ./mvnw clean install -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -q &>/dev/null)
(cd repro && java --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -jar ../openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar generate --input-spec ./comfy/api/openapi.yaml --global-property models --config ./comfy/api/openapi_python_config.yaml)

cat ./repro/comfy/api/models/queue_tuple.py

Observe queue_tuple has content like

from comfy.api.models.null<queue_tuple_inner> import null<QueueTupleInner>
from typing import Optional, Set
from typing_extensions import Self

class QueueTuple(null<QueueTupleInner>)

which is not valid Python and indicates a bug.

Related issues/PRs

Related to https://github.com/OpenAPITools/openapi-generator/issues/17745

Suggest a fix

Not sure what the underlying issue is, are Array schemas unexpected? this works in 6.x.

wing328 commented 9 months ago

generateAliasAsModel: true

can you try setting it to false instead?

doctorpangloss commented 8 months ago

This causes other errors:

....
[main] INFO  o.o.codegen.DefaultGenerator - Model Prompt not generated since it's a free-form object
[main] INFO  o.o.codegen.DefaultGenerator - Model Outputs not generated since it's a free-form object
[main] INFO  o.o.codegen.DefaultGenerator - Model upload_image_request not generated since it's marked as unused (due to form parameters) and `skipFormModel` (global property) set to true (default)
[main] WARN  o.o.c.l.AbstractPythonCodegen - Failed to lookup model in createImportMapOfSet Dict[str, PromptNode]
[main] WARN  o.o.c.l.AbstractPythonCodegen - Failed to lookup model in createImportMapOfSet Dict[str, Output]
[main] WARN  o.o.c.l.AbstractPythonCodegen - Failed to lookup model in createImportMapOfSet Dict[str, PromptNode]
[main] WARN  o.o.c.l.AbstractPythonCodegen - Codegen property is null (e.g. map/dict of undefined type). Default to typing.Any.
[main] WARN  o.o.c.l.AbstractPythonCodegen - Codegen property is null (e.g. map/dict of undefined type). Default to typing.Any.
[main] WARN  o.o.c.l.AbstractPythonCodegen - Codegen property is null (e.g. map/dict of undefined type). Default to typing.Any.
...

No... these are maps with typed values. This must be a bug. See the updated colab here: https://github.com/OpenAPITools/openapi-generator/issues/17755#issuecomment-1920919909