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

Include parameter details in Swift docstrings #109

Closed
PeterJCLaw opened this issue Dec 21, 2024 · 2 comments
Closed

Include parameter details in Swift docstrings #109

PeterJCLaw opened this issue Dec 21, 2024 · 2 comments

Comments

@PeterJCLaw
Copy link

Currently the generated docstrings for at least Swift do not contain the descriptions available for fields, though these are included in the generated Java & TypeScript code. Event level docstrings are generated in each case using the relevant descriptions.

It would be great if the generated docstrings could include all the documentation information available from the plan.

Given:

{
  "createdAt": "2024-12-09T17:00:00.000Z",
  "creationType": "Data catalog",
  "description": "",
  "id": "redacted",
  "name": "Test",
  "rules": {
    "events": [
      {
        "description": "Records that the user added an item to their bag",
        "eventType": "track",
        "name": "action-add-to-bag",
        "rules": {
          "$defs": {},
          "$schema": "http://json-schema.org/draft-07/schema#",
          "description": "",
          "properties": {
            "properties": {
              "additionalProperties": false,
              "properties": {
                "article_id": {
                  "description": "Identifier for the article displayed on the page.",
                  "pattern": "^\\d{4}",
                  "type": ["string"]
                },
                "sku": {
                  "description": "The SKU of the selected size being added to bag.",
                  "pattern": "^\\d{5}",
                  "type": ["string"]
                }
              },
              "required": ["article_id", "sku"],
              "type": "object"
            }
          },
          "type": "object"
        }
      }
    ]
  },
  "updatedAt": "2024-12-21T00:18:00.00Z",
  "version": 13,
  "workspaceId": "redacted"
}

Actual:

    /// Records that the user added an item to their bag
    static func actionAddToBag(articleId: String, sku: String, options: RSOption? = nil) {
        var properties = [String: Any]()
        properties["article_id"] = articleId;
        properties["sku"] = sku;

        // ...
    }

Desired (approximate -- note I am not a Swift expert):

    /**
     Records that the user added an item to their bag

     - Parameters:
         - articleId: Identifier for the article displayed on the page.
         - sku: The SKU of the selected size being added to bag.
    */
    static func actionAddToBag(articleId: String, sku: String, options: RSOption? = nil) {
        var properties = [String: Any]()
        properties["article_id"] = articleId;
        properties["sku"] = sku;

        // ...
    }

It would also be great if the docstring could be present on all overloads, not just the one which takes options.

@contributor-support
Copy link

Thanks for opening this issue! We'll get back to you shortly. If it is a bug, please make sure to add steps to reproduce the issue.

@akashrpo
Copy link

The fix is released in the PR #118. Thanks for raising the issue.

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

No branches or pull requests

2 participants