swagger resource fixed for creating datatable & entries (FINERACT-1365)

This commit is contained in:
Danish Jamal
2021-09-05 21:44:07 +08:00
committed by Petri Tuomola
parent b6ec24fa30
commit 3bcac21f57
2 changed files with 22 additions and 7 deletions
@@ -284,7 +284,7 @@ public class DatatablesApiResource {
@Produces({ MediaType.APPLICATION_JSON })
@Operation(summary = "Create Entry in Data Table", description = "Adds a row to the data table.\n" + "\n"
+ "Note that the default datatable UI functionality converts any field name containing spaces to underscores when using the API. This means the field name \"Business Description\" is considered the same as \"Business_Description\". So you shouldn't have both \"versions\" in any data table.")
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = DatatablesApiResourceSwagger.PostDataTablesAppTableIdRequest.class)))
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = String.class)), description = "{\n \"BusinessDescription\": \"Livestock sales\",\n \"Comment\": \"First comment made\",\n \"Education_cv\": \"Primary\",\n \"Gender_cd\": 6,\n \"HighestRatePaid\": 8.5,\n \"NextVisit\": \"01 October 2012\",\n \"YearsinBusiness\": 5,\n \"dateFormat\": \"dd MMMM yyyy\",\n \"locale\": \"en\"\n}")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = DatatablesApiResourceSwagger.PostDataTablesAppTableIdResponse.class))) })
public String createDatatableEntry(@PathParam("datatable") @Parameter(description = "datatable") final String datatable,
@@ -50,17 +50,32 @@ final class DatatablesApiResourceSwagger {
@Schema(description = "PostDataTablesRequest")
public static final class PostDataTablesRequest {
private PostDataTablesRequest() {
private PostDataTablesRequest() {}
static final class PostColumnHeaderData {
private PostColumnHeaderData() {}
@Schema(required = true, example = "DOB")
public String name;
@Schema(required = true, example = "String", description = "Any of them: Boolean | Date | DateTime | Decimal | Dropdown | Number | String | Text")
public String type;
@Schema(example = "Gender", description = "Used in Code Value fields. Column name becomes: code_cd_name. Mandatory if using type Dropdown, otherwise an error is returned.")
public String code;
@Schema(example = "true", description = "Defaults to false")
public Boolean mandatory;
@Schema(example = "1653", description = "Length of the text field. Mandatory if type String is used, otherwise an error is returned.")
public Long length;
}
@Schema(example = "m_client")
public String applicationTableName;
@Schema(example = "extra_client_details")
public String registeredTableName;
@Schema(required = true, example = "m_client")
public String apptableName;
@Schema(required = true, example = "extra_client_details")
public String datatableName;
@Schema(required = false, description = "Allows to create multiple entries in the Data Table. Optional, defaults to false. If this property is not provided Data Table will allow only one entry.", example = "true")
public boolean multiRow;
public List<ResultsetColumnHeaderData> columnHeaderData;
@Schema(required = true)
public List<PostColumnHeaderData> columns;
}
@Schema(description = "PostDataTablesResponse")