-
Notifications
You must be signed in to change notification settings - Fork 1
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
Client generation with required sanitization #3
Conversation
Co-authored-by: Sumudu Nissanka <lnash94@users.noreply.github.com>
…ts with empty body
…napi-definition-from-a-collection-with-the-postman-api/ and removing the OAS YAML generated using https://p2o.defcon007.com/, and re-generated the client
… to centralize the versioning to the base URL
@rahul1995, This generated OpenAPI looks good 😃, Here I have noticed a few improvements we can add.
ex: some sample for the inline schema "requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"photo": {
"type": "object",
"properties": {
".tag": {
"type": "string",
"example": "base64_data"
},
"base64_data": {
"type": "string",
"example": "SW1hZ2UgZGF0YSBpbiBiYXNlNjQtZW5jb2RlZCBieXRlcy4gTm90IGEgdmFsaWQgZXhhbXBsZS4="
}
}
}
}
}, After modified , "component": {
"schemas": {
"ProfilePhoto": {
"schema": {
"type": "object",
"properties": {
"photo": {
"type": "object",
"properties": {
".tag": {
"type": "string",
"example": "base64_data"
},
"base64_data": {
"type": "string",
"example": "SW1hZ2UgZGF0YSBpbiBiYXNlNjQtZW5jb2RlZCBieXRlcy4gTm90IGEgdmFsaWQgZXhhbXBsZS4="
}
}
}
}
},
...
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/component/schemas/ProfilePhoto"
}
}
}
}, |
@lnash94 Thanks for the review. I agree with your comment, but this is like 35k lines of json file. It's looking infeasible for me to finish it as an individual. Can I improve some main API endpoints for now and take this as a task for later (distributed among other folks if possible)? |
…ox-api-select-admin` parameters and reuse across API endpoints
Hi @rahul1995, Yeah, it is understandable that this has a lot of endpoints. Until we provide the set of operations, I can bring some workarounds to you to address the pain points here.
Please Note: during every modification lets check the modified details in the API is align with the original API documentation 😊. |
@lnash94 Thanks for sharing this method. It will save a lot of time. Since these many will take a while, I have created a commit with a few renamed so that I get an early review on this. |
0e65efb
to
d493a13
Compare
Yeah sure , I will review :) |
@rahul1995, avoiding using verbs as prefixes in record names is generally recommended. The best practice is to focus on the state or data the record represents rather than the action performed on it. Shall we simplify the object name by minimizing the action verb for clarity and alignment with Ballerina's name? ex: AddPropertiesRequest -> NewPropertiesRequest, PropertiesRequest Please check and apply this to other relevant places. |
@lnash94 I have made it like this only, it is that sometimes a particular API endpoint requires a specific format of request, that is where I am also creating records specific to that request body and naming it with verb. For example, I first created a record/schema I have used the same practices as done in https://github.com/ballerina-platform/module-ballerinax-twitter/blob/main/docs/spec/openapi.json |
Hey @lnash94 thanks for the review :) I cleaned up a little bit and added PRs for tests, examples, and documentations. For the Schema naming, the current strategy is also in line with the Dropbox's official documentation, i.e. Dropbox also uses same naming conventions ( |
Hi @rahul1995
Let's proceed with the process ( |
Thanks @lnash94. I have exactly matched these names as given in the documentation. Please review. Also, I am open to contribute further outside of Hacktoberfest if needed :) |
55455e5
to
c299ce9
Compare
c299ce9
to
fefd8fe
Compare
Co-authored-by: Sumudu Nissanka <lnash94@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Purpose
To create the OpenAPI spec, sanitize it to make compatible with Ballerina OpenAPI tool, and generate Client using it.
Issue Title: Introduce a Ballerina connector for Dropbox REST API
Issue link: ballerina-platform/ballerina-library#7054
Examples
Checklist