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

Adding Typescript Schema types into the comments #246

Open
RadientBrain opened this issue Mar 16, 2023 · 3 comments
Open

Adding Typescript Schema types into the comments #246

RadientBrain opened this issue Mar 16, 2023 · 3 comments

Comments

@RadientBrain
Copy link

How to add a predefined type objects already defined in a Typescript file to render it for the POST body request via the comments? Similar feature is present in "gin-swagger" but that is for golang, I thought that kind of feature should also be added here.
Any ideas on it? @kevinccbsg @wbw20 @ciprian1234 @meabed

Like below is the comment I want to write which should generate the type defined (here Activity is a Schema type object):

/**
* POST /activity/add
* @param {Activity} request.body.required - Activity type
**/

or just an additional line like this in the existing defined comments:
@schema Activity activity_description

The Activity type is defined as follows:

export type Activity = {
    wakeup: string;
    goto: string;
    runfor: number;
}

So, at last it should generate the whole Activity Schema without me defining each and every detail of the type again into the comments.

@baronnoraz
Copy link

Has anyone figured out a way to work around this? I have types from a shared folder that aren't in a *.d.ts file. I was really hoping to just do as @RadientBrain suggested.

* @param {Activity} request.body.required - Activity type

@tvsj
Copy link

tvsj commented Mar 6, 2024

我也想要这个功能,但目测只能自己实现了

@RadientBrain
Copy link
Author

这是一个很好的主动性!如果在实现这个功能时你需要任何帮助或遇到任何问题,随时向我们提问。我们在这里帮助你!

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