Class: Postprocessor

Defined in: src/postprocessor.coffee

Overview

TODO: Put references into manipulated object

@class Postprocessor

Variables Summary

supportedRules =
['definition', 'enumeration', 'index', 'attribute', 'relation', 'resolvedRelation', 'link', 'meta']
directMetadata =
['title', 'description']

Class Method Summary

Instance Method Summary

Class Method Details

. (String) absoluteReferencePathForClass(className, ctx)

Returns absolute reference path for class

Parameters:

  • className ( String ) name of the class
  • ctx ( Object ) context for class

Returns:

  • ( String ) — context path for class

Instance Method Details

# (void) cleanRefs()

Cleans up references

# (Object) postprocess(data)

Processes whole raw output from jison parser to JSON Schema

Parameters:

  • data ( * ) raw output from jison parser

Returns:

  • ( Object ) — JSON Schema

# (Object) cleanUpSchema(schema)

Removes technical information from schema

Parameters:

  • schema ( Object )

Returns:

  • ( Object ) — schema

# (Object) processMeta(meta, ctx = {})

Converts meta statement into JSON Schema object definition.

Parameters:

  • meta ( Object ) raw definition of enumeration
  • ctx ( Object ) context for meta

Returns:

  • ( Object ) — JSON Schema definition

# (Object) processEnumeration(enumeration, ctx = {}) Bound

Converts enumeration into JSON Schema object definition.

Parameters:

  • enumeration ( Object ) raw definition of enumeration
  • ctx ( Object ) context for enumeration

Returns:

  • ( Object ) — JSON Schema definition

# (Object) processDefinition(klass, ctx = {}) Bound

Converts class rule into JSON Schema object definition.

Parameters:

  • klass ( Object ) raw definition of class
  • ctx ( Object ) context for class

Returns:

  • ( Object ) — context with class JSON Schema definition

# (Object) processRule(rule, ctx)

Processes passed rule with related method

Parameters:

  • rule ( Object ) raw definition of rule
  • ctx ( Object ) context for rule

Returns:

  • ( Object ) — JSON Schema definition of rule

# (Object) processRules(rules, ctx = {}) Bound

Converts rules for context into JSON Schema object definition.

Parameters:

  • rules ( Array<Object> ) raw definition of rules owner
  • ctx ( Object ) context for rules

Returns:

  • ( Object ) — JSON Schema definition

# (Object) processIndex(index, ctx = {})

Converts index definition to JSON Schema entry.

Parameters:

  • index ( Object ) raw definition of index
  • ctx ( Object ) context for index

Returns:

  • ( Object ) — context with index JSON Schema definition

# (Object) processAttribute(property, ctx = {})

Converts property definition to JSON Schema entry.

Parameters:

  • property ( Object ) raw definition of property
  • ctx ( Object ) context for property

Returns:

  • ( Object ) — property context JSON Schema definition

# (Object) addPropertyToContext(name, property, ctx)

Adds property to specified context

Parameters:

  • name ( String ) property name
  • property ( Object ) definition of property
  • ctx ( Object ) context for property

Returns:

  • ( Object ) — property context JSON Schema definition

# (Object) expandPropertyPath(name, property)

Expands properties specified with paths to JSON Schema embedded objects

Parameters:

  • name ( String ) property name
  • property ( Object ) definition of property

Returns:

  • ( Object ) — property context JSON Schema definition

# (void) registerTypeReference(property, ctx)

Registers type reference

Parameters:

  • property ( Object ) property that has a reference of type
  • ctx ( Object ) referencing context

# (void) registerDefinition(definition)

Registers definition reference

Parameters:

  • definition ( Object ) type definition schema

# (String|Boolean) findTypeReference(name, ctx)

Finds JSON schema reference to specified type in the context

Parameters:

  • name ( String ) type name
  • ctx ( Object ) type context

Returns:

  • ( String|Boolean ) — JSON Schema reference or false

# (void) resolveTypeReference(property, unresolved)

Resolves type reference

Parameters:

  • property ( Object ) property that has a type reference
  • unresolved ( Object ) container for unresolved types

# (Object) resolveTypeReferences(schema)

Processes type references for schema

Parameters:

  • schema ( Object ) JSON schema

Returns:

  • ( Object ) — JSON schema

# (Object) processPropertyType(property, ctx = {})

Processes property type.

Parameters:

  • property ( Object ) definition
  • ctx ( Object ) context for property

Returns:

  • ( Object ) — property context JSON Schema definition

# (Object) processArrayType(property, ctx)

Converts array types to proper JSON schema.

Parameters:

  • property ( Object ) type definition
  • ctx ( Object ) context for property

Returns:

  • ( Object ) — property context JSON Schema definition

# (Object) processRelation(relation, ctx = {}, addAttribute = true)

Converts relation definition to JSON Schema entry.

Parameters:

  • relation ( Object ) raw definition of relation
  • ctx ( Object ) context for relation
  • addAttribute ( Boolean ) whether corresponding attribute should be added

Returns:

  • ( Object ) — relation context JSON Schema definition

# (Object) processResolvedRelation(relation, ctx = {})

Converts resolved relation definition to JSON Schema entry.

Parameters:

  • relation ( Object ) raw definition of resolved relation
  • ctx ( Object ) context for relation

Returns:

  • ( Object ) — relation context JSON Schema definition

Converts link definition to JSON Schema entry.

Parameters:

  • link ( Object ) raw definition of link
  • ctx ( Object ) context for link

Returns:

  • ( Object ) — link context JSON Schema definition

    Quickly fuzzy find classes, mixins, methods, file:

    Control the navigation frame:

    You can focus and blur the search input: