Repository navigation
Conversation
CreateSyntheticService incremented the operation index only for shapes that get a synthetic input wrapper, so an error (or a kept @input/@output shape) shared its operation ID with the next shape. One of the two operations then replaced the other, and shapes only it reached were silently left out of models.py. Increment the index once per operation and test that every error and structure is generated.
CreateSyntheticService included @input and @output structures when generateInputsAndOutputs was set, but DirectedPythonTypeCodegen always skipped them in types mode, so the setting had no effect. Pass the setting to the generator and generate those structures when it is on. Also list selector and generateInputsAndOutputs as known settings so using them no longer logs an additional-properties warning.
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #, if available: Fixes #927, fixes #929
Description of changes:
Two bugs that made
python-type-codegenleave classes out of the generatedmodels.py, one commit each.Unique synthetic operation IDs (#927).
CreateSyntheticService.transformwraps each selected shape in a synthetic operation namedTypesGenOperation<index>, but incrementsindexonly for plain shapes, not for error,@inputor@outputshapes. Such a shape shares its operation ID with the next shape. When the model is rebuilt, one of the two operations replaces the other, and shapes only it reached are never generated. No error is reported. This change incrementsindexonce per synthetic operation.Honor
generateInputsAndOutputs(#929).CreateSyntheticServiceincluded@input/@outputstructures when the setting was on, butDirectedPythonTypeCodegen.shouldGenerateStructurealways skipped them in types mode, so the setting had no effect. The plugin now passes the setting to the generator, which writes those structures (classes and schemas) when it is on; the default is unchanged.fromNodealso listsselectorandgenerateInputsAndOutputsas known settings, so using them no longer logs an "additional properties" warning.Testing:
New integration tests in
PythonTypeCodegenTest, each run with both fixes, with only the first, and with neither:testEveryShapeIsGeneratedAlongsideErrorsErrorA,ErrorB,ErrorD,ErrorEmissing)testInputsAndOutputsAreSkippedByDefaulttestInputsAndOutputsAreGeneratedWhenEnabledtestInputsAndOutputsAreGeneratedForServiceWhenEnabled./gradlew build: theplugins:typeschecks and integration tests pass. Locally, fourcoreMarkdown-conversion tests (testConvertHtmlToMarkdownWithListand three others) fail with or without this change, because my pandoc (3.5) indents list items differently from the version CI installs.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.