Validate your specs with OpenAPI Style Validator

OpenAPI Style Validator is a tool to create API specs with understandable descriptions, examples and consistent use of naming conventions. The Validator helps developers to identify issues in OpenAPI specifications. With defined rules you can describe exactly how an API specification should look. These specs can be checked automatically and the results can be used …

Writing key values from Java to Consul

How to write key values to Consul In the first example we are going to use the HTTP API directly, in the second one we are going to use the Java Consul API ecwid. On Github you’ll find all the examples. So, let’s start. HTTP APIIn this example we store the value „buon giorno“ with …

Validate JSON in Java with JSON Schema

Describe and validate your JSON documents I programmed a lot with XML and XML Schema helped me to define which elements and attributes can appear in a document. So I always wanted a grammar for JSON too. JSON Schema is exactly what I wanted. It has the following advantages:* describes existing data formats * provides …

HelloWorld with RESTEasy

An example with Gradle and current libraries RESTEasy is a cool project for building RESTful Web Services with Java. It is an JAX-RS implementation. And I really like the tight integration into quarkus. I show you how to build a simple project with Gradle (build.gradle.kts): That’s everything you need for building the project. And the …

REST != REST

Standards and best practices REST is a defacto standard and every developer implements REST APIs in a different way. In this talk I’ll show best practices and standards around REST. I talk about developer experience with REST APIs, resource naming conventions, URI structure, HTTP methods / status codes and the REST Maturity Model. And the …

Test your code not throwing any exception

with JUnit and Assertj Recently I had to test that the code does not throw any exception. We all know that AssertJ gives us a powerful set of assertions which improves your test code readability. And again, AssertJ helped me to do the job with assertThatCode: You can find more assertions example on github. I …

Format code like google

Get easy look-alike readable code with IntelliJ Spotless is are really cool tool for formatting your code with build tools. If you like, you can do that with your IDE too. I show your how to configure IntelliJ, so your code is automatically formatted while you save a file. First you have to install the …

Trace http requests with Spring Actuator

List the last http request with ease Spring Actuator provides also a httptrace endpoint. You get the last HTTP request with /httptrace. After adding Spring Boot Actuator dependencies to your project dependencies, you have to expose the httptrace endpoint via your application.properties: [code]management.endpoints.web.exposure.include=httptrace[/code] [code] curl http://127.0.0.1:8080/actuator/httptrace | jq { "traces": [{ "timestamp": "2019-01-05T07:45:14.406Z", "principal": null, …

Creating a generic array in Java

Generic array initialization Recently I work with CompletableFutures. I used the allOf method which takes a varargs as input. Based on the request, a couple of things had to be processed. So how do I create a generic array that I could use at CompletableFuture.allof()? Array.newInstance together with toArray() does the trick. This is my …

Consent Management Platform von Real Cookie Banner