Child pages
  • Specification (.spec file)

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
titlespec file definition
{
	"name": "packagename-componentname", // String
	"displayName": "more descriptive name that is shown in the designer", // String
	"version": the component version (integer)
	"icon": "A reference to the icon shown in designer" ,
    "preview": "A reference to the preview gif to be displayed" ,

	"definition": "A reference to the js file that implements this component's in the browser",
    "serverscript": "[optional] A reference to the js file that implements this component's server-side logic, if any.",

    "group": true // default true, so the definition file can be grouped when creating the .war file for deployment
    "deprecated": "This component will be replaced in the next versions.",//some string to mark the component as deprecated
	"replacement": "package-compname", // (optional) some string to mark the component as deprecated - if it is deprecated
	"replacement": "package-compname", // (optional) in case of deprecation, developer will provide a quick fix for such components to be automatically changed to the given replacement component
                                       // (make sure they have compatible .spec defined; in most cases this is useful when moving components from a package to another package or when
                                       // rewriting a component but keeping it's contract unchanged)
	"libraries": /* Array of js/css definitions (which are JSON objects with 
                             'name'-the lib name, 'version'-the lib version, 'url'-the lib url, 
                             'mimetype'-the lib mimetype, one of 'text/javascript' or 'text/css', 
                             'group' - give false here when this lib dependency should not be grouped when exported
                             as .war; default true)
                    that need to be included for this component. */,

    "categoryName": "Advanced", // category for form designer palette; only makes sense for components, not services

	"model": {
	    "property1Name": /* type description (optionally including optional default value and others) */,
	    "property2Name": /* type description (optionally including optional default value and others) */
	},

	"handlers": {
	    "handler1Name": { /* handler function type definition*/ },
	    "handler2Name": { /* handler function type definition*/ }
	},

	"api": {
	    "apiFunction1Name": { */ api function signature description json*/ },
	    "apiFunction2Name": { */ api function signature description json*/ }
	},

    "internalApi" : {
	    "internalApiFunction1Name": { */ internal api function signature description json*/ },
	    "internalApiFunction2Name": { */ internal api function signature description json*/ }
    },

	"types": {
	    "customType1Name": {
            "subProp1Name": /* type description" */,
            "subProp2Name": /* type description" */
        },
	    "customType2Name": {
            "subProp1Name": /* type description" */,
            "subProp2Name": /* type description" */
       }
    }
}

...

You can find an example .spec file below.

...

Grouping of library dependency options

The "group" property on the top level spec or in the libraries section tells Servoy if that the definition or library can be grouped or not; by default this is allowed. This is used when a WAR is generated by the WAR Exporter. 

...

Info
titleThe "deprecated" property

The "deprecated" property can also be used to deprecate service/component api or properties:

e.g. service function

Code Block
languagejs
"removeKL": {
    "returns": "boolean",
    "deprecated": "Please use removeKeyListener(...) instead.",
    "parameters": [ { "name": "callbackKey", "type": "string" } ]
 }


e.g. component property

Code Block
languagejs
"model": {
    "enabled" : {"type": "boolean", "default": true, "deprecated": "true"},
    ...
}

In this case, the deprecated property will not be shown in the properties view.

Model

A ng web component or ng service specifies all its properties and the type of each property in the model section of the .spec file.

...