Skip to content

feat: new validations#45

Merged
Alex-GF merged 2 commits intodevelopfrom
fix/pricing-parser
Mar 27, 2025
Merged

feat: new validations#45
Alex-GF merged 2 commits intodevelopfrom
fix/pricing-parser

Conversation

@javiercavlop
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds new validations for parsing feature configurations and usage limits. It improves error messages by including supported value options and validates integration, automation, and payment types.

  • Update error messages in UsageLimitParser and FeatureParser with detailed supported type listings.
  • Introduce explicit checks for integrationType and automationType attributes.
  • Add validation for default payment type values ensuring proper list structure.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/main/java/io/github/isagroup/services/parsing/UsageLimitParser.java Enhanced error message for invalid valueType in usage limits.
src/main/java/io/github/isagroup/services/parsing/FeatureParser.java Improved error messages and validations for integration, automation, and payment types.

@javiercavlop javiercavlop requested a review from Copilot March 27, 2025 11:32
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces new validations for parsing usage limits, integrations, automations, and payment types with enhanced error messages that include supported values.

  • Updated error messages for valueType in usage limits and features.
  • Added explicit handling of integrationType and automationType attributes with new exceptions.
  • Enhanced payment parsing validation by ensuring the default value is a list of payment types.

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/main/java/io/github/isagroup/services/parsing/UsageLimitParser.java Updated error message to include supported value types.
src/main/java/io/github/isagroup/services/parsing/FeatureParser.java Introduced explicit retrieval and validation for integrationType, automationType, and payment default values with enhanced exception messages.
Files not reviewed (1)
  • src/test/resources/negative-parsing-tests.csv: Language not supported
Comments suppressed due to low confidence (2)

src/main/java/io/github/isagroup/services/parsing/FeatureParser.java:92

  • Instead of using a try-catch for retrieving integrationType (which does not throw a NullPointerException when missing), consider checking if map.get('integrationType') is null and then throwing the exception accordingly.
String integrationType = "";

src/main/java/io/github/isagroup/services/parsing/FeatureParser.java:272

  • Consider verifying that map.get('defaultValue') is not null before casting to List, as a null value may lead to a NullPointerException during iteration.
List<String> allowedPaymentTypes;

Comment on lines +128 to +131
String automationType = "";
try{
automationType = (String) map.get("automationType");
} catch (NullPointerException e) {
Copy link

Copilot AI Mar 27, 2025

Choose a reason for hiding this comment

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

Similarly, rather than catching a NullPointerException when obtaining automationType, use an explicit null-check on map.get('automationType') before proceeding.

Suggested change
String automationType = "";
try{
automationType = (String) map.get("automationType");
} catch (NullPointerException e) {
String automationType = (String) map.get("automationType");
if (automationType == null) {

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator

@Alex-GF Alex-GF left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! Everything is fine.

@Alex-GF Alex-GF merged commit cfc88f3 into develop Mar 27, 2025
1 check passed
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.

3 participants