Description

Description

new Description(definitionopt)

This is one of the properties that are (if provided) processed by all other properties. Any property can have an instance of Description property assigned to it with the key name description and it should be treated as something that "describes" the property within which it belongs. Usually this property is used to generate documentation and other contextual information for a property in a Collection.

Parameters:
Name Type Attributes Description
definition Description~definition | String <optional>

The content of the description can be passed as a string when it is in text/plain format or otherwise be sent as part of an object adhering to the Description~definition structure having content and type.

Source:
Example

Add a description to an instance of Collection

 var SDK = require('postman-collection'),
    Collection = SDK.Collection,
    Description = SDK.Description,
    mycollection;

// create a blank collection
myCollection = new Collection();
myCollection.description = new Description({
    content: '&lt;h1&gt;Hello World&lt;/h1&gt;&lt;p&gt;I am a Collection&lt;/p&gt;',
    type: 'text/html'
});

// alternatively, you could also use the `.describe` method of any property to set or update the description of the
// property.
myCollection.describe('Hey! This is a cool collection.');

Members

(static, readonly) format :function

The default and supported description format handlers.

Type:
  • function
Properties:
Name Type Description
"text/plain" function

Escapes HTML characters in the description content, and returns the result.

"text/markdown" function

Returns HTML string generated after rendering raw markdown.

"text/html" function

Removes blacklisted HTML tags from the Description.

Source:

content :String

The raw content of the description

Type:
  • String
Source:

type :String

The mime-type of the description.

Type:
  • String
Source:

Methods

(static) isDescription(obj) → {Boolean}

Checks whether a property is an instance of Description object.

Parameters:
Name Type Description
obj *
Source:
Returns:
Type
Boolean

toJSON() → {Object}

Creates a JSON representation of the Description (as a plain Javascript object).

Source:
Returns:
Type
Object

toString() → {String}

Processes the Description with the appropriate formatter as defined by Description.type

Source:
Returns:
Type
String

update(content, typeopt)

Updates the content of this description property.

Parameters:
Name Type Attributes Description
content String | Description~definition
type String <optional>
Source:
To Do:
  • parse version of description

Type Definitions

definition

Properties:
Name Type Description
content String
type String
Source: