Skip to content
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

Add error message to quarkus-resteasy-reactive-links and improve documentation #36722

Merged

Conversation

leo-bogastry
Copy link
Contributor

This PR was triggered by the issue #36463

Goal is to clarify the error message the user gets when the class returned by the endpoint does not have and id field and also the documentation about web links

Copy link
Member

@gsmet gsmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I added a very small comment about the error message.

@quarkus-bot

This comment has been minimized.

@github-actions
Copy link

github-actions bot commented Oct 26, 2023

🙈 The PR is closed and the preview is expired.

@quarkus-bot

This comment has been minimized.

@leo-bogastry leo-bogastry force-pushed the add-error-message-generate-web-links branch from b225889 to 7cfd618 Compare November 8, 2023 14:50
Copy link
Member

@gsmet gsmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some additional guidance. HTH.

@leo-bogastry leo-bogastry force-pushed the add-error-message-generate-web-links branch from 13290d1 to a16f65b Compare November 8, 2023 16:06
Copy link
Member

@FroMage FroMage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some questions after looking at the code.

@quarkus-bot

This comment has been minimized.

@leo-bogastry
Copy link
Contributor Author

@gsmet @FroMage I'm taking another look at this and I am able to get all the fields and annotations of a class (and then search for the id or @Id) with this code snippet:

private void validateClassHasFieldId(IndexView index, DotName className) {
        List<FieldInfo> allFields = index.getClassByName(className).fields();
        List<AnnotationInstance> allAnnotations = index.getClassByName(className).annotations();
...

but this does not include the fields and annotations a class may inherit from another one.
Is there a way of accessing that? (I was only able to find a getAllKnownSubclasses method an similar)

@leo-bogastry
Copy link
Contributor Author

@gsmet @FroMage I took another look at this today and I found the information I was missing.
I updated the code to perform a validation before the creation of the web links that searches for fields named id or fields annotated with @Id in the current class and super classes.
In the tests I updated the TestRecord with another level of inheritance and also updated the documentation

@quarkus-bot

This comment has been minimized.

@leo-bogastry leo-bogastry force-pushed the add-error-message-generate-web-links branch from 3469e69 to 588376b Compare November 16, 2023 16:35
@quarkus-bot

This comment has been minimized.

Copy link
Member

@FroMage FroMage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is much better already, because it moved the validation to build time. There are a few details remaining to fix, but we're almost there :)

@leo-bogastry leo-bogastry force-pushed the add-error-message-generate-web-links branch from 588376b to 0a2558b Compare December 5, 2023 15:19
Copy link
Member

@FroMage FroMage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late review, this is getting better but there are still things to tweak.


// Id field not found but there's still hope
classInfo = index.getClassByName(superClassName);
if (superClassName != null && classInfo != null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, what happens if we have a superClassName but the superclass is not indexed? No error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, nothing would happen in that scenario. I added a check and exception for this case.

@quarkus-bot

This comment has been minimized.

Copy link
Member

@FroMage FroMage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, all comments were resolved, so this is looking good :)

@FroMage
Copy link
Member

FroMage commented Jan 3, 2024

Review is OK, but can you rebase and remove merge commits please? Then CI will tell us.

…sing configuration and improve documentation
@leo-bogastry leo-bogastry force-pushed the add-error-message-generate-web-links branch from 1278d02 to 1f1af0c Compare January 3, 2024 17:29
@leo-bogastry
Copy link
Contributor Author

Review is OK, but can you rebase and remove merge commits please? Then CI will tell us.

@FroMage PR all cleaned up 🧹

@FroMage FroMage merged commit 2e6fe10 into quarkusio:main Jan 4, 2024
23 checks passed
@quarkus-bot quarkus-bot bot added this to the 3.7 - main milestone Jan 4, 2024
@FroMage
Copy link
Member

FroMage commented Jan 4, 2024

Alright, done, thanks a lot for your patience !

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

Successfully merging this pull request may close these issues.

3 participants