mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 05:01:07 +00:00
CE-1955 Switch fieldMetaData to use a type from in here for FieldAdornment, to include some better docs, but also to exclude new FILE_UPLOAD adornment type enum value
This commit is contained in:
@ -0,0 +1,115 @@
|
|||||||
|
/*
|
||||||
|
* QQQ - Low-code Application Framework for Engineers.
|
||||||
|
* Copyright (C) 2021-2024. Kingsrook, LLC
|
||||||
|
* 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
|
||||||
|
* contact@kingsrook.com
|
||||||
|
* https://github.com/Kingsrook/
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.kingsrook.qqq.middleware.javalin.specs.v1.responses.components;
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import com.kingsrook.qqq.backend.core.model.metadata.fields.AdornmentType;
|
||||||
|
import com.kingsrook.qqq.middleware.javalin.schemabuilder.ToSchema;
|
||||||
|
import com.kingsrook.qqq.middleware.javalin.schemabuilder.annotations.OpenAPIDescription;
|
||||||
|
import com.kingsrook.qqq.middleware.javalin.schemabuilder.annotations.OpenAPIEnumSubSet;
|
||||||
|
import com.kingsrook.qqq.middleware.javalin.schemabuilder.annotations.OpenAPIExclude;
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
public class FieldAdornment implements ToSchema
|
||||||
|
{
|
||||||
|
@OpenAPIExclude()
|
||||||
|
private com.kingsrook.qqq.backend.core.model.metadata.fields.FieldAdornment wrapped;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** Constructor
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
public FieldAdornment(com.kingsrook.qqq.backend.core.model.metadata.fields.FieldAdornment wrapped)
|
||||||
|
{
|
||||||
|
this.wrapped = wrapped;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** Constructor
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
public FieldAdornment()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
**
|
||||||
|
***************************************************************************/
|
||||||
|
public static class FieldAdornmentSubSet implements OpenAPIEnumSubSet.EnumSubSet<AdornmentType>
|
||||||
|
{
|
||||||
|
private static EnumSet<AdornmentType> subSet = null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
**
|
||||||
|
***************************************************************************/
|
||||||
|
@Override
|
||||||
|
public EnumSet<AdornmentType> getSubSet()
|
||||||
|
{
|
||||||
|
if(subSet == null)
|
||||||
|
{
|
||||||
|
EnumSet<AdornmentType> subSet = EnumSet.allOf(AdornmentType.class);
|
||||||
|
subSet.remove(AdornmentType.FILE_UPLOAD); // todo - remove for next version!
|
||||||
|
FieldAdornmentSubSet.subSet = subSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (subSet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
**
|
||||||
|
***************************************************************************/
|
||||||
|
@OpenAPIDescription("Type of this adornment")
|
||||||
|
@OpenAPIEnumSubSet(FieldAdornmentSubSet.class)
|
||||||
|
public AdornmentType getType()
|
||||||
|
{
|
||||||
|
return (this.wrapped == null || this.wrapped.getType() == null ? null : this.wrapped.getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
**
|
||||||
|
***************************************************************************/
|
||||||
|
@OpenAPIDescription("Values associated with this adornment. Keys and the meanings of their values will differ by type.")
|
||||||
|
public Map<String, Serializable> getValues()
|
||||||
|
{
|
||||||
|
return (this.wrapped.getValues());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -23,7 +23,6 @@ package com.kingsrook.qqq.middleware.javalin.specs.v1.responses.components;
|
|||||||
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.FieldAdornment;
|
|
||||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldMetaData;
|
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldMetaData;
|
||||||
import com.kingsrook.qqq.middleware.javalin.schemabuilder.ToSchema;
|
import com.kingsrook.qqq.middleware.javalin.schemabuilder.ToSchema;
|
||||||
import com.kingsrook.qqq.middleware.javalin.schemabuilder.annotations.OpenAPIDescription;
|
import com.kingsrook.qqq.middleware.javalin.schemabuilder.annotations.OpenAPIDescription;
|
||||||
@ -61,6 +60,7 @@ public class FieldMetaData implements ToSchema
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
**
|
**
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
@ -82,6 +82,7 @@ public class FieldMetaData implements ToSchema
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
**
|
**
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
@ -92,6 +93,7 @@ public class FieldMetaData implements ToSchema
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
**
|
**
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
@ -102,6 +104,7 @@ public class FieldMetaData implements ToSchema
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
**
|
**
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
@ -112,6 +115,7 @@ public class FieldMetaData implements ToSchema
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
**
|
**
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
@ -122,6 +126,7 @@ public class FieldMetaData implements ToSchema
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
**
|
**
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
@ -143,6 +148,7 @@ public class FieldMetaData implements ToSchema
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
**
|
**
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
@ -153,6 +159,7 @@ public class FieldMetaData implements ToSchema
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
**
|
**
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
@ -166,6 +173,8 @@ public class FieldMetaData implements ToSchema
|
|||||||
|
|
||||||
// todo - inline PVS
|
// todo - inline PVS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
**
|
**
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
@ -177,14 +186,17 @@ public class FieldMetaData implements ToSchema
|
|||||||
|
|
||||||
// todo behaviors?
|
// todo behaviors?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
**
|
**
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
@OpenAPIDescription("Special UI dressings to add to the field.")
|
@OpenAPIDescription("Special UI dressings to add to the field.")
|
||||||
@OpenAPIListItems(value = FieldAdornment.class) // todo!
|
@OpenAPIListItems(value = FieldAdornment.class, useRef = true)
|
||||||
public List<FieldAdornment> getAdornments()
|
public List<FieldAdornment> getAdornments()
|
||||||
{
|
{
|
||||||
return (this.wrapped.getAdornments());
|
return (this.wrapped.getAdornments() == null ? null : this.wrapped.getAdornments().stream().map(a -> new FieldAdornment(a)).toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo help content
|
// todo help content
|
||||||
|
@ -130,13 +130,10 @@ components:
|
|||||||
description: "Description of the error"
|
description: "Description of the error"
|
||||||
type: "string"
|
type: "string"
|
||||||
type: "object"
|
type: "object"
|
||||||
FieldMetaData:
|
FieldAdornment:
|
||||||
properties:
|
|
||||||
adornments:
|
|
||||||
description: "Special UI dressings to add to the field."
|
|
||||||
items:
|
|
||||||
properties:
|
properties:
|
||||||
type:
|
type:
|
||||||
|
description: "Type of this adornment"
|
||||||
enum:
|
enum:
|
||||||
- "LINK"
|
- "LINK"
|
||||||
- "CHIP"
|
- "CHIP"
|
||||||
@ -148,8 +145,16 @@ components:
|
|||||||
- "ERROR"
|
- "ERROR"
|
||||||
type: "string"
|
type: "string"
|
||||||
values:
|
values:
|
||||||
|
description: "Values associated with this adornment. Keys and the meanings\
|
||||||
|
\ of their values will differ by type."
|
||||||
type: "object"
|
type: "object"
|
||||||
type: "object"
|
type: "object"
|
||||||
|
FieldMetaData:
|
||||||
|
properties:
|
||||||
|
adornments:
|
||||||
|
description: "Special UI dressings to add to the field."
|
||||||
|
items:
|
||||||
|
$ref: "#/components/schemas/FieldAdornment"
|
||||||
type: "array"
|
type: "array"
|
||||||
defaultValue:
|
defaultValue:
|
||||||
description: "Default value to use in this field."
|
description: "Default value to use in this field."
|
||||||
@ -973,21 +978,7 @@ components:
|
|||||||
adornments:
|
adornments:
|
||||||
description: "Special UI dressings to add to the field."
|
description: "Special UI dressings to add to the field."
|
||||||
items:
|
items:
|
||||||
properties:
|
$ref: "#/components/schemas/FieldAdornment"
|
||||||
type:
|
|
||||||
enum:
|
|
||||||
- "LINK"
|
|
||||||
- "CHIP"
|
|
||||||
- "SIZE"
|
|
||||||
- "CODE_EDITOR"
|
|
||||||
- "RENDER_HTML"
|
|
||||||
- "REVEAL"
|
|
||||||
- "FILE_DOWNLOAD"
|
|
||||||
- "ERROR"
|
|
||||||
type: "string"
|
|
||||||
values:
|
|
||||||
type: "object"
|
|
||||||
type: "object"
|
|
||||||
type: "array"
|
type: "array"
|
||||||
defaultValue:
|
defaultValue:
|
||||||
description: "Default value to use in this field."
|
description: "Default value to use in this field."
|
||||||
|
Reference in New Issue
Block a user