Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PAYARA-3466 Open API 1.1 #3827

Merged
merged 10 commits into from Mar 19, 2019

PAYARA-3466 moved all JSON output tweaks to mixin interface

  • Loading branch information...
jbee committed Mar 15, 2019
commit 95fe53460293c3c1d63abd92cd569b1897efb9b8
@@ -51,17 +51,15 @@
import org.eclipse.microprofile.openapi.annotations.extensions.Extension;
import org.eclipse.microprofile.openapi.models.Extensible;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;

public abstract class ExtensibleImpl<T extends Extensible<T>> implements Extensible<T> {

private static final Logger LOGGER = Logger.getLogger(ExtensibleImpl.class.getName());

protected Map<String, Object> extensions = new LinkedHashMap<>();

@JsonAnyGetter
@Override
public Map<String, Object> getExtensions() {
return extensions;
@@ -6,8 +6,6 @@

import org.eclipse.microprofile.openapi.models.Extensible;

import com.fasterxml.jackson.annotation.JsonAnyGetter;

public abstract class ExtensibleTreeMap<V, T extends Extensible<T>> extends TreeMap<String, V>
implements Extensible<T> {

@@ -21,7 +19,6 @@ protected ExtensibleTreeMap(Map<String, ? extends V> items) {
super(items);
}

@JsonAnyGetter
@Override
public final Map<String, Object> getExtensions() {
return extensions;
@@ -50,8 +50,6 @@
import org.eclipse.microprofile.openapi.models.parameters.Parameter;
import org.eclipse.microprofile.openapi.models.servers.Server;

import com.fasterxml.jackson.annotation.JsonIgnore;

public class PathItemImpl extends ExtensibleImpl<PathItem> implements PathItem {

protected String ref;
@@ -178,7 +176,6 @@ public void setTRACE(Operation trace) {
this.trace = trace;
}

@JsonIgnore
@Override
public Map<HttpMethod, Operation> getOperations() {
return readOperationsMap();
@@ -48,9 +48,6 @@
import org.eclipse.microprofile.openapi.models.servers.ServerVariable;
import org.eclipse.microprofile.openapi.models.servers.ServerVariables;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

import fish.payara.microprofile.openapi.impl.model.ExtensibleImpl;

public class ServerImpl extends ExtensibleImpl<Server> implements Server {
@@ -86,13 +83,11 @@ public ServerVariables getVariables() {
: new ServerVariablesImpl(variables);

This comment has been minimized.

Copy link
@jbee

jbee Mar 12, 2019

Author Contributor

FYI: ServerVariables got "half-removed". It is deprecated and should be removed in the future. In some places it already was replaced with a Map<String, SeverVariable> what causes changes here.

}

@JsonIgnore
@Override
public void setVariables(ServerVariables variables) {
this.variables = variables;
}

@JsonProperty("variables")
@Override
public void setVariables(Map<String, ServerVariable> variables) {
this.variables = variables;
@@ -40,33 +40,51 @@
package fish.payara.microprofile.openapi.impl.rest.app.provider.mixin;

import java.util.List;
import java.util.Map;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;

import org.eclipse.microprofile.openapi.models.Operation;
import org.eclipse.microprofile.openapi.models.Paths;
import org.eclipse.microprofile.openapi.models.PathItem.HttpMethod;
import org.eclipse.microprofile.openapi.models.security.SecurityRequirement;
import org.eclipse.microprofile.openapi.models.servers.ServerVariable;
import org.eclipse.microprofile.openapi.models.servers.ServerVariables;

public interface ExtensionsMixin {

@JsonProperty("enum")
public abstract void getEnumeration();
void getEnumeration();

@JsonProperty("default")
public abstract void getDefaultValue();
void getDefaultValue();

@JsonProperty("$ref")
public abstract void getRef();
void getRef();

@JsonIgnore
public abstract void setAdditionalProperties(Boolean additionalProperties);
void setAdditionalProperties(Boolean additionalProperties);

@JsonInclude(Include.NON_EMPTY)
public abstract List<SecurityRequirement> getSecurity();
List<SecurityRequirement> getSecurity();

@JsonInclude(Include.ALWAYS)
public abstract Paths getPaths();
Paths getPaths();

@JsonAnyGetter
Map<String, Object> getExtensions();

@JsonIgnore
Map<HttpMethod, Operation> getOperations();

@JsonIgnore
void setVariables(ServerVariables variables);

@JsonProperty("variables")
void setVariables(Map<String, ServerVariable> variables);

}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.