question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Design discussion: how to guide Java developers

See original GitHub issue

I understand that OAS is language-agnostic, but wanted to see what others thought about having an official set of Java annotations, which in Java always belong at the spec level.

For illustrative purposes, a Java spec such as JAX-RS defines the specification, the annotations and corresponding programming models. It often has a reference implementation, and several other implementations, but all of them using the same set of interfaces (making apps portable across vendors / OSS providers).

In the Java world there are many possible frameworks that one could use: JEE, Spring, MicroProfile, Dropwizard, the list goes on. So if a Java developers says: “hey, there’s a new official spec, the OpenAPI Specification, I want to use that! Now, what’s the programming model that I should use?”.

By far the most popular choice is the Swagger repo, but we are seeing other (competing) Java programming models emerging that work with OpenAPI v3.

My proposal is to make the Swagger v3 annotations for OpenAPI the official (or at least recommended) interfaces from OAS. So we could release an official package such as io.oas.annotations, which would indicate a clear choice for Java developers - regardless of the Java framework they are using.

We can chat about other programming models later, I thought it would be easier to keep this focused to the annotations first (golden path for most Java apps).

Thoughts?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
evanjbowlingcommented, May 4, 2017

OpenAPI developers - is there a preferred approach for opening design discussions here? Right now I don’t see any guidance in the form of a CONTRIBUTIONS.md page in the master branch.

Anyways, I have some links that may be of interest to @arthurdm and the others. Have you seen the swagger-codegen project: https://github.com/swagger-api/swagger-codegen/wiki/API-client-generator-HOWTO ? It allows you to generate client/server-side stubs in many languages including a Java JAX-RS language. See a quick example repo that I made here: https://github.com/evanjbowling/swagger-codegen-java-demo

Now, regarding the Java annotations for OpenAPI. Since OpenAPI focuses on RESTful APIs in a vendor-neutral manner, we can simply reuse the JAX-RS annotations for RESTful services. The way to get more Java-focused support would be to go through the JSR process which created JAX-RS in the first place (JSR 311). See these other links for RESTful focused JSRs: https://jcp.org/en/jsr/summary?id=JAX-RS

1reaction
raymondfengcommented, May 3, 2017

I would like to see support for bottom-up approach in addition to API first. Having standardized Java annotations for OpenAPI will help. The framework can infer OpenAPI related metadata from its own annotations such as JAX-RS but the OpenAPI ones can be used to express metadata that is not available otherwise.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Java Developer Tutorial For Beginners | Java Full Course
This Java Full course video is designed to help beginners with a perfect learning path to become successful Java Developers.
Read more >
Important Java Design Patterns You Need to Know About
This article on Java Design Patterns helps you with detailed knowledge about the Important Design Patterns with real-time examples.
Read more >
Design Patterns in Java Tutorial - Tutorialspoint
This tutorial will take you through step by step approach and examples using Java while learning Design Pattern concepts. Audience. This reference has...
Read more >
Java Developer Guide - Great Learning
In this blog, let us have an overview of who a Java Developer is, what are the roles and responsibilities of a Java...
Read more >
15 Java Coding Best Practices for Beginners - Xperti
First thing first, before start writing code, set a proper naming convention for your Java project. Pre-decide names for every class, interfaces ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found