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

Add computed value in annotations #125

Open
sikelio opened this issue Sep 2, 2024 · 3 comments
Open

Add computed value in annotations #125

sikelio opened this issue Sep 2, 2024 · 3 comments

Comments

@sikelio
Copy link

sikelio commented Sep 2, 2024

Hi ! Amazing addon lib !

I would like to know if it's possible to add the possibility of getting @computed()?
In my case i have the following:

/**
 * @all
 * @summary Returns a list of all users
 * @responseBody <200> - <User[]> - List of users
 */
async all({ response }: HttpContext) {}

My model User has some computed values like:

@computed()
get followingCount(): number {
  return this.followings ? this.followings.length : 0;
}

@computed()
get followerCount(): number {
  return this.followers ? this.followers.length : 0;
}

@computed()
get likesReceived(): number {
  return this._likesReceived === null ? 0 : this._likesReceived;
}

But they didn't appear :'(

image

@MuaDDuB
Copy link
Contributor

MuaDDuB commented Sep 6, 2024

Hum, seems like a regression as it used to work in the past.

@MuaDDuB
Copy link
Contributor

MuaDDuB commented Sep 6, 2024

Ok, my bad, just put a public before your get and it will be parsed.

image

@ad-on-is
Copy link
Owner

ad-on-is commented Sep 6, 2024

I think I could add an additional clause checking for "get ", since it's always public

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

3 participants