{
"title": "My Angular App API Documentation",
"sourceDir": "src/app",
"exportFormats": ["swagger"]
}
注解服务
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
/**
* A service for interacting with the My API.
*/
@Injectable({
providedIn: 'root'
})
export class MyApiService {
/**
* Retrieves the list of users.
* @returns An observable that emits the list of users.
*/
getUsers() {
return this.http.get<User[]>('/api/users');
}
constructor(private http: HttpClient) { }
}
1条答案
按热度按时间41zrol4v1#
compodoc
应该能够通过以下添加到Angular服务方法的JSDoc注解生成json。https://compodoc.github.io/compodoc-demo-todomvc-angular/index.html然后可以馈送到swagger。npm install -g @compodoc/compodoc
然后配置compdoc
注解服务
生成swagger.json
输出文件可以然后给BE的家伙?