Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dernasherbrezon/jsp-openapi
JSP tag for rendering openapi
https://github.com/dernasherbrezon/jsp-openapi
bootstrap bootstrap4 jsp openapi openapi3 taglib
Last synced: 29 days ago
JSON representation
JSP tag for rendering openapi
- Host: GitHub
- URL: https://github.com/dernasherbrezon/jsp-openapi
- Owner: dernasherbrezon
- License: apache-2.0
- Created: 2019-11-27T22:37:39.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-10-10T21:19:58.000Z (over 1 year ago)
- Last Synced: 2024-11-15T05:35:00.397Z (2 months ago)
- Topics: bootstrap, bootstrap4, jsp, openapi, openapi3, taglib
- Language: HTML
- Size: 150 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jsp-openapi [![Build Status](https://travis-ci.com/dernasherbrezon/jsp-openapi.svg?branch=master)](https://travis-ci.com/dernasherbrezon/jsp-openapi) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ru.r2cloud.openapi%3Ajsp-openapi&metric=alert_status)](https://sonarcloud.io/dashboard?id=ru.r2cloud.openapi%3Ajsp-openapi)
Tag lib for rendering openapi specification. CSS and javascript libraries are not included.
* "bootstrap4-openapi". Render using bootstrap4.
## Usage
For a complete reference see the [test](https://github.com/dernasherbrezon/jsp-openapi/blob/master/src/test/resources/webapp/index.jsp).
### Step by step guide
Include dependency:
```xml
ru.r2cloud.openapi
jsp-openapi
1.0```
Setup controller (for example Spring MVC):
```java
@RequestMapping("/api")
public ModelAndView load() throws Exception {
OpenAPI openapi = new OpenAPIV3Parser().read(LoadApi.class.getClassLoader().getResource("openapi.json").getFile());
Map model = new HashMap();
model.put("entity", openapi);
return new ModelAndView("api", model);
}
```> Note: if API specification cannot be changed in runtime, then it is better to cache it on startup.
> Note: io.swagger.v3.parser.OpenAPIV3Parser is a swagger parser for v3 specification. You can implement your own parser or use any compatible. Parser should be able to construct io.swagger.v3.oas.models.OpenAPI model.
Configure taglib:
```
<%@ taglib prefix="openapi" uri="https://github.com/dernasherbrezon/jsp-openapi" %>
```Use on the page:
```html
```