-
Notifications
You must be signed in to change notification settings - Fork 89
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
Fix #852 - Process Qute templates in a strict manner #864
Conversation
@david-cabillic can you take a look and try it on your end? |
@ricardozanini I have a Maven build issue: [ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:3.16.4:generate-code (default) on project quarkus-document-api-client: Quarkus code generation phase has failed: InvocationTargetException: Could not generate model 'PostIndexingModifier_request': TemplateException: Rendering error: Property "classname" not found on the base object "null" in expression {child.model.classname} -> [Help 1] |
Are you using the same openapi you sent to us in the issue? Because this file is here in the PR and I can't see this error. If no, please send me the file. |
@ricardozanini I have 2 files in my project. |
Can you please share? |
@david-cabillic I figured it out. Given this openapi excerpt: CheckpointStatistics:
required:
- className
type: object
properties:
className:
type: string
discriminator:
propertyName: className
mapping:
completed: '#/components/schemas/CompletedCheckpointStatistics'
failed: '#/components/schemas/FailedCheckpointStatistics'
in_progress: '#/components/schemas/PendingCheckpointStatistics' It will generate annotations like this: @com.fasterxml.jackson.annotation.JsonIgnoreProperties(
value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization
allowSetters = true // allows the className to be set during deserialization
)
@com.fasterxml.jackson.annotation.JsonTypeInfo(use = com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME, include = com.fasterxml.jackson.annotation.JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@com.fasterxml.jackson.annotation.JsonSubTypes({
@com.fasterxml.jackson.annotation.JsonSubTypes.Type(value = CompletedCheckpointStatistics.class, name = "completed"),
@com.fasterxml.jackson.annotation.JsonSubTypes.Type(value = FailedCheckpointStatistics.class, name = "failed"),
@com.fasterxml.jackson.annotation.JsonSubTypes.Type(value = PendingCheckpointStatistics.class, name = "in_progress"),
})
public class CheckpointStatistics { } It wasn't working - at all - in previous versions. Can you try again my new commit? Please make sure that your |
Actually I need to fix the import first. |
administration.json ` quarkus.openapi-generator.codegen.spec.document_json.base-package=ch.tcs.onbase.document |
@david-cabillic can you please update and try again? |
Signed-off-by: Ricardo Zanini <1538000+ricardozanini@users.noreply.github.com>
Signed-off-by: Ricardo Zanini <1538000+ricardozanini@users.noreply.github.com>
Signed-off-by: Ricardo Zanini <1538000+ricardozanini@users.noreply.github.com>
@ricardozanini Build ok, well done . |
dddfb89
to
6ba0f3e
Compare
@david-cabillic, as soon as @mcruzdev and @hbelmiro review this PR, I'll merge it and release a new minor version. Thanks for reporting it; I've found many problems in the templates thanks to it. |
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.
LGTM
I just left two optional comments.
.../java/io/quarkiverse/openapi/generator/deployment/wrapper/OpenApiClientGeneratorWrapper.java
Outdated
Show resolved
Hide resolved
.../java/io/quarkiverse/openapi/generator/deployment/wrapper/OpenApiClientGeneratorWrapper.java
Outdated
Show resolved
Hide resolved
@ricardozanini You're welcome |
Signed-off-by: Ricardo Zanini <1538000+ricardozanini@users.noreply.github.com>
* Fix #852 - Process Qute templates in a strict manner Signed-off-by: Ricardo Zanini <1538000+ricardozanini@users.noreply.github.com> * Fix discriminator annotations on pojo.qute Signed-off-by: Ricardo Zanini <1538000+ricardozanini@users.noreply.github.com> * Improve testing on discriminator annotations Signed-off-by: Ricardo Zanini <1538000+ricardozanini@users.noreply.github.com> * Incorporate @hbelmiro review Signed-off-by: Ricardo Zanini <1538000+ricardozanini@users.noreply.github.com> --------- Signed-off-by: Ricardo Zanini <1538000+ricardozanini@users.noreply.github.com>
* Fix #852 - Process Qute templates in a strict manner * Fix discriminator annotations on pojo.qute * Improve testing on discriminator annotations * Incorporate @hbelmiro review --------- Signed-off-by: Ricardo Zanini <1538000+ricardozanini@users.noreply.github.com> Co-authored-by: Ricardo Zanini <1538000+ricardozanini@users.noreply.github.com>
Many thanks for submitting your Pull Request ❤️!
Please make sure that your PR meets the following requirements:
[0.9.x] Subject
In this PR:
I'm surprised a few of these features were working - at all—with many parsing logic and errors.
Fix #852
How to backport a pull request to a different branch?
In order to automatically create a backporting pull request please add one or more labels having the following format
backport-<branch-name>
, where<branch-name>
is the name of the branch where the pull request must be backported to (e.g.,backport-quarkus2
to backport the original PR to thequarkus2
branch).Once the original pull request is successfully merged, the automated action will create one backporting pull request per each label (with the previous format) that has been added.
If something goes wrong, the author will be notified and at this point a manual backporting is needed.