mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-19 21:50:45 +00:00
Checkpoint; bulkInsert working; some api instance validation
This commit is contained in:
@ -26,9 +26,11 @@ import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.kingsrook.qqq.api.ApiMiddlewareType;
|
||||
import com.kingsrook.qqq.api.model.actions.GenerateOpenApiSpecInput;
|
||||
import com.kingsrook.qqq.api.model.actions.GenerateOpenApiSpecOutput;
|
||||
import com.kingsrook.qqq.api.model.actions.GetTableApiFieldsInput;
|
||||
import com.kingsrook.qqq.api.model.metadata.ApiInstanceMetaData;
|
||||
import com.kingsrook.qqq.api.model.openapi.Components;
|
||||
import com.kingsrook.qqq.api.model.openapi.Contact;
|
||||
import com.kingsrook.qqq.api.model.openapi.Content;
|
||||
@ -80,13 +82,15 @@ public class GenerateOpenApiSpecAction extends AbstractQActionFunction<GenerateO
|
||||
|
||||
QInstance qInstance = QContext.getQInstance();
|
||||
|
||||
ApiInstanceMetaData apiInstanceMetaData = ApiMiddlewareType.getApiInstanceMetaData(qInstance);
|
||||
|
||||
OpenAPI openAPI = new OpenAPI()
|
||||
.withVersion("3.0.3")
|
||||
.withInfo(new Info()
|
||||
.withTitle("QQQ API")
|
||||
.withDescription("This is an openAPI built by QQQ")
|
||||
.withTitle(apiInstanceMetaData.getName())
|
||||
.withDescription(apiInstanceMetaData.getDescription())
|
||||
.withContact(new Contact()
|
||||
.withEmail("contact@kingsrook.com")
|
||||
.withEmail(apiInstanceMetaData.getContactEmail())
|
||||
)
|
||||
.withVersion(version)
|
||||
)
|
||||
@ -110,6 +114,7 @@ public class GenerateOpenApiSpecAction extends AbstractQActionFunction<GenerateO
|
||||
LinkedHashMap<String, String> scopes = new LinkedHashMap<>();
|
||||
securitySchemes.put("OAuth2", new OAuth2()
|
||||
.withFlows(MapBuilder.of("authorizationCode", new OAuth2Flow()
|
||||
// todo - get from auth metadata
|
||||
.withAuthorizationUrl("https://nutrifresh-one-development.us.auth0.com/authorize")
|
||||
.withTokenUrl("https://nutrifresh-one-development.us.auth0.com/oauth/token")
|
||||
.withScopes(scopes)
|
||||
@ -162,13 +167,13 @@ public class GenerateOpenApiSpecAction extends AbstractQActionFunction<GenerateO
|
||||
scopes.put(tableUpdatePermissionName, "Permission to update records in the " + tableLabel + " table");
|
||||
}
|
||||
|
||||
String tableInsertPermissionName = PermissionsHelper.getTablePermissionName(tableName, TablePermissionSubType.EDIT);
|
||||
String tableInsertPermissionName = PermissionsHelper.getTablePermissionName(tableName, TablePermissionSubType.INSERT);
|
||||
if(StringUtils.hasContent(tableInsertPermissionName))
|
||||
{
|
||||
scopes.put(tableInsertPermissionName, "Permission to insert records in the " + tableLabel + " table");
|
||||
}
|
||||
|
||||
String tableDeletePermissionName = PermissionsHelper.getTablePermissionName(tableName, TablePermissionSubType.EDIT);
|
||||
String tableDeletePermissionName = PermissionsHelper.getTablePermissionName(tableName, TablePermissionSubType.DELETE);
|
||||
if(StringUtils.hasContent(tableDeletePermissionName))
|
||||
{
|
||||
scopes.put(tableDeletePermissionName, "Permission to delete records in the " + tableLabel + " table");
|
||||
@ -403,25 +408,56 @@ public class GenerateOpenApiSpecAction extends AbstractQActionFunction<GenerateO
|
||||
.withPost(slashPost)
|
||||
);
|
||||
|
||||
/*
|
||||
////////////////
|
||||
// bulk paths //
|
||||
////////////////
|
||||
Method bulkPost = new Method()
|
||||
.withSummary("Create multiple " + tableLabel + " records.")
|
||||
.withRequestBody(new RequestBody()
|
||||
.withRequired(true)
|
||||
.withDescription("Values for the " + tableLabel + " records to create.")
|
||||
.withContent(MapBuilder.of("application/json", new Content()
|
||||
.withSchema(new Schema()
|
||||
.withType("array")
|
||||
.withItems(new Schema().withRef("#/components/schemas/" + tableName + "WithoutPrimaryKey"))))))
|
||||
.withResponses(buildStandardErrorResponses())
|
||||
.withResponse(HttpStatus.MULTI_STATUS.getCode(), buildMultiStatusResponse(tableLabel, primaryKeyName, primaryKeyField, "post"))
|
||||
.withTags(ListBuilder.of(tableLabel))
|
||||
.withSecurity(ListBuilder.of(MapBuilder.of("OAuth2", List.of(tableInsertPermissionName))));
|
||||
|
||||
Method bulkPatch = new Method()
|
||||
.withSummary("Update multiple " + tableLabel + " records.")
|
||||
.withRequestBody(new RequestBody()
|
||||
.withRequired(true)
|
||||
.withDescription("Values for the " + tableLabel + " records to update.")
|
||||
.withContent(MapBuilder.of("application/json", new Content()
|
||||
.withSchema(new Schema()
|
||||
.withType("array")
|
||||
.withItems(new Schema().withRef("#/components/schemas/" + tableName))))))
|
||||
.withResponses(buildStandardErrorResponses())
|
||||
.withResponse(HttpStatus.MULTI_STATUS.getCode(), buildMultiStatusResponse(tableLabel, primaryKeyName, primaryKeyField, "patch"))
|
||||
.withTags(ListBuilder.of(tableLabel))
|
||||
.withSecurity(ListBuilder.of(MapBuilder.of("OAuth2", List.of(tableUpdatePermissionName))));
|
||||
|
||||
Method bulkDelete = new Method()
|
||||
.withSummary("Delete multiple " + tableLabel + " records.")
|
||||
.withRequestBody(new RequestBody()
|
||||
.withRequired(true)
|
||||
.withDescription(primaryKeyLabel + " values for the " + tableLabel + " records to delete.")
|
||||
.withContent(MapBuilder.of("application/json", new Content()
|
||||
.withSchema(new Schema()
|
||||
.withType("array")
|
||||
.withItems(new Schema().withType(getFieldType(primaryKeyField)))
|
||||
.withExample(List.of(42, 47))))))
|
||||
.withResponses(buildStandardErrorResponses())
|
||||
.withResponse(HttpStatus.MULTI_STATUS.getCode(), buildMultiStatusResponse(tableLabel, primaryKeyName, primaryKeyField, "delete"))
|
||||
.withTags(ListBuilder.of(tableLabel))
|
||||
.withSecurity(ListBuilder.of(MapBuilder.of("OAuth2", List.of(tableDeletePermissionName))));
|
||||
|
||||
openAPI.getPaths().put("/" + tableName + "/bulk", new Path()
|
||||
.withPatch(new Method()
|
||||
.withSummary("Update multiple " + tableLabel + " records.")
|
||||
.withTags(ListBuilder.of(tableLabel))
|
||||
.withResponses(buildStandardErrorResponses())
|
||||
)
|
||||
.withDelete(new Method()
|
||||
.withSummary("Delete multiple " + tableLabel + " records.")
|
||||
.withTags(ListBuilder.of(tableLabel))
|
||||
.withResponses(buildStandardErrorResponses())
|
||||
)
|
||||
.withPost(new Method()
|
||||
.withSummary("Create multiple " + tableLabel + " records.")
|
||||
.withTags(ListBuilder.of(tableLabel))
|
||||
.withResponses(buildStandardErrorResponses())
|
||||
)
|
||||
);
|
||||
*/
|
||||
.withPost(bulkPost)
|
||||
.withPatch(bulkPatch)
|
||||
.withDelete(bulkDelete));
|
||||
}
|
||||
|
||||
componentResponses.put(HttpStatus.BAD_REQUEST.getCode(), buildStandardErrorResponse("Bad Request. Some portion of the request's content was not acceptable to the server. See error message in body for details.", "Parameter id should be given an integer value, but received string: \"Foo\""));
|
||||
@ -438,6 +474,68 @@ public class GenerateOpenApiSpecAction extends AbstractQActionFunction<GenerateO
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings("checkstyle:indentation")
|
||||
private Response buildMultiStatusResponse(String tableLabel, String primaryKeyName, QFieldMetaData primaryKeyField, String method)
|
||||
{
|
||||
List<Object> example = switch(method.toLowerCase())
|
||||
{
|
||||
case "post" -> ListBuilder.of(
|
||||
MapBuilder.of(LinkedHashMap::new)
|
||||
.with("statusCode", HttpStatus.CREATED.getCode())
|
||||
.with("statusText", HttpStatus.CREATED.getMessage())
|
||||
.with(primaryKeyName, "47").build(),
|
||||
MapBuilder.of(LinkedHashMap::new)
|
||||
.with("statusCode", HttpStatus.BAD_REQUEST.getCode())
|
||||
.with("statusText", HttpStatus.BAD_REQUEST.getMessage())
|
||||
.with("error", "Could not create " + tableLabel + ": Duplicate value in unique key field.").build()
|
||||
);
|
||||
case "patch" -> ListBuilder.of(
|
||||
MapBuilder.of(LinkedHashMap::new)
|
||||
.with("statusCode", HttpStatus.NO_CONTENT.getCode())
|
||||
.with("statusText", HttpStatus.NO_CONTENT.getMessage()).build(),
|
||||
MapBuilder.of(LinkedHashMap::new)
|
||||
.with("statusCode", HttpStatus.BAD_REQUEST.getCode())
|
||||
.with("statusText", HttpStatus.BAD_REQUEST.getMessage())
|
||||
.with("error", "Could not update " + tableLabel + ": Duplicate value in unique key field.").build()
|
||||
);
|
||||
case "delete" -> ListBuilder.of(
|
||||
MapBuilder.of(LinkedHashMap::new)
|
||||
.with("statusCode", HttpStatus.NO_CONTENT.getCode())
|
||||
.with("statusText", HttpStatus.NO_CONTENT.getMessage()).build(),
|
||||
MapBuilder.of(LinkedHashMap::new)
|
||||
.with("statusCode", HttpStatus.BAD_REQUEST.getCode())
|
||||
.with("statusText", HttpStatus.BAD_REQUEST.getMessage())
|
||||
.with("error", "Could not delete " + tableLabel + ": Foreign key constraint violation.").build()
|
||||
);
|
||||
default -> throw (new IllegalArgumentException("Unrecognized method: " + method));
|
||||
};
|
||||
|
||||
Map<String, Schema> properties = new LinkedHashMap<>();
|
||||
properties.put("status", new Schema().withType("integer"));
|
||||
properties.put("error", new Schema().withType("string"));
|
||||
if(method.equalsIgnoreCase("post"))
|
||||
{
|
||||
properties.put(primaryKeyName, new Schema().withType(getFieldType(primaryKeyField)));
|
||||
}
|
||||
|
||||
return new Response()
|
||||
.withDescription("Multiple statuses. See body for details.")
|
||||
.withContent(MapBuilder.of("application/json", new Content()
|
||||
.withSchema(new Schema()
|
||||
.withType("array")
|
||||
.withItems(new Schema()
|
||||
.withType("object")
|
||||
.withProperties(properties))
|
||||
.withExample(example)
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
|
@ -91,6 +91,7 @@ import io.javalin.apibuilder.EndpointGroup;
|
||||
import io.javalin.http.ContentType;
|
||||
import io.javalin.http.Context;
|
||||
import org.eclipse.jetty.http.HttpStatus;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
import static com.kingsrook.qqq.backend.core.logging.LogUtils.logPair;
|
||||
import static com.kingsrook.qqq.backend.javalin.QJavalinImplementation.SLOW_LOG_THRESHOLD_MS;
|
||||
@ -140,7 +141,7 @@ public class QJavalinApiHandler
|
||||
ApiBuilder.patch("/{primaryKey}", QJavalinApiHandler::doUpdate);
|
||||
ApiBuilder.delete("/{primaryKey}", QJavalinApiHandler::doDelete);
|
||||
|
||||
// post("/bulk", QJavalinApiHandler::bulkInsert);
|
||||
ApiBuilder.post("/bulk", QJavalinApiHandler::bulkInsert);
|
||||
// patch("/bulk", QJavalinApiHandler::bulkUpdate);
|
||||
// delete("/bulk", QJavalinApiHandler::bulkDelete);
|
||||
});
|
||||
@ -514,8 +515,9 @@ public class QJavalinApiHandler
|
||||
throw (new QNotFoundException("Could not find any resources at path " + context.path()));
|
||||
}
|
||||
|
||||
APIVersion requestApiVersion = new APIVersion(version);
|
||||
if(!ApiMiddlewareType.getApiInstanceMetaData(qInstance).getSupportedVersions().contains(requestApiVersion))
|
||||
APIVersion requestApiVersion = new APIVersion(version);
|
||||
List<APIVersion> supportedVersions = ApiMiddlewareType.getApiInstanceMetaData(qInstance).getSupportedVersions();
|
||||
if(CollectionUtils.nullSafeIsEmpty(supportedVersions) || !supportedVersions.contains(requestApiVersion))
|
||||
{
|
||||
throw (new QNotFoundException("This version of this API does not contain the resource path " + context.path()));
|
||||
}
|
||||
@ -717,6 +719,104 @@ public class QJavalinApiHandler
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
private static void bulkInsert(Context context)
|
||||
{
|
||||
String version = context.pathParam("version");
|
||||
String tableName = context.pathParam("tableName");
|
||||
|
||||
try
|
||||
{
|
||||
QTableMetaData table = qInstance.getTable(tableName);
|
||||
validateTableAndVersion(context, version, table);
|
||||
|
||||
InsertInput insertInput = new InsertInput();
|
||||
|
||||
setupSession(context, insertInput);
|
||||
QJavalinAccessLogger.logStart("bulkInsert", logPair("table", tableName));
|
||||
|
||||
insertInput.setTableName(tableName);
|
||||
|
||||
PermissionsHelper.checkTablePermissionThrowing(insertInput, TablePermissionSubType.INSERT);
|
||||
|
||||
/////////////////
|
||||
// build input //
|
||||
/////////////////
|
||||
try
|
||||
{
|
||||
if(!StringUtils.hasContent(context.body()))
|
||||
{
|
||||
throw (new QBadRequestException("Missing required POST body"));
|
||||
}
|
||||
|
||||
ArrayList<QRecord> recordList = new ArrayList<>();
|
||||
insertInput.setRecords(recordList);
|
||||
JSONArray jsonArray = new JSONArray(context.body());
|
||||
for(int i = 0; i < jsonArray.length(); i++)
|
||||
{
|
||||
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
||||
recordList.add(toQRecord(jsonObject, tableName, version));
|
||||
}
|
||||
|
||||
if(recordList.isEmpty())
|
||||
{
|
||||
throw (new QBadRequestException("No records were found in the POST body"));
|
||||
}
|
||||
}
|
||||
catch(QBadRequestException qbre)
|
||||
{
|
||||
throw (qbre);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
throw (new QBadRequestException("Body could not be parsed as a JSON array: " + e.getMessage(), e));
|
||||
}
|
||||
|
||||
//////////////
|
||||
// execute! //
|
||||
//////////////
|
||||
InsertAction insertAction = new InsertAction();
|
||||
InsertOutput insertOutput = insertAction.execute(insertInput);
|
||||
|
||||
///////////////////////////////////////
|
||||
// process records to build response //
|
||||
///////////////////////////////////////
|
||||
List<Map<String, Serializable>> response = new ArrayList<>();
|
||||
for(QRecord record : insertOutput.getRecords())
|
||||
{
|
||||
LinkedHashMap<String, Serializable> outputRecord = new LinkedHashMap<>();
|
||||
response.add(outputRecord);
|
||||
|
||||
List<String> errors = record.getErrors();
|
||||
if(CollectionUtils.nullSafeHasContents(errors))
|
||||
{
|
||||
outputRecord.put("statusCode", HttpStatus.Code.BAD_REQUEST.getCode());
|
||||
outputRecord.put("statusText", HttpStatus.Code.BAD_REQUEST.getMessage());
|
||||
outputRecord.put("error", "Error inserting " + table.getLabel() + ": " + StringUtils.joinWithCommasAndAnd(errors));
|
||||
}
|
||||
else
|
||||
{
|
||||
outputRecord.put("statusCode", HttpStatus.Code.CREATED.getCode());
|
||||
outputRecord.put("statusText", HttpStatus.Code.CREATED.getMessage());
|
||||
outputRecord.put(table.getPrimaryKeyField(), record.getValue(table.getPrimaryKeyField()));
|
||||
}
|
||||
}
|
||||
|
||||
QJavalinAccessLogger.logEndSuccess();
|
||||
context.status(HttpStatus.Code.MULTI_STATUS.getCode());
|
||||
context.result(JsonUtils.toJson(response));
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
QJavalinAccessLogger.logEndFail(e);
|
||||
handleException(context, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
|
@ -22,11 +22,18 @@
|
||||
package com.kingsrook.qqq.api.model.metadata;
|
||||
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import com.kingsrook.qqq.api.ApiMiddlewareType;
|
||||
import com.kingsrook.qqq.api.model.APIVersion;
|
||||
import com.kingsrook.qqq.api.model.metadata.tables.ApiTableMetaData;
|
||||
import com.kingsrook.qqq.backend.core.instances.QInstanceValidator;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.QMiddlewareInstanceMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.tables.QTableMetaData;
|
||||
import com.kingsrook.qqq.backend.core.utils.CollectionUtils;
|
||||
import com.kingsrook.qqq.backend.core.utils.StringUtils;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@ -34,6 +41,10 @@ import com.kingsrook.qqq.backend.core.model.metadata.QMiddlewareInstanceMetaData
|
||||
*******************************************************************************/
|
||||
public class ApiInstanceMetaData extends QMiddlewareInstanceMetaData
|
||||
{
|
||||
private String name;
|
||||
private String description;
|
||||
private String contactEmail;
|
||||
|
||||
private APIVersion currentVersion;
|
||||
private List<APIVersion> supportedVersions;
|
||||
private List<APIVersion> pastVersions;
|
||||
@ -56,11 +67,49 @@ public class ApiInstanceMetaData extends QMiddlewareInstanceMetaData
|
||||
**
|
||||
*******************************************************************************/
|
||||
@Override
|
||||
public void validate(QInstance qInstance)
|
||||
public void validate(QInstance qInstance, QInstanceValidator validator)
|
||||
{
|
||||
// todo - version is set
|
||||
// todo - past versions all < current < all future
|
||||
// todo - any version specified anywhere is one of the known
|
||||
validator.assertCondition(StringUtils.hasContent(name), "Missing name for instance api");
|
||||
validator.assertCondition(StringUtils.hasContent(description), "Missing description for instance api");
|
||||
validator.assertCondition(StringUtils.hasContent(contactEmail), "Missing contactEmail for instance api");
|
||||
|
||||
Set<APIVersion> allVersions = new HashSet<>();
|
||||
|
||||
if(validator.assertCondition(currentVersion != null, "Missing currentVersion for instance api"))
|
||||
{
|
||||
allVersions.add(currentVersion);
|
||||
}
|
||||
|
||||
if(validator.assertCondition(supportedVersions != null, "Missing supportedVersions for instance api"))
|
||||
{
|
||||
validator.assertCondition(supportedVersions.contains(currentVersion), "supportedVersions [" + supportedVersions + "] does not contain currentVersion [" + currentVersion + "] for instance api");
|
||||
allVersions.addAll(supportedVersions);
|
||||
}
|
||||
|
||||
for(APIVersion pastVersion : CollectionUtils.nonNullList(pastVersions))
|
||||
{
|
||||
validator.assertCondition(pastVersion.compareTo(currentVersion) < 0, "pastVersion [" + pastVersion + "] is not lexicographically before currentVersion [" + currentVersion + "] for instance api");
|
||||
allVersions.add(pastVersion);
|
||||
}
|
||||
|
||||
for(APIVersion futureVersion : CollectionUtils.nonNullList(futureVersions))
|
||||
{
|
||||
validator.assertCondition(futureVersion.compareTo(currentVersion) > 0, "futureVersion [" + futureVersion + "] is not lexicographically after currentVersion [" + currentVersion + "] for instance api");
|
||||
allVersions.add(futureVersion);
|
||||
}
|
||||
|
||||
/////////////////////////////////
|
||||
// validate all table versions //
|
||||
/////////////////////////////////
|
||||
for(QTableMetaData table : qInstance.getTables().values())
|
||||
{
|
||||
ApiTableMetaData apiTableMetaData = ApiMiddlewareType.getApiTableMetaData(table);
|
||||
if(apiTableMetaData != null)
|
||||
{
|
||||
validator.assertCondition(allVersions.contains(new APIVersion(apiTableMetaData.getInitialVersion())), "Table " + table.getName() + "'s initial API version is not a recognized version.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -187,4 +236,97 @@ public class ApiInstanceMetaData extends QMiddlewareInstanceMetaData
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for name
|
||||
*******************************************************************************/
|
||||
public String getName()
|
||||
{
|
||||
return (this.name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for name
|
||||
*******************************************************************************/
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for name
|
||||
*******************************************************************************/
|
||||
public ApiInstanceMetaData withName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for description
|
||||
*******************************************************************************/
|
||||
public String getDescription()
|
||||
{
|
||||
return (this.description);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for description
|
||||
*******************************************************************************/
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for description
|
||||
*******************************************************************************/
|
||||
public ApiInstanceMetaData withDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for contactEmail
|
||||
*******************************************************************************/
|
||||
public String getContactEmail()
|
||||
{
|
||||
return (this.contactEmail);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for contactEmail
|
||||
*******************************************************************************/
|
||||
public void setContactEmail(String contactEmail)
|
||||
{
|
||||
this.contactEmail = contactEmail;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for contactEmail
|
||||
*******************************************************************************/
|
||||
public ApiInstanceMetaData withContactEmail(String contactEmail)
|
||||
{
|
||||
this.contactEmail = contactEmail;
|
||||
return (this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ public class Schema
|
||||
private List<String> enumValues;
|
||||
private Schema items;
|
||||
private Map<String, Schema> properties;
|
||||
private String example;
|
||||
private Object example;
|
||||
private String ref;
|
||||
private List<Schema> allOf;
|
||||
|
||||
@ -171,7 +171,7 @@ public class Schema
|
||||
/*******************************************************************************
|
||||
** Getter for example
|
||||
*******************************************************************************/
|
||||
public String getExample()
|
||||
public Object getExample()
|
||||
{
|
||||
return (this.example);
|
||||
}
|
||||
@ -199,6 +199,27 @@ public class Schema
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for example
|
||||
*******************************************************************************/
|
||||
public void setExample(List<?> example)
|
||||
{
|
||||
this.example = example;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for example
|
||||
*******************************************************************************/
|
||||
public Schema withExample(List<?> example)
|
||||
{
|
||||
this.example = example;
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for ref
|
||||
*******************************************************************************/
|
||||
|
Reference in New Issue
Block a user