Class JSONSchemaSettings

All Implemented Interfaces:
HasHandlers

public class JSONSchemaSettings extends DataClass
Settings for DataSource.asJSONSchema(), controlling what information is included and how it is formatted.
  • Constructor Details

    • JSONSchemaSettings

      public JSONSchemaSettings()
    • JSONSchemaSettings

      public JSONSchemaSettings(JavaScriptObject jsObj)
  • Method Details

    • getOrCreateRef

      public static JSONSchemaSettings getOrCreateRef(JavaScriptObject jsObj)
    • setAnnotationPrefix

      public JSONSchemaSettings setAnnotationPrefix(String annotationPrefix)
      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:
      JSONSchemaSettings instance, for chaining setter calls
    • getAnnotationPrefix

      public String 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

      public JSONSchemaSettings setAsString(Boolean asString)
      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:
      JSONSchemaSettings instance, for chaining setter calls
    • getAsString

      public Boolean 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

      public JSONSchemaSettings setAutoBindEvents(Boolean autoBindEvents)
      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:
      JSONSchemaSettings instance, for chaining setter calls
    • getAutoBindEvents

      public Boolean 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

      public JSONSchemaSettings setCacheSchema(Boolean cacheSchema)
      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:
      JSONSchemaSettings instance, for chaining setter calls
    • getCacheSchema

      public Boolean 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

      public JSONSchemaSettings setEditContext(EditContext editContext)
      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:
      JSONSchemaSettings instance, for chaining setter calls
    • getEditContext

      public EditContext 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

      public JSONSchemaSettings setEventMode(EventSchemaMode eventMode)
      Controls how event handler properties are represented in the generated schema.
      Parameters:
      eventMode - New eventMode value. Default value is "omit"
      Returns:
      JSONSchemaSettings instance, for chaining setter calls
    • getEventMode

      public EventSchemaMode getEventMode()
      Controls how event handler properties are represented in the generated schema.
      Returns:
      Current eventMode value. Default value is "omit"
    • setIncludeAdvanced

      public JSONSchemaSettings setIncludeAdvanced(Boolean includeAdvanced)
      Whether to include fields marked advanced:true in the output schema.
      Parameters:
      includeAdvanced - New includeAdvanced value. Default value is false
      Returns:
      JSONSchemaSettings instance, for chaining setter calls
    • getIncludeAdvanced

      public Boolean getIncludeAdvanced()
      Whether to include fields marked advanced:true in the output schema.
      Returns:
      Current includeAdvanced value. Default value is false
    • setIncludeDescriptions

      public JSONSchemaSettings setIncludeDescriptions(DescriptionMode includeDescriptions)
      Controls whether and at what granularity descriptions appear on schema properties. If unset, defaults to "brief" when brief descriptions are available (checked via isc.jsdoc.hasBriefDescriptions()), otherwise "none".
      Parameters:
      includeDescriptions - New includeDescriptions value. Default value is null
      Returns:
      JSONSchemaSettings instance, for chaining setter calls
    • getIncludeDescriptions

      public DescriptionMode getIncludeDescriptions()
      Controls whether and at what granularity descriptions appear on schema properties. If unset, defaults to "brief" when brief descriptions are available (checked via isc.jsdoc.hasBriefDescriptions()), otherwise "none".
      Returns:
      Current includeDescriptions value. Default value is null
    • setIncludeHidden

      public JSONSchemaSettings setIncludeHidden(Boolean includeHidden)
      Whether to include fields marked hidden:true in the output schema.
      Parameters:
      includeHidden - New includeHidden value. Default value is false
      Returns:
      JSONSchemaSettings instance, for chaining setter calls
    • getIncludeHidden

      public Boolean getIncludeHidden()
      Whether to include fields marked hidden:true in the output schema.
      Returns:
      Current includeHidden value. Default value is false
    • setIncludeValidators

      public JSONSchemaSettings setIncludeValidators(Boolean includeValidators)
      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:
      JSONSchemaSettings instance, for chaining setter calls
    • getIncludeValidators

      public Boolean 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

      public JSONSchemaSettings setIncludeWhenRules(Boolean includeWhenRules)
      Whether to include visibleWhen, enableWhen, readOnlyWhen and similar rules in the schema as annotations.
      Parameters:
      includeWhenRules - New includeWhenRules value. Default value is false
      Returns:
      JSONSchemaSettings instance, for chaining setter calls
    • getIncludeWhenRules

      public Boolean getIncludeWhenRules()
      Whether to include visibleWhen, enableWhen, readOnlyWhen and similar rules in the schema as annotations.
      Returns:
      Current includeWhenRules value. Default value is false
    • setMaxDepth

      public JSONSchemaSettings setMaxDepth(Integer maxDepth)
      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:
      JSONSchemaSettings instance, for chaining setter calls
    • getMaxDepth

      public Integer 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

      public JSONSchemaSettings setRuleScopeSource(Canvas ruleScopeSource)
      Optional Canvas that provides a ruleScope. When set, the action binding schema enumerates valid target component IDs from canvas.getRuleScopeDataBoundComponents(), and *When rules include valid field names from the ruleScope.
      Parameters:
      ruleScopeSource - New ruleScopeSource value. Default value is null
      Returns:
      JSONSchemaSettings instance, for chaining setter calls
    • getRuleScopeSource

      public Canvas getRuleScopeSource()
      Optional Canvas that provides a ruleScope. When set, the action binding schema enumerates valid target component IDs from canvas.getRuleScopeDataBoundComponents(), and *When rules include valid field names from the ruleScope.
      Returns:
      Current ruleScopeSource value. Default value is null
    • setUseDefs

      public JSONSchemaSettings setUseDefs(Boolean useDefs)
      When true (the default), reusable DataSource types are placed in a $defs block and referenced via $ref. Set to false to use the older definitions keyword instead.
      Parameters:
      useDefs - New useDefs value. Default value is true
      Returns:
      JSONSchemaSettings instance, for chaining setter calls
    • getUseDefs

      public Boolean getUseDefs()
      When true (the default), reusable DataSource types are placed in a $defs block and referenced via $ref. Set to false to use the older definitions keyword instead.
      Returns:
      Current useDefs value. Default value is true