All Projects → EvidentSolutions → apina

EvidentSolutions / apina

Licence: MIT license
Tool for creating client-side TypeScript code from server-side APIs

Programming Languages

kotlin
9241 projects
typescript
32286 projects
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to apina

Jackson Module Kotlin
Module that adds support for serialization/deserialization of Kotlin (http://kotlinlang.org) classes and data classes.
Stars: ✭ 830 (+2974.07%)
Mutual labels:  jackson
Kripton
A Java/Kotlin library for Android platform, to manage bean's persistence in SQLite, SharedPreferences, JSON, XML, Properties, Yaml, CBOR.
Stars: ✭ 110 (+307.41%)
Mutual labels:  jackson
Jackson Jq
jq for Jackson Java JSON Processor
Stars: ✭ 178 (+559.26%)
Mutual labels:  jackson
Business Search App Java
Showcases object oriented programming in Java, Java Swing, Kotlin, and Android
Stars: ✭ 53 (+96.3%)
Mutual labels:  jackson
Jackson Jaxrs Providers
Multi-module project that contains Jackson-based JAX-RS providers for JSON, XML, YAML, Smile, CBOR formats
Stars: ✭ 98 (+262.96%)
Mutual labels:  jackson
Jersey Jwt
Example of REST API with JWT authentication using Jersey, Jackson, Undertow, Weld, Hibernate and Arquillian.
Stars: ✭ 131 (+385.19%)
Mutual labels:  jackson
Typescript Generator
Generates TypeScript from Java - JSON declarations, REST service client
Stars: ✭ 729 (+2600%)
Mutual labels:  jackson
Bson4jackson
A pluggable BSON generator and parser for the Jackson JSON processor.
Stars: ✭ 244 (+803.7%)
Mutual labels:  jackson
Log4j2 Elasticsearch
Log4j2 Elasticsearch Appender plugins
Stars: ✭ 107 (+296.3%)
Mutual labels:  jackson
Jackson Datatype Money
Extension module to properly support datatypes of javax.money
Stars: ✭ 165 (+511.11%)
Mutual labels:  jackson
Microservices Springboot
Example of microservices application with Spring Boot, Zuul, Eureka, MongoDB and RabbitMQ.
Stars: ✭ 53 (+96.3%)
Mutual labels:  jackson
Emfjson Jackson
JSON Binding for Eclipse Modeling Framework
Stars: ✭ 79 (+192.59%)
Mutual labels:  jackson
Androidstarter
A sample Android app using the MVP architecture.
Stars: ✭ 140 (+418.52%)
Mutual labels:  jackson
Jsonj
A fluent Java API for manipulating json data structures
Stars: ✭ 42 (+55.56%)
Mutual labels:  jackson
Jsontokotlinclass
🚀 Plugin for Android Studio And IntelliJ Idea to generate Kotlin data class code from JSON text ( Json to Kotlin )
Stars: ✭ 2,438 (+8929.63%)
Mutual labels:  jackson
Jackson
Main Portal page for the Jackson project
Stars: ✭ 7,066 (+26070.37%)
Mutual labels:  jackson
Gwt Jackson
gwt-jackson is a JSON parser for GWT. It uses Jackson 2.x annotations to customize the serialization/deserialization process.
Stars: ✭ 110 (+307.41%)
Mutual labels:  jackson
catnap
Partial JSON response framework for RESTful web services
Stars: ✭ 55 (+103.7%)
Mutual labels:  jackson
Stubbornjava
Unconventional Java code for building web servers / services without a framework. Think dropwizard but as a seed project instead of a framework. If this project had a theme it would be break the rules but be mindful of your decisions.
Stars: ✭ 184 (+581.48%)
Mutual labels:  jackson
Jackson Core
Core part of Jackson that defines Streaming API as well as basic shared abstractions
Stars: ✭ 2,003 (+7318.52%)
Mutual labels:  jackson

Apina

Apina creates client-side TypeScript code for either for Angular or Fetch API based on server-side APIs. Apina reads Spring Web MVC's @RestController annotated classes and their related Jackson classes and creates code for the data model and for executing HTTP-requests.

Read the manual for details.

Quick start using Gradle

Include something like the following in your web application project:

plugins {
    id("fi.evident.apina") version "0.20.3"
}

tasks.apina {
    // Set the name of the created TypeScript file. Default is 'build/apina/apina.ts'.
    target.set(project(":frontend").layout.projectDirectory.file("app/apina-api.ts"))
    
    // Specify types that should not be generated, but are implemented manually
    // and should be imported to the generated code. Keys are module paths, values 
    // are list of types imported from the module.
    imports.set(mapOf(
        "./my-time-module" to listOf("Instant", "LocalDate"),
        "./other-module" to listOf("Foo", "Bar")
    ))
    
    // How Java enums are translated to TypeScript enums? (Default mode is 'default'.)
    //  - 'default'      => enum MyEnum { FOO = "FOO", BAR = "BAR", BAZ = "BAZ" }
    //  - 'int_enum'     => enum MyEnum { FOO, BAR, BAZ }
    //  - 'string_union' => type MyEnum = "FOO" | "BAR" | "BAZ"
    enumMode.set(EnumMode.DEFAULT)
    
    // How nullables are translated to TypeScript interfaces? (Default mode is 'NULL'.)
    //  - 'NULL'      => name: Type | null
    //  - 'UNDEFINED' => name?: Type
    optionalTypeMode.set(OptionalTypeMode.NULL)
    
    // Which controllers to include when generating API? Defaults to everything.
    endpoints.set(listOf("""my\.package\.foo\..+"""))
    
    // If generated URLs would start with given prefix, removes it. Useful when configuring Apina
    // to work behind reverse proxies. Defaults to empty string (URL is not modified).
    removedUrlPrefix.set("/foo")
    
    // Code generation target (Default is 'angular')
    // - 'angular' => Generate Angular module that uses Angular's HttpClient 
    // - 'es6' => Generate code that uses Fetch API and has no dependencies apart from ES6
    platform.set(Platform.ANGULAR) 
}

// Tell the frontend to run apina before setup 
// (the 'setup' task will probably be different for you)
tasks.findByPath(":frontend:setup").dependsOn(tasks.apina)

Using generated code

First make your own module dependent on Apina:

import { ApinaModule } from 'apina';

@NgModule({
    imports: [ApinaModule],
    providers: [MyService]
})
class MyModule { }

Then just inject the generated endpoint and use it:

import { DocumentsEndpoint } from 'apina';

@Injectable()
class MyService {
    
    constructor(private readonly documentsEndpoint: DocumentsEndpoint) { }
    
    load() {
        this.documentsEndpoint.findDocument(42).forEach(doc => this.document = doc);
    }
}

Modules

  • apina-core main apina code
  • apina-cli command line interface for running conversion
  • apina-gradle plugin for Gradle
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].