Skip to content

Commit

Permalink
[2.0] initial contribution (eclipse#62)
Browse files Browse the repository at this point in the history
* Update to MP 2.0-MR1, fix compile errors

* Ignore TCK Tests in ModelConstructionTckTest

* Ignore tests requiring fixes in MergeUtil
  • Loading branch information
jmini authored and MikeEdgar committed Feb 18, 2020
1 parent 51f59a9 commit b5e641f
Show file tree
Hide file tree
Showing 35 changed files with 187 additions and 213 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package io.smallrye.openapi.api.models;

import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;

Expand Down Expand Up @@ -50,23 +51,23 @@ public class ComponentsImpl extends ExtensibleImpl<Components> implements Compon
*/
@Override
public Map<String, Schema> getSchemas() {
return this.schemas;
return (this.schemas == null) ? null : Collections.unmodifiableMap(this.schemas);
}

/**
* @see org.eclipse.microprofile.openapi.models.Components#setSchemas(java.util.Map)
*/
@Override
public void setSchemas(Map<String, Schema> schemas) {
this.schemas = schemas;
this.schemas = (schemas == null) ? null : new LinkedHashMap<>(schemas);
}

/**
* @see org.eclipse.microprofile.openapi.models.Components#schemas(java.util.Map)
*/
@Override
public Components schemas(Map<String, Schema> schemas) {
this.schemas = schemas;
this.schemas = (schemas == null) ? null : new LinkedHashMap<>(schemas);
return this;
}

Expand Down Expand Up @@ -101,23 +102,23 @@ public void removeSchema(String key) {
*/
@Override
public Map<String, APIResponse> getResponses() {
return this.responses;
return (this.responses == null) ? null : Collections.unmodifiableMap(this.responses);
}

/**
* @see org.eclipse.microprofile.openapi.models.Components#setResponses(java.util.Map)
*/
@Override
public void setResponses(Map<String, APIResponse> responses) {
this.responses = responses;
this.responses = (responses == null) ? null : new LinkedHashMap<>(responses);
}

/**
* @see org.eclipse.microprofile.openapi.models.Components#responses(java.util.Map)
*/
@Override
public Components responses(Map<String, APIResponse> responses) {
this.responses = responses;
this.responses = (responses == null) ? null : new LinkedHashMap<>(responses);
return this;
}

Expand Down Expand Up @@ -152,23 +153,23 @@ public void removeResponse(String key) {
*/
@Override
public Map<String, Parameter> getParameters() {
return this.parameters;
return (this.parameters == null) ? null : Collections.unmodifiableMap(this.parameters);
}

/**
* @see org.eclipse.microprofile.openapi.models.Components#setParameters(java.util.Map)
*/
@Override
public void setParameters(Map<String, Parameter> parameters) {
this.parameters = parameters;
this.parameters = (parameters == null) ? null : new LinkedHashMap<>(parameters);
}

/**
* @see org.eclipse.microprofile.openapi.models.Components#parameters(java.util.Map)
*/
@Override
public Components parameters(Map<String, Parameter> parameters) {
this.parameters = parameters;
this.parameters = (parameters == null) ? null : new LinkedHashMap<>(parameters);
return this;
}

Expand Down Expand Up @@ -203,23 +204,23 @@ public void removeParameter(String key) {
*/
@Override
public Map<String, Example> getExamples() {
return this.examples;
return (this.examples == null) ? null : Collections.unmodifiableMap(this.examples);
}

/**
* @see org.eclipse.microprofile.openapi.models.Components#setExamples(java.util.Map)
*/
@Override
public void setExamples(Map<String, Example> examples) {
this.examples = examples;
this.examples = (examples == null) ? null : new LinkedHashMap<>(examples);
}

/**
* @see org.eclipse.microprofile.openapi.models.Components#examples(java.util.Map)
*/
@Override
public Components examples(Map<String, Example> examples) {
this.examples = examples;
this.examples = (examples == null) ? null : new LinkedHashMap<>(examples);
return this;
}

Expand Down Expand Up @@ -254,23 +255,23 @@ public void removeExample(String key) {
*/
@Override
public Map<String, RequestBody> getRequestBodies() {
return this.requestBodies;
return (this.requestBodies == null) ? null : Collections.unmodifiableMap(this.requestBodies);
}

/**
* @see org.eclipse.microprofile.openapi.models.Components#setRequestBodies(java.util.Map)
*/
@Override
public void setRequestBodies(Map<String, RequestBody> requestBodies) {
this.requestBodies = requestBodies;
this.requestBodies = (requestBodies == null) ? null : new LinkedHashMap<>(requestBodies);
}

/**
* @see org.eclipse.microprofile.openapi.models.Components#requestBodies(java.util.Map)
*/
@Override
public Components requestBodies(Map<String, RequestBody> requestBodies) {
this.requestBodies = requestBodies;
this.requestBodies = (requestBodies == null) ? null : new LinkedHashMap<>(requestBodies);
return this;
}

Expand Down Expand Up @@ -305,23 +306,23 @@ public void removeRequestBody(String key) {
*/
@Override
public Map<String, Header> getHeaders() {
return this.headers;
return (this.headers == null) ? null : Collections.unmodifiableMap(this.headers);
}

/**
* @see org.eclipse.microprofile.openapi.models.Components#setHeaders(java.util.Map)
*/
@Override
public void setHeaders(Map<String, Header> headers) {
this.headers = headers;
this.headers = (headers == null) ? null : new LinkedHashMap<>(headers);
}

/**
* @see org.eclipse.microprofile.openapi.models.Components#headers(java.util.Map)
*/
@Override
public Components headers(Map<String, Header> headers) {
this.headers = headers;
this.headers = (headers == null) ? null : new LinkedHashMap<>(headers);
return this;
}

Expand Down Expand Up @@ -356,23 +357,23 @@ public void removeHeader(String key) {
*/
@Override
public Map<String, SecurityScheme> getSecuritySchemes() {
return this.securitySchemes;
return (this.securitySchemes == null) ? null : Collections.unmodifiableMap(this.securitySchemes);
}

/**
* @see org.eclipse.microprofile.openapi.models.Components#setSecuritySchemes(java.util.Map)
*/
@Override
public void setSecuritySchemes(Map<String, SecurityScheme> securitySchemes) {
this.securitySchemes = securitySchemes;
this.securitySchemes = (securitySchemes == null) ? null : new LinkedHashMap<>(securitySchemes);
}

/**
* @see org.eclipse.microprofile.openapi.models.Components#securitySchemes(java.util.Map)
*/
@Override
public Components securitySchemes(Map<String, SecurityScheme> securitySchemes) {
this.securitySchemes = securitySchemes;
this.securitySchemes = (securitySchemes == null) ? null : new LinkedHashMap<>(securitySchemes);
return this;
}

Expand Down Expand Up @@ -407,23 +408,23 @@ public void removeSecurityScheme(String key) {
*/
@Override
public Map<String, Link> getLinks() {
return this.links;
return (this.links == null) ? null : Collections.unmodifiableMap(this.links);
}

/**
* @see org.eclipse.microprofile.openapi.models.Components#setLinks(java.util.Map)
*/
@Override
public void setLinks(Map<String, Link> links) {
this.links = links;
this.links = (links == null) ? null : new LinkedHashMap<>(links);
}

/**
* @see org.eclipse.microprofile.openapi.models.Components#links(java.util.Map)
*/
@Override
public Components links(Map<String, Link> links) {
this.links = links;
this.links = (links == null) ? null : new LinkedHashMap<>(links);
return this;
}

Expand Down Expand Up @@ -458,23 +459,23 @@ public void removeLink(String key) {
*/
@Override
public Map<String, Callback> getCallbacks() {
return this.callbacks;
return (this.callbacks == null) ? null : Collections.unmodifiableMap(this.callbacks);
}

/**
* @see org.eclipse.microprofile.openapi.models.Components#setCallbacks(java.util.Map)
*/
@Override
public void setCallbacks(Map<String, Callback> callbacks) {
this.callbacks = callbacks;
this.callbacks = (callbacks == null) ? null : new LinkedHashMap<>(callbacks);
}

/**
* @see org.eclipse.microprofile.openapi.models.Components#callbacks(java.util.Map)
*/
@Override
public Components callbacks(Map<String, Callback> callbacks) {
this.callbacks = callbacks;
this.callbacks = (callbacks == null) ? null : new LinkedHashMap<>(callbacks);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package io.smallrye.openapi.api.models;

import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;

Expand All @@ -36,7 +37,7 @@ public abstract class ExtensibleImpl<T extends Extensible<T>> implements Extensi
*/
@Override
public Map<String, Object> getExtensions() {
return this.extensions;
return (this.extensions == null) ? null : Collections.unmodifiableMap(this.extensions);
}

/**
Expand Down Expand Up @@ -70,7 +71,7 @@ public void removeExtension(String name) {
*/
@Override
public void setExtensions(Map<String, Object> extensions) {
this.extensions = extensions;
this.extensions = (extensions == null) ? null : new LinkedHashMap<>(extensions);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
package io.smallrye.openapi.api.models;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.eclipse.microprofile.openapi.models.Components;
import org.eclipse.microprofile.openapi.models.ExternalDocumentation;
import org.eclipse.microprofile.openapi.models.OpenAPI;
import org.eclipse.microprofile.openapi.models.PathItem;
import org.eclipse.microprofile.openapi.models.Paths;
import org.eclipse.microprofile.openapi.models.info.Info;
import org.eclipse.microprofile.openapi.models.security.SecurityRequirement;
Expand Down Expand Up @@ -123,23 +123,23 @@ public OpenAPI externalDocs(ExternalDocumentation externalDocs) {
*/
@Override
public List<Server> getServers() {
return this.servers;
return (this.servers == null) ? null : Collections.unmodifiableList(this.servers);
}

/**
* @see org.eclipse.microprofile.openapi.models.OpenAPI#setServers(java.util.List)
*/
@Override
public void setServers(List<Server> servers) {
this.servers = servers;
this.servers = (servers == null) ? null : new ArrayList<>(servers);
}

/**
* @see org.eclipse.microprofile.openapi.models.OpenAPI#servers(java.util.List)
*/
@Override
public OpenAPI servers(List<Server> servers) {
this.servers = servers;
this.servers = (servers == null) ? null : new ArrayList<>(servers);
return this;
}

Expand Down Expand Up @@ -173,23 +173,23 @@ public void removeServer(Server server) {
*/
@Override
public List<SecurityRequirement> getSecurity() {
return this.security;
return (this.security == null) ? null : Collections.unmodifiableList(this.security);
}

/**
* @see org.eclipse.microprofile.openapi.models.OpenAPI#setSecurity(java.util.List)
*/
@Override
public void setSecurity(List<SecurityRequirement> security) {
this.security = security;
this.security = (security == null) ? null : new ArrayList<>(security);
}

/**
* @see org.eclipse.microprofile.openapi.models.OpenAPI#security(java.util.List)
*/
@Override
public OpenAPI security(List<SecurityRequirement> security) {
this.security = security;
this.security = (security == null) ? null : new ArrayList<>(security);
return this;
}

Expand Down Expand Up @@ -223,23 +223,23 @@ public void removeSecurityRequirement(SecurityRequirement securityRequirement) {
*/
@Override
public List<Tag> getTags() {
return this.tags;
return (this.tags == null) ? null : Collections.unmodifiableList(this.tags);
}

/**
* @see org.eclipse.microprofile.openapi.models.OpenAPI#setTags(java.util.List)
*/
@Override
public void setTags(List<Tag> tags) {
this.tags = tags;
this.tags = (tags == null) ? null : new ArrayList<>(tags);
}

/**
* @see org.eclipse.microprofile.openapi.models.OpenAPI#tags(java.util.List)
*/
@Override
public OpenAPI tags(List<Tag> tags) {
this.tags = tags;
this.tags = (tags == null) ? null : new ArrayList<>(tags);
return this;
}

Expand Down Expand Up @@ -307,19 +307,6 @@ public OpenAPI paths(Paths paths) {
return this;
}

/**
* @see org.eclipse.microprofile.openapi.models.OpenAPI#path(java.lang.String,
* org.eclipse.microprofile.openapi.models.PathItem)
*/
@Override
public OpenAPI path(String name, PathItem path) {
if (this.paths == null) {
this.paths = new PathsImpl();
}
this.paths.addPathItem(name, path);
return this;
}

/**
* @see org.eclipse.microprofile.openapi.models.OpenAPI#getComponents()
*/
Expand Down
Loading

0 comments on commit b5e641f

Please sign in to comment.