Package com.smartgwt.client.data
Class JSONSchemaSettings
java.lang.Object
com.smartgwt.client.core.JsObject
com.smartgwt.client.core.DataClass
com.smartgwt.client.data.JSONSchemaSettings
- All Implemented Interfaces:
HasHandlers
Settings for
DataSource.asJSONSchema(), controlling what information is included and how it is formatted.-
Field Summary
Fields inherited from class com.smartgwt.client.core.DataClass
factoryCreated, factoryProperties -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionPrefix for custom annotation keys added to the schema.When true,asJSONSchema()returns the JSON Schema as a formatted JSON string instead of a plain object.When true, event/action binding schemas omit the"params"property, relying on automatic parameter binding.When true, the generated schema is cached on the DataSource, keyed by the JSON serialization of these settings.Optional EditContext used to influence event/action schema by providing the set of live editing components and their types.Controls how event handler properties are represented in the generated schema.Whether to include fields markedadvanced:truein the output schema.Controls whether and at what granularity descriptions appear on schema properties.Whether to include fields markedhidden:truein the output schema.Whether to output non-translatable validator information (such as custom validators) as annotations.Whether to includevisibleWhen,enableWhen,readOnlyWhenand similar rules in the schema as annotations.Maximum nesting depth for recursive DataSource discovery.static JSONSchemaSettingsgetOrCreateRef(JavaScriptObject jsObj) Optional Canvas that provides a ruleScope.When true (the default), reusable DataSource types are placed in a$defsblock and referenced via$ref.setAnnotationPrefix(String annotationPrefix) Prefix for custom annotation keys added to the schema.setAsString(Boolean asString) When true,asJSONSchema()returns the JSON Schema as a formatted JSON string instead of a plain object.setAutoBindEvents(Boolean autoBindEvents) When true, event/action binding schemas omit the"params"property, relying on automatic parameter binding.setCacheSchema(Boolean cacheSchema) When true, the generated schema is cached on the DataSource, keyed by the JSON serialization of these settings.setEditContext(EditContext editContext) Optional EditContext used to influence event/action schema by providing the set of live editing components and their types.setEventMode(EventSchemaMode eventMode) Controls how event handler properties are represented in the generated schema.setIncludeAdvanced(Boolean includeAdvanced) Whether to include fields markedadvanced:truein the output schema.setIncludeDescriptions(DescriptionMode includeDescriptions) Controls whether and at what granularity descriptions appear on schema properties.setIncludeHidden(Boolean includeHidden) Whether to include fields markedhidden:truein the output schema.setIncludeValidators(Boolean includeValidators) Whether to output non-translatable validator information (such as custom validators) as annotations.setIncludeWhenRules(Boolean includeWhenRules) Whether to includevisibleWhen,enableWhen,readOnlyWhenand similar rules in the schema as annotations.setMaxDepth(Integer maxDepth) Maximum nesting depth for recursive DataSource discovery.setRuleScopeSource(Canvas ruleScopeSource) Optional Canvas that provides a ruleScope.setUseDefs(Boolean useDefs) When true (the default), reusable DataSource types are placed in a$defsblock and referenced via$ref.Methods inherited from class com.smartgwt.client.core.DataClass
applyFactoryProperties, doAddHandler, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsDoubleArray, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsIntArray, getAttributeAsJavaScriptObject, getAttributeAsLong, getAttributeAsMap, getAttributeAsObject, getAttributeAsRecord, getAttributeAsString, getAttributeAsStringArray, getAttributes, getHandlerCount, isFactoryCreated, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributeAsJavaObject, setFactoryCreated
-
Constructor Details
-
JSONSchemaSettings
public JSONSchemaSettings() -
JSONSchemaSettings
-
-
Method Details
-
getOrCreateRef
-
setAnnotationPrefix
Prefix for custom annotation keys added to the schema. Must start with"x-"per the JSON Schema specification.- Parameters:
annotationPrefix- New annotationPrefix value. Default value is "x-isc-"- Returns:
JSONSchemaSettingsinstance, for chaining setter calls
-
getAnnotationPrefix
Prefix for custom annotation keys added to the schema. Must start with"x-"per the JSON Schema specification.- Returns:
- Current annotationPrefix value. Default value is "x-isc-"
-
setAsString
When true,asJSONSchema()returns the JSON Schema as a formatted JSON string instead of a plain object.- Parameters:
asString- New asString value. Default value is false- Returns:
JSONSchemaSettingsinstance, for chaining setter calls
-
getAsString
When true,asJSONSchema()returns the JSON Schema as a formatted JSON string instead of a plain object.- Returns:
- Current asString value. Default value is false
-
setAutoBindEvents
When true, event/action binding schemas omit the"params"property, relying on automatic parameter binding. Defaults to true when ISC_Tools.js is loaded and JSDoc data is available.- Parameters:
autoBindEvents- New autoBindEvents value. Default value is null- Returns:
JSONSchemaSettingsinstance, for chaining setter calls
-
getAutoBindEvents
When true, event/action binding schemas omit the"params"property, relying on automatic parameter binding. Defaults to true when ISC_Tools.js is loaded and JSDoc data is available.- Returns:
- Current autoBindEvents value. Default value is null
-
setCacheSchema
When true, the generated schema is cached on the DataSource, keyed by the JSON serialization of these settings. Subsequent calls with the same settings return the cached result. An empty settings object is cached by default regardless of this flag.- Parameters:
cacheSchema- New cacheSchema value. Default value is false- Returns:
JSONSchemaSettingsinstance, for chaining setter calls
-
getCacheSchema
When true, the generated schema is cached on the DataSource, keyed by the JSON serialization of these settings. Subsequent calls with the same settings return the cached result. An empty settings object is cached by default regardless of this flag.- Returns:
- Current cacheSchema value. Default value is false
-
setEditContext
Optional EditContext used to influence event/action schema by providing the set of live editing components and their types.- Parameters:
editContext- New editContext value. Default value is null- Returns:
JSONSchemaSettingsinstance, for chaining setter calls
-
getEditContext
Optional EditContext used to influence event/action schema by providing the set of live editing components and their types.- Returns:
- Current editContext value. Default value is null
-
setEventMode
Controls how event handler properties are represented in the generated schema.- Parameters:
eventMode- New eventMode value. Default value is "omit"- Returns:
JSONSchemaSettingsinstance, for chaining setter calls
-
getEventMode
Controls how event handler properties are represented in the generated schema.- Returns:
- Current eventMode value. Default value is "omit"
-
setIncludeAdvanced
Whether to include fields markedadvanced:truein the output schema.- Parameters:
includeAdvanced- New includeAdvanced value. Default value is false- Returns:
JSONSchemaSettingsinstance, for chaining setter calls
-
getIncludeAdvanced
Whether to include fields markedadvanced:truein the output schema.- Returns:
- Current includeAdvanced value. Default value is false
-
setIncludeDescriptions
Controls whether and at what granularity descriptions appear on schema properties. If unset, defaults to"brief"when brief descriptions are available (checked viaisc.jsdoc.hasBriefDescriptions()), otherwise"none".- Parameters:
includeDescriptions- New includeDescriptions value. Default value is null- Returns:
JSONSchemaSettingsinstance, for chaining setter calls
-
getIncludeDescriptions
Controls whether and at what granularity descriptions appear on schema properties. If unset, defaults to"brief"when brief descriptions are available (checked viaisc.jsdoc.hasBriefDescriptions()), otherwise"none".- Returns:
- Current includeDescriptions value. Default value is null
-
setIncludeHidden
Whether to include fields markedhidden:truein the output schema.- Parameters:
includeHidden- New includeHidden value. Default value is false- Returns:
JSONSchemaSettingsinstance, for chaining setter calls
-
getIncludeHidden
Whether to include fields markedhidden:truein the output schema.- Returns:
- Current includeHidden value. Default value is false
-
setIncludeValidators
Whether to output non-translatable validator information (such as custom validators) as annotations. Validators that have direct JSON Schema equivalents (minLength, maxLength, minimum, maximum, pattern, enum) are always translated structurally.- Parameters:
includeValidators- New includeValidators value. Default value is true- Returns:
JSONSchemaSettingsinstance, for chaining setter calls
-
getIncludeValidators
Whether to output non-translatable validator information (such as custom validators) as annotations. Validators that have direct JSON Schema equivalents (minLength, maxLength, minimum, maximum, pattern, enum) are always translated structurally.- Returns:
- Current includeValidators value. Default value is true
-
setIncludeWhenRules
Whether to includevisibleWhen,enableWhen,readOnlyWhenand similar rules in the schema as annotations.- Parameters:
includeWhenRules- New includeWhenRules value. Default value is false- Returns:
JSONSchemaSettingsinstance, for chaining setter calls
-
getIncludeWhenRules
Whether to includevisibleWhen,enableWhen,readOnlyWhenand similar rules in the schema as annotations.- Returns:
- Current includeWhenRules value. Default value is false
-
setMaxDepth
Maximum nesting depth for recursive DataSource discovery. Intended as an infinite-recursion guard; a logWarn() is issued if this depth is exceeded.- Parameters:
maxDepth- New maxDepth value. Default value is 250- Returns:
JSONSchemaSettingsinstance, for chaining setter calls
-
getMaxDepth
Maximum nesting depth for recursive DataSource discovery. Intended as an infinite-recursion guard; a logWarn() is issued if this depth is exceeded.- Returns:
- Current maxDepth value. Default value is 250
-
setRuleScopeSource
Optional Canvas that provides a ruleScope. When set, the action binding schema enumerates valid target component IDs from canvas.getRuleScopeDataBoundComponents(), and*Whenrules include valid field names from the ruleScope.- Parameters:
ruleScopeSource- New ruleScopeSource value. Default value is null- Returns:
JSONSchemaSettingsinstance, for chaining setter calls
-
getRuleScopeSource
Optional Canvas that provides a ruleScope. When set, the action binding schema enumerates valid target component IDs from canvas.getRuleScopeDataBoundComponents(), and*Whenrules include valid field names from the ruleScope.- Returns:
- Current ruleScopeSource value. Default value is null
-
setUseDefs
When true (the default), reusable DataSource types are placed in a$defsblock and referenced via$ref. Set to false to use the olderdefinitionskeyword instead.- Parameters:
useDefs- New useDefs value. Default value is true- Returns:
JSONSchemaSettingsinstance, for chaining setter calls
-
getUseDefs
When true (the default), reusable DataSource types are placed in a$defsblock and referenced via$ref. Set to false to use the olderdefinitionskeyword instead.- Returns:
- Current useDefs value. Default value is true
-