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

Update to Application of @param doc #2233

Closed
timotheeguerin opened this issue Jul 31, 2023 · 0 comments · Fixed by #3517
Closed

Update to Application of @param doc #2233

timotheeguerin opened this issue Jul 31, 2023 · 0 comments · Fixed by #3517
Assignees
Labels
compiler:core Issues for @typespec/compiler
Milestone

Comments

@timotheeguerin
Copy link
Member

This is the implementation issue for the 2nd part of the design issue #1946

Logic would be as follow: (✅ means we are already doing that, ➡️ are new steps)

  • ✅ Start checking operation
  • ➡️ For each @param found register the decorator on the operation parameter symbol(as an augment decorator)
  • ✅ Check if op is and resolve source operation
  • ✅ Check parameters
    • ✅ resolve any spread model
    • ✅ finish each property
      • ✅ resolve augment decorators for the property. This means it would now include the value included by @param
  • ✅ finish creating operation

Test cases

/**
 * @param one Doc comment
 */
op base(one: string): void;
// getDoc(base.one) === "Doc Comment"
/**
 * @param one Doc comment
 */
op base(@doc("Explicit") one: string): void;
// getDoc(base.one) === "Explicit"
/**
 * @param one Doc comment
 */
op base(one: string): void;

@@doc(base::parameters.one, "Override");
// getDoc(base.one) === "Override"
/**
 * @param one Doc comment
 */
op base(one: string): void;

op child is base;

// getDoc(child.one) === "Doc Comment"
/**
 * @param one Doc comment
 */
op base(one: string): void;


/**
 * @param one Override for child
 */
op child is base;

// getDoc(child.one) === "Override for child"
/**
 * @param one Doc comment
 */
op base(one: string): void;


/**
 * @param one Override for child
 */
op child is base;

@@doc(child::parameters.one, "Override for child again")
// getDoc(child.one) === "Override for child again"
model A {
  @doc("Via model") one: string
}
op base(...A): void;

// getDoc(base.one) === "Via model"
model A {
  @doc("Via model") one: string
}
/**
 * @param one Doc comment
 */
op base(...A): void;

// getDoc(base.one) === "Doc Comment"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:core Issues for @typespec/compiler
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants