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

feat(api):better TransactionState.TransactionState->TransactionState.… #284

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

arc0035
Copy link

@arc0035 arc0035 commented Nov 24, 2023

I'm developing java sdk, when I try to generate java classes due to proto, it would generate illegal java code.

This is because tx_types.proto defines TransactionState alongwith enum TransactionState:

message TransactionState {
TransactionId id = 1;
enum TransactionState {
TRANSACTION_STATE_UNSPECIFIED = 0; // default state
TRANSACTION_STATE_REJECTED = 1; // rejected from mempool due to, e.g., invalid syntax
TRANSACTION_STATE_INSUFFICIENT_FUNDS = 2; // rejected from mempool by funds check
TRANSACTION_STATE_CONFLICTING = 3; // rejected from mempool due to conflicting counter
TRANSACTION_STATE_MEMPOOL = 4; // in mempool but not on the mesh yet
TRANSACTION_STATE_MESH = 5; // submitted to the mesh
TRANSACTION_STATE_PROCESSED = 6; // processed by STF; check Receipt for success or failure
}
TransactionState state = 2;
}
It would generate this form of java code which is illegal in Java:
image

A fast way to optimize this is to change the name of the enum: TransactionState.TransactionState->TransactionState.TramsactionStateEnum

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

Successfully merging this pull request may close these issues.

1 participant