yop-swaggerui

YOP-swaggerui is a simple Servlet that can serve the Swagger UI for the yop-rest OpenAPI REST resources. Ω≡{Ⓐ}

License

License

Postcard Public License
Categories

Categories

Swagger Program Interface REST Frameworks
GroupId

GroupId

org.y-op
ArtifactId

ArtifactId

swaggerui
Last Version

Last Version

0.9.0
Release Date

Release Date

Type

Type

jar
Description

Description

yop-swaggerui
YOP-swaggerui is a simple Servlet that can serve the Swagger UI for the yop-rest OpenAPI REST resources. Ω≡{Ⓐ}

Download swaggerui

How to add to project

<!-- https://jarcasting.com/artifacts/org.y-op/swaggerui/ -->
<dependency>
    <groupId>org.y-op</groupId>
    <artifactId>swaggerui</artifactId>
    <version>0.9.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.y-op/swaggerui/
implementation 'org.y-op:swaggerui:0.9.0'
// https://jarcasting.com/artifacts/org.y-op/swaggerui/
implementation ("org.y-op:swaggerui:0.9.0")
'org.y-op:swaggerui:jar:0.9.0'
<dependency org="org.y-op" name="swaggerui" rev="0.9.0">
  <artifact name="swaggerui" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.y-op', module='swaggerui', version='0.9.0')
)
libraryDependencies += "org.y-op" % "swaggerui" % "0.9.0"
[org.y-op/swaggerui "0.9.0"]

Dependencies

compile (5)

Group / Artifact Type Version
javax.servlet : javax.servlet-api jar 3.1.0
org.webjars : swagger-ui jar 3.18.2
org.apache.commons : commons-lang3 jar 3.7
commons-io : commons-io jar 2.4
org.slf4j : slf4j-api jar 1.7.7

test (12)

Group / Artifact Type Version
org.y-op : rest jar 0.9.0
org.y-op : orm test-jar 0.9.0
org.y-op : rest test-jar 0.9.0
ch.qos.logback : logback-classic jar 1.1.2
junit : junit jar 4.12
org.skyscreamer : jsonassert jar 1.5.0
org.xerial : sqlite-jdbc jar 3.21.0.1
mysql : mysql-connector-java jar 5.1.45
org.postgresql : postgresql jar 42.2.1
com.microsoft.sqlserver : mssql-jdbc jar 7.0.0.jre8
com.oracle » ojdbc8 jar 12.2.0.1
org.apache.tomcat.embed : tomcat-embed-core jar 9.0.10

Project Modules

There are no modules declared in this project.

YOP !

YOP is an ORM tool.
And since I am such a nice guy, a REST stack is built on top of it.

Status

Build Status

Modules :

Maven

Yop modules are available on Maven central :

<dependency>
    <groupId>org.y-op</groupId>
    <artifactId>reflection</artifactId>
    <version>0.9.0</version>
</dependency>
<dependency>
    <groupId>org.y-op</groupId>
    <artifactId>ioc</artifactId>
    <version>0.9.0</version>
</dependency>
<dependency>
    <groupId>org.y-op</groupId>
    <artifactId>orm</artifactId>
    <version>0.9.0</version>
</dependency>
<dependency>
    <groupId>org.y-op</groupId>
    <artifactId>rest</artifactId>
    <version>0.9.0</version>
</dependency>
<dependency>
    <groupId>org.y-op</groupId>
    <artifactId>swaggerui</artifactId>
    <version>0.9.0</version>
</dependency>

About

Yop is an ORM tool with a conventional REST webservice Servlet. Webservices are described using OpenAPI specifications

Structure :

The ORM module brings a set of query builders with an SQL like syntax :

Select   
 .from(Library.class)    
 .join(Library::getAuthors, Author::getBooks, Book::getChapters)    
 .join(Library::getEmployees)  
 .execute(connection);

The REST module brings a set of annotations to directly expose the data objects as REST resources :

@Rest(
  path="book",
  summary = "Rest resource for books !",
  description = "A collection of sheets of paper bound together to hinge at one edge."
)
@Table(name="book")
public class Book implements Yopable {}

A REST servlet can expose the data objects as REST resources :

Wrapper wrapper = Tomcat.addServlet(context, YopRestServlet.class.getSimpleName(), new YopRestServlet());

// The data objects packages exposed as REST resources
wrapper.addInitParameter(YopRestServlet.PACKAGE_INIT_PARAM, "org.yop");

// The datasource JNDI name (or you can override the 'getConnection' method)
wrapper.addInitParameter(YopRestServlet.DATASOURCE_JNDI_INIT_PARAM, "datasource");

// The exposition path for the data objects REST resources
context.addServletMappingDecoded("/yop/rest/*", YopRestServletWithConnection.class.getSimpleName());

The OpenAPI description of data objects can be generated and exposed using a Servlet :

Wrapper wrapper = Tomcat.addServlet(context, OpenAPIServlet.class.getSimpleName(), new OpenAPIServlet());

// The data objects packages exposed as REST resources
wrapper.addInitParameter(OpenAPIServlet.PACKAGE_INIT_PARAM, "org.yop");

// The exposition path for the data objects REST resources
wrapper.addInitParameter(OpenAPIServlet.EXPOSITION_PATH_PARAM, "/yop/rest");

// The exposition path for the generated OpenAPI description of the data objects REST resources
context.addServletMappingDecoded("/yop/openapi", OpenAPIServlet.class.getSimpleName());

Miscellaneous / Philosophy

  • Data objects describe their REST and/or ORM features.
  • CRUD behavior in REST services is conventional.
  • Data objects carry any extra CRUD behavior (i.e beyond conventional) to be exposed in REST services.
  • Explicit CRUD can be achieved using the orm module in an SQL like syntax.
  • DAO pattern sucks.
  • DTO pattern sucks.
  • YOP naively aims at being a straightforward Model-Driven ORM/REST stack.

Versions

Version
0.9.0