Skip to content

Suffix formatter#95

Open
royrahulop wants to merge 24 commits intoappform-io:id-v2from
royrahulop:suffix_formatter
Open

Suffix formatter#95
royrahulop wants to merge 24 commits intoappform-io:id-v2from
royrahulop:suffix_formatter

Conversation

@royrahulop
Copy link
Copy Markdown

@royrahulop royrahulop commented Jan 16, 2026

We have introduced the V2 version of IDFormatters which works on IDs which have prefix only with Alphabets. Going forward we are introducing construct of suffix appending in the IDs generated.

Why Suffix Needed?

  • Suffix are client level custom strings which can hold logics appended in string which can serve different use case.
    This change is introduced to support business isolation use case where ID holds the custom logic in suffix to decide which zone to route this transaction.

Formatters Introduced -

  • Default_V2 - Formatter that supports id generation with suffix support.
  • Base_36 - Formatter that converts date of 15 length into base 36 and then appends in the original ID. This is done to reduce the length of the IDs.
  • Random Nonce - This formatter is a nonce flavour for each id generated. Going forward more flavours of nonce formatting can be added, changing the formatting and parsing of IDs

Parses -

  • We have introduced ParserV2 which will handle V2 Ids generation formats while routing the older IDs to the older format.

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
4.9% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@r0goyal r0goyal self-requested a review April 3, 2026 11:29
*
* @param node the node identifier to use
*/
public static void initialize(int node) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This method may not be needed since this method was used only in bundle class (internal to this lib)

));

public static Optional<Integer> findValue(final IdFormatter formatter, final List<IdDecorator> decorators) {
val safeDecorators = decorators != null ? decorators : List.of();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Under what scenario do we expect list of decorators to be null ?

*/
@Override
public Optional<String> parse(final String idString) {
val matcher = PATTERN.matcher(idString);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Base36 decorator should only care about decoding from base36 to base10 and not about the format of overall ID.

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.

2 participants