当前位置: 首页 > news >正文

做早餐的网站网站建设哪个公司好

做早餐的网站,网站建设哪个公司好,微官网入口,html网站底部导航栏怎么做文章目录 一、引入依赖二、使用1. OpenAPIDefinition Info2. Tag3. Operation4. Parameter5. Schema6. ApiResponse swagger2更新到3后&#xff0c;再使用方法上发生了很大的变化&#xff0c;名称也变为OpenAPI3。 官方文档 一、引入依赖 <dependency><groupId>…

文章目录

  • 一、引入依赖
  • 二、使用
      • 1. @OpenAPIDefinition + @Info
      • 2. @Tag
      • 3. @Operation
      • 4. @Parameter
      • 5. @Schema
      • 6. @ApiResponse

swagger2更新到3后,再使用方法上发生了很大的变化,名称也变为OpenAPI3

官方文档

一、引入依赖

            <dependency><groupId>org.springdoc</groupId><artifactId>springdoc-openapi-starter-webmvc-ui</artifactId><version>${springdoc-openapi.version}</version></dependency>
server:servlet:context-path: /content
springdoc:api-docs:enabled: truepath: /v3/api-docsswagger-ui:enabled: truepath: /swagger-ui.html

openapi3使用十分方便,做到这里后,你可以直接通过以下网址访问swagger页面。

http://<ip>:<port>/content/swagger-ui/index.html

在这里插入图片描述

二、使用

1. @OpenAPIDefinition + @Info

用于定义整个 API 的信息,通常放在主应用类上。可以包括 API 的标题、描述、版本等信息。

@SpringBootApplication
@Slf4j
@OpenAPIDefinition(info = @Info(title = "内容管理系统", description = "对课程相关信息进行管理", version = "1.0.0"))
public class ContentApplication {public static void main(String[] args) {SpringApplication.run(ContentApplication.class, args);}
}

2. @Tag

用于对 API 进行分组。可以在控制器类或方法级别上使用。

@Tag(name = "课程信息编辑接口")
@RestController("content")
public class CourseBaseInfoController {
}

3. @Operation

描述单个 API 操作(即一个请求映射方法)。可以提供操作的摘要、描述、标签等。

    @Operation(summary = "课程查询接口")@PostMapping("/course/list")public PageResult<CourseBase> list(PageParams params,@RequestBody(required = false) QueryCourseParamsDto dto){CourseBase courseBase = new CourseBase();courseBase.setCreateDate(LocalDateTime.now());return new PageResult<CourseBase>(new ArrayList<CourseBase>(List.of(courseBase)),20, 2, 10);}

在这里插入图片描述

4. @Parameter

用于描述方法参数的额外信息,例如参数的描述、是否必需等。

    @Operation(summary = "课程查询接口")@PostMapping("/course/list")public PageResult<CourseBase> list(@Parameter(description = "分页参数") PageParams params,@Parameter(description = "请求具体内容") @RequestBody(required = false) QueryCourseParamsDto dto){CourseBase courseBase = new CourseBase();courseBase.setCreateDate(LocalDateTime.now());return new PageResult<CourseBase>(new ArrayList<CourseBase>(List.of(courseBase)),20, 2, 10);}

在这里插入图片描述

5. @Schema

描述模型的结构。可以用于类级别(标注在模型类上)或字段级别。

@Data
@AllArgsConstructor
@NoArgsConstructor
public class PageParams {//当前页码@Schema(description = "页码")private Long pageNo = 1L;//每页记录数默认值@Schema(description = "每页条目数量")private Long pageSize =10L;
}

在这里插入图片描述

6. @ApiResponse

描述 API 响应的预期结果。可以指定状态码、描述以及返回类型。

@ApiResponse(responseCode = "200", description = "Successfully retrieved user")
public User getUserById(@PathVariable Long id) {
}

在这里插入图片描述

http://www.hkea.cn/news/847217/

相关文章:

  • 网站建设就业百度网址导航主页
  • 郑州公司做网站汉狮中囯联通腾迅
  • 专业网上购物平台优化网站的步骤
  • 用web开发一个网站怎么做网站推广优化平台
  • 建设企业网站进去无法显示搜索引擎seo
  • 网站 分辨率百度视频推广
  • 中国红河网seo排名工具
  • 做网站商丘3a汽车集团公司网络营销方案
  • 网络宣传推广策划范文seo如何优化排名
  • 网站 建设 原则新闻今天的最新新闻
  • 服装网站首页设计主要推广手段免费
  • 网站建设公司做销售好不好?seo搜索引擎优化实训总结
  • 江西威乐建设集团有限公司企业网站长春关键词优化公司
  • 深圳网站建设lxhd英文关键词seo
  • 在线购物商城网站百度移动端排名软件
  • 太原网站的公司友情链接的英文
  • 网站是用什么做的吗百度q3财报2022
  • 深圳福田网站建设公司如何做谷歌seo推广
  • 西安有做网站的吗北京网站设计公司
  • 哪家专门做特卖网站平台连接
  • 衢州网站推广最近发生的重大新闻
  • 网页设计的网站配色方案seo基础培训机构
  • 维护网站是什么工作淄博网站制作
  • 做电影下载网站成本淘宝关键词排名
  • 企业h5网站建设百度推广电话是多少
  • 中国保密在线网站培训系统软文怎么做
  • 山西住房城乡建设部网站整合网络营销是什么
  • 做美图网站有哪些东西吗个人博客seo
  • 南昌专业做网站公司竞价托管怎么做
  • 网站产品展示怎么做微信小程序建站