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

How to write summary of API in Swagger? #256

Closed
kakasoo opened this issue Feb 22, 2023 · 5 comments
Closed

How to write summary of API in Swagger? #256

kakasoo opened this issue Feb 22, 2023 · 5 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@kakasoo
Copy link
Contributor

kakasoo commented Feb 22, 2023

In English.

Hello. First of all, thank you for this amazing library.

I'm going to fill out the Swagger document and hand it over to the front developer. However, since there is no way to display a summary on each API of the swagger document, there is a problem that you have to infer by looking at the resource name of the API and the path written in RESTful.
If the first line of the top comment of the controller method is recognized as a summary, I think I can understand the document faster.

/**
 * it's very important API -> it will be summary of API document.
 *
 * if you want to use... -> description of API document.
 *
 * @param id
 * @returns true, just return true. that's all.
 */
@TypedRoute.Post(':id')
async nestiaTest(@TypedParam('id', 'number') id: number) {
  return true;
}

In Korean.

안녕하세요. 우선 이런 좋은 라이브러리를 만들어주신 데에 감사드립니다.

저는 현재 스웨거 문서를 작성하여 프론트 개발자에게 넘기려고 합니다. 다만 swagger 문서의 각 API 상에서 summary를 표시할 방법이 없다 보니 API의 리소스 이름과 RESTful하게 작성되어 있는 경로를 보고 유추해야 하는 문제가 있습니다.
만약 controller method의 상단 주석 첫 줄을 summary로 인식하게 해준다면 더 빠르게 문서를 이해할 수 있을 거라고 생각합니다.

/**
 * it's very important API -> it will be summary of API document.
 *
 * if you want to use... -> description of API document.
 *
 * @param id
 * @returns true, just return true. that's all.
 */
@TypedRoute.Post(':id')
async nestiaTest(@TypedParam('id', 'number') id: number) {
  return true;
}
@kakasoo kakasoo changed the title How to write summary of Swagger API document? How to write summary of API in Swagger? Feb 22, 2023
@samchon samchon self-assigned this Feb 22, 2023
@samchon samchon added enhancement New feature or request documentation Improvements or additions to documentation good first issue Good for newcomers and removed documentation Improvements or additions to documentation labels Feb 22, 2023
@samchon samchon closed this as completed in 8dfac1e Mar 9, 2023
samchon added a commit that referenced this issue Mar 9, 2023
Close #256 - support summary property of swagger
@samchon
Copy link
Owner

samchon commented Mar 9, 2023

Update to @nestia/sdk@1.0.14, then it works.

@kakasoo
Copy link
Contributor Author

kakasoo commented Mar 9, 2023

Cool! I can't wait to see this right now! Thank you!

@kakasoo
Copy link
Contributor Author

kakasoo commented Mar 11, 2023

@samchon

In my project, the summary is partially applied. I can't predict under what circumstances this is created in. I tried to create a virtual project and show you this situation instead of showing the code of my actual project, but I can't reproduce this situation. Summary is not visible in all APIs.
However, what I thought was a summary sometimes appears in the description with a new line.

In Korean
제 프로젝트에서 현재 summary가 부분적으로만 나타납니다. 어떻게 작성해야만 이게 생성되는지 예측이 안되네요. 일단 제 프로젝트 코드를 보여주는 것 대신 임의의 프로젝트를 만들어서 코드를 보여주려고 했는데, 여기서는 같은 상황이 재현되질 않습니다. summary가 모든 API에서 안나타나고 있습니다.
다만 제가 summary를 의도한 게 줄바꿈 문자를 포함하여 설명에서 나오는 경우가 있습니다.

git clone https://github.com/kakasoo/nestia-demo
cd nestia-demo
git switch nestia#256-2
npm i
npx nestia swagger
npm run start:dev

image

@samchon
Copy link
Owner

samchon commented Mar 11, 2023

Use . symbol before new line.

This line would be summary.

After the dot and new line, they would not be added into the summary.

@summary tag also can be used

@kakasoo
Copy link
Contributor Author

kakasoo commented Mar 12, 2023

OK, thanks! I'll do it right away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants