Skip to content

python-type-codegen ignores generateInputsAndOutputs #929

Open

Description

@akarshy21

Describe the bug

Setting generateInputsAndOutputs: true on python-type-codegen has no effect: @input and @output structures are still not generated.

CreateSyntheticService reads the setting and includes those structures in the synthetic service, but DirectedPythonTypeCodegen.shouldGenerateStructure skips every @input/@output structure in types mode and never sees the setting, so neither their classes nor their schemas are written. This also applies when service is set.

Separately, PythonTypeCodegenSettings.fromNode leaves generateInputsAndOutputs and selector out of its warnIfAdditionalProperties list, so setting either logs an "additional properties" warning even though both are read.

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

With generateInputsAndOutputs: true, @input and @output structures are generated in models.py. Setting selector or generateInputsAndOutputs logs no warning.

Current Behavior

No @input/@output classes are generated, and the build logs:

WARNING: Expected an object with possible properties of `module`, `moduleDescription`, `moduleVersion`, `service`, but found additional properties: `generateInputsAndOutputs`

Reproduction Steps

$version: "2.0"
namespace example.io

operation OpA { input := { value: String }, output := { value: String } }
operation OpB { input := { value: String }, output := { value: String } }

Plugin settings:

"python-type-codegen": { "module": "io_test", "moduleVersion": "0.0.1", "generateInputsAndOutputs": true }

Run PythonTypeCodegenPlugin on this model with a PluginContext (as the tests in codegen/plugins/types/src/it do). The generated src/io_test/models.py has no OpAInput, OpAOutput, OpBInput or OpBOutput class, and the warning above is logged.

Possible Solution

Pass generateInputsAndOutputs to DirectedPythonTypeCodegen and only skip @input/@output structures when it is off, and add SELECTOR and GENERATE_INPUTS_AND_OUTPUTS to the warnIfAdditionalProperties list. I'll include the fix in #928.

Additional Information/Context

The setting was added on 2025-03-07 (b3242a9 / ddb6c82), but only wired into CreateSyntheticService. The generator's skip predates it.

Affected component

codegen (Java code generator)

Version used

develop at 91c2325 (codegen 0.6.0)

Python version used

Python 3.12.13

Operating System and version

Amazon Linux 2 (x86_64), OpenJDK 17.0.21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions