nextcloud / openapi-extractor

A tool for extracting OpenAPI specifications from Nextcloud source code
https://docs.nextcloud.com/server/latest/developer_manual/client_apis/OCS/ocs-openapi.html
GNU Affero General Public License v3.0
7 stars 2 forks source link

fix(OpenApiType): Clean whitespace in description fields #160

Closed provokateurin closed 2 months ago

provokateurin commented 2 months ago

Fixes https://github.com/nextcloud/openapi-extractor/issues/140

provokateurin commented 2 months ago

The only diff in server:

diff --git a/apps/files_sharing/openapi.json b/apps/files_sharing/openapi.json
index 79462697883..eb57971be93 100644
--- a/apps/files_sharing/openapi.json
+++ b/apps/files_sharing/openapi.json
@@ -1755,7 +1755,7 @@
                                     "expireDate": {
                                         "type": "string",
                                         "nullable": true,
-                                        "description": "The expiry date of the share in the user's timezone at 00:00.\n               If $expireDate is not supplied or set to `null`, the system default will be used."
+                                        "description": "The expiry date of the share in the user's timezone at 00:00. If $expireDate is not supplied or set to `null`, the system default will be used."
                                     },
                                     "note": {
                                         "type": "string",
@@ -2271,7 +2271,7 @@
                                     "sendMail": {
                                         "type": "string",
                                         "nullable": true,
-                                        "description": "if the share should be send by mail.\n                   Considering the share already exists, no mail will be send after the share is updated.\n \t\t\t\t  You will have to use the sendMail action to send the mail."
+                                        "description": "if the share should be send by mail. Considering the share already exists, no mail will be send after the share is updated. You will have to use the sendMail action to send the mail."
                                     }
                                 }
                             }
nickvergessen commented 2 months ago

Should we allow new lines? I can see how it can help to improve readability? But it seems ocs_api_viewer doesnt render them anyway? grafik

provokateurin commented 2 months ago

Sometimes the newlines are also not really there for readability and just to break the comment into multiple lines because it got too long. This makes sense for the phpdoc, but if displayed somewhere else the newline might be placed in an odd place. So I don't think it is really possible to have sensible newlines, and as you already figured out they are not supported by every tool anyway.

nickvergessen commented 2 months ago

So I don't think it is really possible to have sensible newlines, and as you already figured out they are not supported by every tool anyway.

I was thinking about "markdown style", so 2 direct newlines => real newline But yeah doesn't work for parameter docs anyway