这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.baeldung.swaggeryml;

import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;

@SpringBootApplication
public class SwaggerYMLApplication {
public static void main(String[] args) {
new SpringApplicationBuilder(SwaggerYMLApplication.class)
.properties("spring.config.name=application-yml")
.run(args);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
spring.application.name=swaggeryml
springdoc.api-docs.enabled=true
springdoc.api-docs.path=/v3/api-docs
springdoc.api-docs.resolve-schema-properties=false
springdoc.swagger-ui.url=/openapi.yml
springdoc.swagger-ui.path=/swagger-ui.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
type: object
properties:
id:
type: integer
format: int64
name:
type: string
rollNo:
type: string
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
openapi: 3.1.0
info:
title: Student API
description: Following documentation explain the API's supported by the [student server](http://localhost:8080).
version: 1.1.9
servers:
- url: http://localhost:8080/v1
description: Prod server
variables:
region:
default: us-west
enum:
- us-west
- us-east
- url: http://localhost:8080/test
description: Test server
paths:
/students:
get:
tags:
- Students
summary: Returns all the students.
description: Following path gives all the data related to students
responses:
"200":
description: A JSON array of student objects
content:
application/json:
schema:
type: array
items:
$ref: './components/schemas/Student.yml'
/students/{id}:
get:
tags:
- Students
summary: Gets a student by ID.
description: >
Gives the details of specific student based on **ID**
operationId: getStudentById
parameters:
- name: id
in: path
description: Student ID
required: true
schema:
type: integer
format: int64
responses:
"200":
description: Successful operation
content:
application/json:
schema:
$ref: './components/schemas/Student.yml'
externalDocs:
description: Learn more about student operations provided by this API.
url: http://localhost:8080/swagger-ui/index.html