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

False warning for assumed (required) ID of entity state with the int32 type #161

Open
alexander-yevsyukov opened this issue Nov 25, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@alexander-yevsyukov
Copy link
Collaborator

alexander-yevsyukov commented Nov 25, 2024

An ID field of an entity state is assumed to be (required). We don't have to declare such a field with the option explicitly.

An ID could be of int32 or other type which could not have the (required) option because of the nature of the type. If this is such a case, we should not emit the warning to console, but we do. Here's what the build of core-java produces:

`CommandRouting` should > apply custom route() STANDARD_ERROR
    Nov 25, 2024 7:09:00 PM io.spine.validate.option.Required checkUsage
    WARNING: The field `spine.test.route.RegisterUser.id` has the type UINT64 and should not be declared as `(required)`.

This happens because the stub entity state used in the CommandRoutingRejectionTest is declared like this:

message NumberStats {
    option (entity).kind = VIEW;
    int32 number = 1;
    int32 count = 2;
}

Validation should not cause console warnings for IDs being of primitive types.

The issue with the warning text

Another aspect of this issue is the test of the warning message. Now it says:

The field `spine.test.route.RegisterUser.id` has the type UINT64 and should not be declared as `(required)`.

The text is misleading. The entity state does not have the (required option. The field is assumed to be required because it's the convention for entity states that we have. The text of the warning should be updated in the scope of addressing the issue.

@alexander-yevsyukov alexander-yevsyukov added the bug Something isn't working label Nov 25, 2024
@alexander-yevsyukov alexander-yevsyukov self-assigned this Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant