Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Latest commit

 

History

History
118 lines (97 loc) · 3.73 KB

api.md

File metadata and controls

118 lines (97 loc) · 3.73 KB

Functions

markdown2html()string

Turns Markdown into HTML

log()

Logs input to server logs to stdout

logError()

Logs input to server as error to stderr

getPayloadExamples()object

Extracts example from the message payload

getHeadersExamples()object

Extracts example from the message header

generateExample()string

Generate string with example from provided schema

oneLine()string

Turns multiline string into one liner

docline()string

Generate JSDoc from message properties of the header and the payload

replaceServerVariablesWithValues()string

Helper function to replace server variables in the url with actual values

markdown2html() ⇒ string

Turns Markdown into HTML

Kind: global function
Returns: string - HTML string
Md: string - String with valid Markdown syntax

log()

Logs input to server logs to stdout

Kind: global function
Str: string Info that is logged

logError()

Logs input to server as error to stderr

Kind: global function
Str: string Info that is logged

getPayloadExamples() ⇒ object

Extracts example from the message payload

Kind: global function
Msg: object - Parser Message function

getHeadersExamples() ⇒ object

Extracts example from the message header

Kind: global function
Msg: object - Parser Message function

generateExample() ⇒ string

Generate string with example from provided schema

Kind: global function
Schema: object - Schema object as JSON and not Schema model map
Options: object - Options object. Supported options are listed here https://github.com/Redocly/openapi-sampler#usage

oneLine() ⇒ string

Turns multiline string into one liner

Kind: global function
Str: string - Any multiline string

docline() ⇒ string

Generate JSDoc from message properties of the header and the payload

Kind: global function
Returns: string - JSDoc compatible entry
Field: object - Property object
Fieldname: string - Name of documented property
Scopepropname: string - Name of param for JSDocs
Example

docline(
 Schema {
    _json: {
      type: 'integer',
      minimum: 0,
      maximum: 100,
      'x-parser-schema-id': '<anonymous-schema-3>'
    }
  },
  my-app-header,
  options.message.headers
)

Returned value will be ->  * @param {integer} options.message.headers.my-app-header

replaceServerVariablesWithValues() ⇒ string

Helper function to replace server variables in the url with actual values

Kind: global function
Url: string - url string
Serverservervariables: Object - Variables model map