apikana-maven-plugin

A maven plugin for apikana.

License

License

Categories

Categories

Maven Build Tools
GroupId

GroupId

org.swisspush.maven.plugins
ArtifactId

ArtifactId

apikana-maven-plugin
Last Version

Last Version

0.4.21
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

apikana-maven-plugin
A maven plugin for apikana.

Download apikana-maven-plugin

How to add to project

<plugin>
    <groupId>org.swisspush.maven.plugins</groupId>
    <artifactId>apikana-maven-plugin</artifactId>
    <version>0.4.21</version>
</plugin>

Dependencies

compile (5)

Group / Artifact Type Version
org.apache.maven : maven-core jar 3.3.9
org.twdata.maven : mojo-executor jar 2.2.0
ch.qos.logback : logback-classic jar 1.1.8
org.eclipse.jetty : jetty-server jar 9.3.15.v20161220
com.fasterxml.jackson.core : jackson-databind jar 2.8.6

provided (1)

Group / Artifact Type Version
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.5

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

apikana-java

The java side of apikana.

Usage

Create a new API project

Install apikana npm install -g apikana. Run apikana init.

This starts an interactive wizard that lets you define the main aspects of the API project.

If you don't like npm, just take advantage of the provided parent pom and use this as a template:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.swisspush.apikana</groupId>
        <artifactId>apikana-parent</artifactId>
        <version>0.4.14</version>
    </parent>

    <groupId>myorg.myproject</groupId>
    <artifactId>myapi</artifactId>
    <version>0.0.1-SNAPSHOT</version>
</project>

Create src/openapi/api.yaml

paths:
  /sample/users:
    get:
      operationId: getUser
      responses:
        200:
          description: ok
          schema:
            $ref: "#/definitions/User"
definitions:
  $ref:
    - ../ts/user.ts

And create src/ts/user.ts

import {Int} from 'apikana/default-types';

export interface User {
    id: Int
    firstName: string // The given name
    lastName: string // the family name @pattern [A-Z][a-z]*
    age?: Int
}

Create the API documentation

Running mvn install on an API project does the following things:

  • create myapi.jar containing the typescript models, the generated json schemas and the generated java pojos.
  • create myapi-api.jar, an executable jar file which opens a browser showing the HTML documentation of the API.
  • start a small HTTP server publishing the HTML documentation of the API at http://localhost:8333.

Plugin documentation

There is a complete documentation of the maven plugin.

Development

The development is done in the develop branch. Releasing is done by defining the release and new development version in release.sh and by rebasing the develop branch onto the master branch. Travis CI will then pick this up and perform the release.

org.swisspush.maven.plugins
A group of developers and software architects working for the IT department at Swiss Post and using Open Source in their daily work.

Versions

Version
0.4.21
0.4.20
0.4.19
0.4.18
0.4.17
0.4.15
0.4.14
0.4.13
0.4.8
0.4.7
0.4.5
0.3.17
0.3.14
0.3.13
0.3.12
0.3.10
0.3.9
0.3.8
0.3.7
0.3.6
0.3.5
0.3.4
0.3.3
0.3.2
0.2.3
0.2.2
0.2.1
0.1.21
0.1.20
0.1.19
0.1.18
0.1.17
0.1.16
0.1.15
0.1.14