Skip to main content

Swagger

Metadata
Lecture equivalentDuration
21h 30min

At the end of this task, students

  • have added Swagger to their spring-starter to automatically generate the REST API documentation

Listen

Task

Watch this ๐Ÿ‘‡๐Ÿผ

Then answer in a simple statement the following questions:

  • Does it make sense to add a CHANGELOG.md to spring-starter?
    • If yes, why?
    • If no, why and how else will you document the project?

Read

Task

Read semver.org and agree its boring to read, yet again it is โ—๏ธ crucial in our world!

Check these two videos to your extent to make sure you understood semver:

Code

Task

Add Swagger to your spring-starter using Setting Up Swagger 2 with a Spring REST API from baeldung.

  • Step 8 ff. you do not have to do, they are too advanced and do not suit our use case for now.
  • If you want to have a take at OpenAPI 3.0, try this tutorial.

No password?

If you apply the changes correctly, your API should ask for a password to see the docs, go back to spring-starter to remember why.

.antMatchers("/swagger-ui/**", "/v2/api-docs", "/swagger-resources/**").permitAll()

๐Ÿ‘†๐Ÿฝ will actually make your docs public, if you want that ๐Ÿ˜

Sample

You can find the sample solution here.