-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswagger_notes.txt
More file actions
51 lines (29 loc) · 1 KB
/
swagger_notes.txt
File metadata and controls
51 lines (29 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Swagger is a Tool to
- Develop API
- Interact with API
- Document APIs using Swagger UI
- Generates Auto generated API document from the meta data in the code
- Can generate in multiple forms like json, html
- When API changes, developer just need to update the API metadata. Swagger will update the documentation automatically
- Now it is called as OpenAPI 3
Steps
1. Add Swagger Spring Dependency
2. Enabling swagger in the code
3. Configure Swagger
4. Add details as annotations to API
Endpoint for accessing docs as json
http://localhost:8080/v2/api-docs
Endpoint for accessing docs as html
http://localhost:8080/swagger-ui.html
Docket Object
- Contains all information about the config
- Docket Object
Lof of annotations provided like
@ApiOperation
@ApiParam
@ApiModel
@ApiModelProperty
Drawbacks
- Lot of annoying annotations which increase the number of lines of code
- In case of circular dependencies between model objects, swagger wont work
The alternative option is to use Spring Rest Docs