fix: [BUG][JAVA] vendorExtension.x-class-extra-annotation doesn't generate lists of annotations correctly#23750
Conversation
| } | ||
|
|
||
| @Test | ||
| public void testAllOfClassWithMultipleAnnotations() throws IOException { |
| } | ||
|
|
||
| @Test | ||
| public void testAllOfClassWithSingleAnnotation() { |
There was a problem hiding this comment.
Use the supportedLibraries @DataProvider to test all libraries
| } | ||
|
|
||
| @Test | ||
| public void testAllOfClassWithMultipleAnnotations() { |
| } | ||
| } | ||
|
|
||
| // make sure the x-class-extra-annotation is always a List and always at least empty |
There was a problem hiding this comment.
Create a reusable method, also available for other annotations and other generators (kotlin)
Maybe some static method: fixVendorExtensionWithStringList(Map<String, Object> vendorExtensions , String name) so you can use
fixVendorExtensionWithStringList(cm.getVendorExtensions(cm, "x-class-extra-annotation")
|
@johnyherangi Nice feature. How can the user know that a list is now allowed for that specific annotation? Why only x-class-extra-annotation? There a at least 3 variants of x-xxx-extra-annotation |
Fixes #23749
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
master(upcoming7.x.0minor release - breaking changes with fallbacks),8.0.x(breaking changes without fallbacks)"fixes #123"present in the PR description)Summary by cubic
Fixes Java/Spring codegen so
x-class-extra-annotationaccepts a single string or a YAML list and emits all annotations. Also defaults to an empty list when missing, and applies toallOfmodels and oneOf interfaces.Bug Fixes
x-class-extra-annotationtoList<String>inAbstractJavaCodegenwith an empty-list default.oneof_interfacetemplates to loop and emit each annotation using{{{.}}}.allOfmodels, plusallOf-with-annotations.yaml.Refactors
normalizeVendorExtensionWithStringListand reused it forx-implementsandx-class-extra-annotationnormalization.Written for commit 9db08fc. Summary will update on new commits.