openVALIDATION OpenAPI generator

Generate OpenAPI service stubs with complete validation layer using this openVALIDATION adapter.

License

License

GroupId

GroupId

io.openvalidation
ArtifactId

ArtifactId

openvalidation-openapi-generator
Last Version

Last Version

0.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

openVALIDATION OpenAPI generator
Generate OpenAPI service stubs with complete validation layer using this openVALIDATION adapter.
Source Code Management

Source Code Management

https://github.com/openvalidation/openvalidation-openapi

Download openvalidation-openapi-generator

How to add to project

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

Dependencies

compile (6)

Group / Artifact Type Version
io.openvalidation : openvalidation-common jar 0.0.1
io.openvalidation : openvalidation-core jar 0.0.1
org.openapitools : openapi-generator jar 3.3.4
org.openapitools : openapi-generator-cli jar 3.3.4
com.reprezen.kaizen : openapi-parser jar 4.0.3
org.json : json jar 20180813

test (3)

Group / Artifact Type Version
org.junit.jupiter : junit-jupiter-api jar 5.4.0-RC1
org.junit.jupiter : junit-jupiter-engine jar 5.4.0-RC1
org.junit.jupiter : junit-jupiter-params jar 5.4.0-RC1

Project Modules

There are no modules declared in this project.

Build Status Azure DevOps tests (compact) Maven Central Follow us on Twitter

OpenAPI Generator for openVALIDATION

This project provides an openapi-generator integration to generate services with validation logic provided by openVALIDATION.

What's OpenAPI

The goal of OpenAPI is to define a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly described with OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interfaces have done for lower-level programming, OpenAPI removes the guesswork in calling the service.

Check out OpenAPI-Spec for additional information about the OpenAPI project, including additional libraries with support for other languages and more.

What's openVALIDATION

Check out openVALIDATION to learn about human readable validation rules for software solutions.

openVALIDATION OpenAPI Codegen Documentation

Documentation

Tutorial

How do I use this?

Download the openVALIDATION OpenAPI generator CLI (requires the Java SE 8 runtime environment). Use ov-openapi-generator-cli.jar as a drop-in replacement for the openapi-generator-cli.jar

Now you can use openVALIDATION rules in your service contract:

paths:
  /: 
   post:
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/applicant'
            x-ov-rules:
              culture: en
              rule: |
                the location of the applicant must be Dortmund
      responses:
        '200':
          description: success
components:
  schemas:
    applicant:
      type: object
      properties:
        name:
          type: string
        age:
          type: integer
        location:
          type: string

(For further details check the above-mentioned documentation or the openVALIDATION project itself.)

Alternatively, the openvalidation-openapi-generator jar itself can be called in combination with the OpenAPI generator.

For mac/linux:

java -cp /path/to/openapi-generator-cli.jar:/path/to/openvalidation-openapi-generator.jar org.openapitools.codegen.OpenAPIGenerator generate -g ov-java-spring-server -i /path/to/openapi.yaml -o ./test

(Do not forget to replace the values /path/to/openapi-generator-cli.jar, /path/to/openvalidation-openapi-generator.jar and /path/to/openapi.yaml in the previous command)

For Windows users, you will need to use ; instead of : in the classpath, e.g.

java -cp /path/to/openapi-generator-cli.jar;/path/to/openvalidation-openapi-generator.jar org.openapitools.codegen.OpenAPIGenerator generate -g ov-java-spring-server -i /path/to/openapi.yaml -o ./test

Or use openVALIDATION Generator as Maven Plugin:

    <build>
        <plugins>
            <plugin>
                <groupId>org.openapitools</groupId>
                <artifactId>openapi-generator-maven-plugin</artifactId>
                <version>3.3.4</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <inputSpec>${project.basedir}/my.spec.yaml</inputSpec>
                            <generatorName>ov-java-rules</generatorName> <!- rules only generation -->
                            <configOptions>
                                <invokerPackage>my.custom.package</invokerPackage>
                                <modelPackage>my.custom.package.model</modelPackage>
                            </configOptions>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>io.openvalidation</groupId>
                        <artifactId>openvalidation-openapi-generator</artifactId>
                        <version>0.0.1</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

Getting involved

Please refer to our contribution guidelines.

Contact

You can write an E-Mail or mention our twitter account @openVALIDATION.

io.openvalidation

openVALIDATION

write once, DON'T CODE and run everywhere!

Versions

Version
0.0.1