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

Access docs from type reflections #7181

Open
Chriscbr opened this issue Sep 30, 2024 · 0 comments
Open

Access docs from type reflections #7181

Chriscbr opened this issue Sep 30, 2024 · 0 comments
Labels
🛠️ compiler Compiler ✨ enhancement New feature or request 🎨 sdk SDK

Comments

@Chriscbr
Copy link
Contributor

Chriscbr commented Sep 30, 2024

Use Case

As a user, when I use the @type intrinsic to reflect on a type, I'd like to be able to access any docstrings (///) associated with the type.

API sketch:

/// An order made by the user
struct Order {
  /// A unique UUID
  id: str;
  /// A positive integer
  ///
  /// This docstring has multiple lines
  /// @default 1
  qty: num?;
}

let o = @type(Order)
if let st = o.asStruct() {
  assert(st.docs == "An order made by the user");
  let qtyField = st.fields["qty"];
  assert(qtyField.docs == "A positive integer\n\nThis docstring has multiple lines");
  assert(qtyField.docTags["default"] == "1");
}

Proposed Solution

No response

Implementation Notes

No response

Component

Compiler

Community Notes

  • Please vote by adding a 👍 reaction to the issue to help us prioritize.
  • If you are interested to work on this issue, please leave a comment.
  • If this issue is labeled needs-discussion, it means the spec has not been finalized yet. Please reach out on the #dev channel in the Wing Discord.
@Chriscbr Chriscbr added ✨ enhancement New feature or request 🎨 sdk SDK 🛠️ compiler Compiler labels Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🛠️ compiler Compiler ✨ enhancement New feature or request 🎨 sdk SDK
Projects
None yet
Development

No branches or pull requests

1 participant