-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
fix(spring): Add Nullable import for array-type models (#22788) #22844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
fix(spring): Add Nullable import for array-type models (#22788) #22844
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 2 files
|
thanks for the PR cc @cachescrubber (2022/02) @welshm (2022/02) @MelleD (2022/02) @atextor (2022/02) @manedev79 (2022/02) @javisst (2022/02) @borsch (2022/02) @banlevente (2022/02) @Zomzog (2022/09) @martin-mfg (2023/08) |
|
thanks for the pr please follow step 3 to update the samples |
|
Could you please check again, @wing328? I updated by following steps. Regards |
|
@wing328 could you please approve ci pipelines for my update? Regards |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 issues found across 63 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="samples/client/petstore/php-nextgen/OpenAPIClient-php/phpunit.xml.dist">
<violation number="1" location="samples/client/petstore/php-nextgen/OpenAPIClient-php/phpunit.xml.dist:5">
P2: Coverage include directories now contain literal backslashes (`./src\/Api`, `./src\/Model`), which changes the filesystem path and can cause PHPUnit to skip these directories for coverage collection.</violation>
</file>
<file name="samples/client/echo_api/php-nextgen/phpunit.xml.dist">
<violation number="1" location="samples/client/echo_api/php-nextgen/phpunit.xml.dist:5">
P2: The added backslash becomes part of the path in XML, so PHPUnit will look for a non-existent `src\Api` directory and skip coverage for that folder.</violation>
</file>
<file name="samples/client/echo_api/php-nextgen-streaming/phpunit.xml.dist">
<violation number="1" location="samples/client/echo_api/php-nextgen-streaming/phpunit.xml.dist:5">
P2: Coverage include paths now contain a literal backslash (`./src\/Api`, `./src\/Model`), which makes them refer to different/nonexistent directories and can cause PHPUnit to skip source files for coverage.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
samples/client/petstore/php-nextgen/OpenAPIClient-php/phpunit.xml.dist
Outdated
Show resolved
Hide resolved
…s in directory paths
Description
Fix missing
Nullableimport in array-type models generated by the Spring codegen. This resolves a compilation error where models using@Nullableannotation intoIndentedString()method were missing the required import.Fixes #22788
Problem
Array-type models (schemas with
type: arraywithout explicit properties) were generated without theorg.springframework.lang.Nullableimport, causing compilation failure:Root Cause
The
Nullableimport was being added inpostProcessModelProperty(), but this method is only called for models with properties. Array-type models have no properties, so the hook was never invoked.Solution
Moved the
Nullableimport logic frompostProcessModelProperty()tofromModel(), which is called for all models regardless of whether they have properties.Changes
modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.javaNullableimport logic frompostProcessModelProperty()Nullableimport logic tofromModel()modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.javashouldAddNullableImportForArrayTypeModels()test casePR checklist
Summary by cubic
Fixes missing org.springframework.lang.Nullable import in Spring-generated array-type models, preventing compilation errors when @nullable is used in toIndentedString(). The import is now added for all models.
Written for commit 554fc76. Summary will update on new commits.