Chcę utworzyć dokumentację Swagger dla istniejącego zestawu interfejsów API RESTful. Mam następujący warunek:Używanie dokumentacji Javadocs do generowania dokumentu Swagger
- Generowanie Swagger Doc offline (użyłem http://kongchen.github.io/swagger-maven-plugin/). Ta wtyczka pomaga mi generować dokumentację Swagger podczas kompilacji.
- Odczytywanie istniejącej dokumentacji Javadoc, aby można było jej używać w dokumentacji Swagger.
tej pory przy użyciu powyższej wtyczki udało mi się osiągnąć punkt nr 1. Tak dla istniejącej metody rekreacyjne:
/**
* <p>
* Gets the {@link DisplayPreferenceModel} with the name as provided in the parameter. The preference with the given name defined at the tenant or master level is returned.
* This API gives us the preference if it is eligible for unauthorized access If it is not eligible it throws an Exception saying Authorization required.
* </p>
* @param preferenceName
* - The name of the preference.
* @return {@link DisplayPreferenceModel}
*/
@RequestMapping(method = RequestMethod.GET, value = "/preferences/{preferenceName}")
@ApiOperation(value = "This API gives us the preference if it is eligible for unauthorized access If it is not eligible it throws an Exception saying Authorization required",
notes = "No Notes please", response = DisplayPreferenceModel.class)
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid preferenceName supplied"),
@ApiResponse(code = 404, message = "Display Preference Not Found")
}
)
public DisplayPreferenceModel getDisplayPreference(@PathVariable("preferenceName") final String preferenceName) {
}
byłem w stanie wygenerować dokumentację Swagger. Korzystanie z @ApiOperation & @ ApiResponses sprawia, że moja dokumentacja wygląda świetnie.
Jednak moje pytanie brzmi: czy mogę użyć Javadocs zamiast tworzyć każdego dewelopera do tworzenia @ApiOperation & @ApiResponses, aby oszczędzić czas dla mojego zespołu?
jak wygenerować ten dokument @ raja? mój projekt oparty jest na zasadzie maven, aive dodaje notację Api, notację ApiRescomes, ale jak mogę wygenerować dokumenty za pomoc? –
Użyłem "swagger-springmvc" v1.0.2. Następnie utworzyłem klasę CustomSwaggerConfig, która miała "@Configuration" i "@EnableSwagger". A w applicationContext.xml odwoływałem się do CustomSwaggerConfig. – Raj
Ja nie mam wiosny Jestem tylko z maven, rozpórki –