Skip to content
This repository has been archived by the owner on Jul 20, 2021. It is now read-only.

zalando-stups/twintip-spring-web

Repository files navigation

Twintip Status

The project is no longer maintained. Consider to use alternatives, e.g. springdoc.

Twintip Schema Discovery for Spring Web

Build Status Javadoc Release Maven Central License

Twintipify your Spring Web MVC application. This library exposes your API schema at /.well-known/schema-discovery as specified in our RESTful API Guidelines. Twintip was the former API crawler that was tasked with finding and indexing API schemas, hence the name of this library.

Features

  • never think about your Twintip-compatible schema discovery endpoint ever again

Dependencies

  • Java 11
  • Any build tool using Maven Central, or direct download
  • Servlet Container
  • Spring

Installation

Add the following dependency to your project:

<dependency>
    <groupId>org.zalando</groupId>
    <artifactId>twintip-spring-web</artifactId>
    <version>${twintip-spring-web.version}</version>
</dependency>

Configuration

First make sure that the endpoints are mapped into your application.

import org.zalando.twintip.spring.SchemaResource;

@Configuration
@Import(SchemaResource.class)
public class YourConfigration {
    // whatever you configure
}

Next you need to provide the API definition and decide where clients should find it. You can do this in your application.properties or application.yml.

twintip:
  mapping: /api
  yaml: "classpath:api.yml"

CORS Support

SchemaResource will send CORS Access-Control-* headers by default. You can disable this by setting twintip.cors property to false.

Host, port, schemes and base path inside of the API definition can be overridden by setting the twintip.baseUrl property to full base URL of API.

Getting Help

If you have questions, concerns, bug reports, etc., please file an issue in this repository's Issue Tracker.

Getting Involved/Contributing

To contribute, simply make a pull request and add a brief description (1-2 sentences) of your addition or change. For more details, check the contribution guidelines.