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

Generate code using OpenAPI Specification, update Readme.md, Added 2 test cases. #2

Closed
wants to merge 62 commits into from

Conversation

Pranavan-S
Copy link
Contributor

@Pranavan-S Pranavan-S commented Jan 2, 2025

Purpose

Examples

Checklist

  • Linked to an issue
  • Updated the changelog
  • Added tests
  • Updated the spec
  • Checked native-image compatibility

@CLAassistant
Copy link

CLAassistant commented Jan 2, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 3 committers have signed the CLA.

✅ Pranavan-S
✅ MohamedSabthar
❌ maheshika
You have signed the CLA already but the status is still pending? Let us recheck it.

@Pranavan-S
Copy link
Contributor Author

Currently, I have added two test cases and am working on the others too.


* Original: `https://api.hubapi.com`
* Updated: `https://api.hubapi.com/crm/v3/objects/discounts`
* Reason: This change is made to ensure that all API paths are relative to the versioned base URL (crm/v3/objects/taxes), which improves the consistency and usability of the APIs.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Reason: This change is made to ensure that all API paths are relative to the versioned base URL (crm/v3/objects/taxes), which improves the consistency and usability of the APIs.
* Reason: This change is made to ensure that all API paths are relative to the versioned base URL (crm/v3/objects/taxes), which improves the consistency and usability of the APIs.

Copy link
Contributor Author

@Pranavan-S Pranavan-S Jan 7, 2025

Choose a reason for hiding this comment

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

README.md Outdated
properties: ["hs_label", "hs_value", "hs_type"]
};

CollectionResponseSimplePublicObjectWithAssociationsForwardPaging|error response = check hubspotClient->/.get({}, params);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
CollectionResponseSimplePublicObjectWithAssociationsForwardPaging|error response = check hubspotClient->/.get({}, params);
CollectionResponseSimplePublicObjectWithAssociationsForwardPaging response = check hubspotClient->/.get({}, params);

Copy link
Member

Choose a reason for hiding this comment

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

Avoid using error union type when using check expression
You can read more about check expression here: https://ballerina.io/learn/by-example/check-expression/

Check and update other places.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved.

Comment on lines 61 to 72
CollectionResponseSimplePublicObjectWithAssociationsForwardPaging|error response = check hubspotClient->/.get({}, params);
if response is CollectionResponseSimplePublicObjectWithAssociationsForwardPaging {
test:assertNotEquals(response.results, [], "No discounts found");
test:assertTrue(response.results.length() <= 10, "Limit Exceeded");
test:assertNotEquals(response.results[0].id, (), "Discount id is not found");
test:assertNotEquals(response.results[0].properties, (), "Discount properties are not found");
test:assertNotEquals(response.results[0].properties["hs_type"], (), "Discount label is not found");
test:assertNotEquals(response.results[0].properties["hs_value"], (), "Discount value is not found");
test:assertNotEquals(response.results[0].properties["hs_label"], (), "Discount type is not found");
} else {
test:assertFail("Error occurred while fetching discounts");
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
CollectionResponseSimplePublicObjectWithAssociationsForwardPaging|error response = check hubspotClient->/.get({}, params);
if response is CollectionResponseSimplePublicObjectWithAssociationsForwardPaging {
test:assertNotEquals(response.results, [], "No discounts found");
test:assertTrue(response.results.length() <= 10, "Limit Exceeded");
test:assertNotEquals(response.results[0].id, (), "Discount id is not found");
test:assertNotEquals(response.results[0].properties, (), "Discount properties are not found");
test:assertNotEquals(response.results[0].properties["hs_type"], (), "Discount label is not found");
test:assertNotEquals(response.results[0].properties["hs_value"], (), "Discount value is not found");
test:assertNotEquals(response.results[0].properties["hs_label"], (), "Discount type is not found");
} else {
test:assertFail("Error occurred while fetching discounts");
}
CollectionResponseSimplePublicObjectWithAssociationsForwardPaging response = check hubspotClient->/.get({}, params);
test:assertNotEquals(response.results, [], "No discounts found");
test:assertTrue(response.results.length() <= 10, "Limit Exceeded");
test:assertNotEquals(response.results[0].id, (), "Discount id is not found");
test:assertNotEquals(response.results[0].properties, (), "Discount properties are not found");
test:assertNotEquals(response.results[0].properties["hs_type"], (), "Discount label is not found");
test:assertNotEquals(response.results[0].properties["hs_value"], (), "Discount value is not found");
test:assertNotEquals(response.results[0].properties["hs_label"], (), "Discount type is not found");

check and update other places.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Other places are checked and resolved.

Comment on lines 63 to 69
test:assertNotEquals(response.results, [], "No discounts found");
test:assertTrue(response.results.length() <= 10, "Limit Exceeded");
test:assertNotEquals(response.results[0].id, (), "Discount id is not found");
test:assertNotEquals(response.results[0].properties, (), "Discount properties are not found");
test:assertNotEquals(response.results[0].properties["hs_type"], (), "Discount label is not found");
test:assertNotEquals(response.results[0].properties["hs_value"], (), "Discount value is not found");
test:assertNotEquals(response.results[0].properties["hs_label"], (), "Discount type is not found");
Copy link
Member

Choose a reason for hiding this comment

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

Instead of individually checking and validating these values, can't we compare the entire response with an expected response? if that's possible let's do that. And update the other test cases tool

Comment on lines 2 to 3
_Created_: 17th Dec 2024 \
_Updated_: 19th Dec 2024 \
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
_Created_: 17th Dec 2024 \
_Updated_: 19th Dec 2024 \
_Created_: 2024/12/17 \
_Updated_: 2024/12/17 \

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed.

@Pranavan-S
Copy link
Contributor Author

This PR was closed due to irrelevant commit history.

Refer this PR:
#3

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.

5 participants