Class OpenAPIBuilder
- java.lang.Object
-
- org.opennms.features.config.dao.impl.util.OpenAPIBuilder
-
public class OpenAPIBuilder extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static String
SCHEMA_REF_TAG
-
Constructor Summary
Constructors Constructor Description OpenAPIBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description OpenAPIBuilder
addArray(String name, ConfigItem.Type elementType, Long arrayMin, Long arrayMax, Long min, Long max, Long multipleOf, String pattern, Object defaultValue, boolean required, String doc)
OpenAPIBuilder
addArray(String name, OpenAPIBuilder childrenBuilder, Long arrayMin, Long arrayMax, boolean required, String doc)
OpenAPIBuilder
addAttribute(ConfigItem configItem)
OpenAPIBuilder
addBooleanAttribute(String name, Object defaultValue, boolean required, String doc)
OpenAPIBuilder
addDateAttribute(String name, Object defaultValue, boolean required, String doc)
OpenAPIBuilder
addDateTimeAttribute(String name, Object defaultValue, boolean required, String doc)
OpenAPIBuilder
addNumberAttribute(String name, ConfigItem.Type type, Long min, Long max, Long multipleOf, Object defaultValue, boolean required, String doc)
OpenAPIBuilder
addObject(String name, OpenAPIBuilder childrenBuilder, boolean required, String doc)
OpenAPIBuilder
addStringAttribute(String name, Long minLength, Long maxLength, String pattern, Object defaultValue, boolean required, String doc)
io.swagger.v3.oas.models.OpenAPI
build(boolean isSingleConfig)
build OpenAPI, if isSingleConfig is false.static OpenAPIBuilder
createBuilder()
static OpenAPIBuilder
createBuilder(String name, String topElementName, String prefix)
In most cases, configName and topElementName can be the same.static OpenAPIBuilder
createBuilder(String name, String topElementName, String prefix, io.swagger.v3.oas.models.OpenAPI openapi)
This is use for modify existing OpenAPI objectConfigItem
getRootConfig()
OpenAPIBuilder
removeAttribute(String attributeName)
It will directly remove the first level attribute only
-
-
-
Field Detail
-
SCHEMA_REF_TAG
public static final String SCHEMA_REF_TAG
- See Also:
- Constant Field Values
-
-
Method Detail
-
createBuilder
public static OpenAPIBuilder createBuilder(String name, String topElementName, String prefix)
In most cases, configName and topElementName can be the same. It just gives you the flexibility. If you only want to make a nested object use createBuilder() More details of usage please refer to OpenAPIBuilderTest.class- Parameters:
name
-topElementName
-prefix
-- Returns:
- See Also:
createBuilder()
,org.opennms.features.config.dao.util.OpenAPIBuilderTest
-
createBuilder
public static OpenAPIBuilder createBuilder(String name, String topElementName, String prefix, io.swagger.v3.oas.models.OpenAPI openapi)
This is use for modify existing OpenAPI object- Parameters:
name
-topElementName
-prefix
-openapi
- (existing)- Returns:
-
getRootConfig
public ConfigItem getRootConfig()
-
createBuilder
public static OpenAPIBuilder createBuilder()
-
build
public io.swagger.v3.oas.models.OpenAPI build(boolean isSingleConfig)
build OpenAPI, if isSingleConfig is false. It will only generate API path for get and update config. (default) NO add / delete config and list configIds- Parameters:
isSingleConfig
-- Returns:
-
removeAttribute
public OpenAPIBuilder removeAttribute(String attributeName)
It will directly remove the first level attribute only- Parameters:
attributeName
-- Returns:
-
addAttribute
public OpenAPIBuilder addAttribute(ConfigItem configItem)
-
addArray
public OpenAPIBuilder addArray(String name, ConfigItem.Type elementType, Long arrayMin, Long arrayMax, Long min, Long max, Long multipleOf, String pattern, Object defaultValue, boolean required, String doc)
-
addArray
public OpenAPIBuilder addArray(String name, OpenAPIBuilder childrenBuilder, Long arrayMin, Long arrayMax, boolean required, String doc)
-
addObject
public OpenAPIBuilder addObject(String name, OpenAPIBuilder childrenBuilder, boolean required, String doc)
-
addBooleanAttribute
public OpenAPIBuilder addBooleanAttribute(String name, Object defaultValue, boolean required, String doc)
-
addDateTimeAttribute
public OpenAPIBuilder addDateTimeAttribute(String name, Object defaultValue, boolean required, String doc)
-
addDateAttribute
public OpenAPIBuilder addDateAttribute(String name, Object defaultValue, boolean required, String doc)
-
addStringAttribute
public OpenAPIBuilder addStringAttribute(String name, Long minLength, Long maxLength, String pattern, Object defaultValue, boolean required, String doc)
-
addNumberAttribute
public OpenAPIBuilder addNumberAttribute(String name, ConfigItem.Type type, Long min, Long max, Long multipleOf, Object defaultValue, boolean required, String doc)
-
-