lib/schema/moboModelAdditions.schema.yaml

Summary

Maintainability
Test Coverage
---
description: mobo model JSON Schema

properties:

####################################################
# JSON Schema annotations                          #
####################################################

  type:
    important: false

  items:
    description: |
      The items property contains an array of all fields that are used by the model.
      Fields usually should be implemented using $extend, so every field can have its own file and inheritance.
      It is possible to overwrite properties from the field directly in the mode.
    example:
      - |
        items:
        - $extend: /field/brand
          title: Overwritten brand title
        - $extend: /field/modelName


####################################################
# Model Specific Properties                        #
####################################################

  recommended:
    type: array
    items:
      type: string
    specific: domain
    appliesNot:
      - form
    description: |
      Array of fields that should be marked as recommended (complementary to mandatory).<br>
      Please note that the template and the MediaWiki skin have to support this, since it is not an official feature.
    example:
      - |
        recommended:
          - fieldA
          - fieldB

  smw_set:
    type: object
    specific: platform
    appliesNot:
      - form
    description: |
      Contains a set (object) of additional #set properties.
    example:
      - |
        smw_set:
          additionalProp2: 'Some fixed text'
          additionalProp3: '{{FULLPAGENAME}}/subpath/&#123;&#123;&#123;fieldId|}}}'

  smw_subobject:
    todo: |
      This should replace subobjectExtend!
      Add smw_store enum instead: annotation|set|subobject|none

    type: boolean
    default: false
    specific: platform
    appliesNot:
      - form
    description: |
      If true, this models attributes will be created as subobjects.<br>
      This may be appropiate when model is used through multiple instances.<br><br>
      Mobo will automantically introduce two additional helper attributes `subobjectType` and `subobjectParent` that help with querying subobjects.
    example:
      - |
        smw_subobject: true

  smw_subobjectExtend:
    type: object
    specific: platform
    appliesNot:
      - form
    description: |
      Contains a set (object) of additional #subobject properties.
    example:
      - |
        smw_subobjectExtend:
          additionalSubObjProp2: 'Some fixed text'
          additionalSubObjProp3: '{{FULLPAGENAME}}/subpath/&#123;&#123;&#123;fieldId|}}}'

  smw_display:
    type: string
    default: table
    specific: platform
    appliesNot:
      - form
    description: |
      Defines the template output rendering mode, whether the template should use tables, ul, etc.<br>
      The rendering mode must be available in  /mobo_template/template.wikitext!
    example:
      - |
        smw_display: ul

  smw_prepend:
    type:
      - object
      - string
    properties:
      wikitext:
        type: string
        description: wikitext to prepend
      header:
        type: number
        description: Inserts auto generated header of given hierachy (1-6)
        minimum: 1
        maximum: 6
      template:
        type: string
        description: name of a template to inject. Must exist
    additionalProperties: false
    specific: implementation
    appliesNot:
      - form
    description: |
      Prepends wikitext to both forms and templates.
      Can either be a string or an object for more advanced features (auto-generate headers, inject templates
      or add arbitrary wikitext).
    example:
      - |
        smw_prepend:
          header: 1
          wikitext: |
            Some prepended wikitext
            Will be inserted after the H1 header
      - |
        smw_prepend: 'Some prepended wikitext'

  smw_prependForm:
    type:
      - object
      - string
    properties:
      wikitext:
        type: string
        description: wikitext to prepend
      header:
        type: number
        description: Inserts auto generated header of given hierachy (1-6)
        minimum: 1
        maximum: 6
      template:
        type:
        - string
        - array
        description: name of a template to inject. Must exist
    additionalProperties: false
    specific: implementation
    appliesNot:
      - form
    description: |
      Prepends wikitext only to forms (edit-view). Can either be a string
      or an object for more advanced features (auto-generate headers, inject templates
      or add arbitrary wikitext)

  smw_prependPage:
    type:
      - object
      - string
    properties:
      wikitext:
        type: string
        description: wikitext to prepend
      header:
        type: number
        description: Inserts auto generated header of given hierachy (1-6)
        minimum: 1
        maximum: 6
      template:
        type:
        - string
        - array
        description: name of a template to inject. Must exist
    additionalProperties: false
    specific: implementation
    appliesNot:
      - form
    description: |
      Prepends wikitext only to templates (page-view). Can either be a
      string or an object for more advanced features (auto-generate headers, inject
      templates or add arbitrary wikitext)

  smw_prependCategory:
    type: string
    specific: implementation
    appliesNot:
      - form
    description: |
      Wikitext to prepend on the category page
    example:
      - |
        smw_prependCategory: |
          Some wikitext to prepend on the category page

  smw_append:
    type:
      - object
      - string
    properties:
      wikitext:
        type: string
        description: Wikitext to append.
      template:
        type: string
        description: Name of the template to inject.
    additionalProperties: false
    specific: implementation
    appliesNot:
      - form
    description: |
      Adds a append wikitext to forms and models.
    example:
      - |
        smw_append: |
          Some appended wikitext
          Will be inserted after the H1 header

  smw_appendForm:
    type:
    - object
    - string
    properties:
      wikitext:
        type: string
        description: wikitext to prepend
      template:
        type:
        - string
        - array
        description: name of a template to inject. Must exist
    additionalProperties: false
    specific: implementation
    appliesNot:
      - form
    description: |
      Appends wikitext only to forms (edit-view).
      Can either be a string or an object for more advanced features.
      (auto-generate headers, inject templates or add arbitrary wikitext)

  smw_appendPage:
    type:
    - object
    - string
    properties:
      wikitext:
        type: string
        description: wikitext to prepend
      template:
        type:
        - string
        - array
        description: name of a template to inject. Must exist
    additionalProperties: false
    specific: implementation
    appliesNot:
      - form
    description: |
      Appends wikitext only to templates (page-view). Can either be a
      string or an object for more advanced features (auto-generate headers, inject
      templates or add arbitrary wikitext)

  smw_appendCategory:
    type: string
    specific: implementation
    appliesNot:
      - form
    description: |
      Wikitext to append on the category page
    example:
      - |
        smw_appendCategory: |
          Some wikitext to append on the category page

  smw_category:
    type: boolean
    default: true
    specific: platform
    appliesNot:
      - form
    description: |
      If true, the models template will assign a category.
      The name of the category is the model ID.
    example:
      - |
        smw_category: false

  smw_categories:
    type: array
    items:
      type: string
    specific: platform
    appliesNot:
      - form
    description: |
      Array of additional categories the template should set.
    example:
      - |
        smw_categories:
          - additionalCategoryA
          - additionalCategoryB

  showForm:
    type: boolean
    default: true
    specific: domain
    appliesNot:
      - form
    description: |
      If true the template/model will be hidden in the form view.
      This will usually be declared in the forms by adding this after the model $extend.
    example:
      - |
        showForm: false


  showPage:
    type: boolean
    default: true
    specific: domain
    appliesNot:
      - form
    description: |
      If true the template/model will be hidden in the page view.
      This will usually be declared in the forms by adding this after the model $extend.
    example:
      - |
        showPage: false