Skip to content

Latest commit

 

History

History
1538 lines (1109 loc) · 49 KB

API.md

File metadata and controls

1538 lines (1109 loc) · 49 KB

Classes

AbstractGenerator

Abstract generator which must be implemented by each language

AbstractRenderer

Abstract renderer with common helper methods

AsyncapiV2Schema

AsyncAPI schema model

Based on Draft 7 with additions

https://www.asyncapi.com/docs/specifications/v2.0.0#schemaObject https://www.asyncapi.com/docs/specifications/v2.1.0#schemaObject https://www.asyncapi.com/docs/specifications/v2.2.0#schemaObject https://www.asyncapi.com/docs/specifications/v2.3.0#schemaObject

CommonModel

Common internal representation for a model.

Draft4Schema

JSON Draft 4 schema model

Draft6Schema

JSON Draft 6 schema model

Draft7Schema

JSON Draft7Schema Draft 7 model

InputMetaModel

Since each input processor can create multiple meta models this is a wrapper to a MetaModel to make that possible.

OpenapiV3Schema

OpenAPI 3.0 -> 3.0.4 schema model

Based on Draft 6, but with restricted keywords and definitions Modifications

  • type, cannot be an array nor contain 'null'

Restrictions (keywords not allowed)

  • patternProperties
  • not

https://swagger.io/specification/#schema-object

OutputModel

Common representation for the output model.

RenderOutput

Common representation for the rendered output.

SwaggerV2Schema

OpenAPI 2.0 (Swagger 2.0) schema model

Based on Draft 4, but with restricted keywords and definitions

Restrictions (keywords not allowed)

  • oneOf
  • anyOf
  • patternProperties
  • not

https://swagger.io/specification/v2/#schemaObject

AsyncAPIInputProcessor

Class for processing AsyncAPI inputs

InputProcessor

Main input processor which figures out the type of input it receives and delegates the processing into separate individual processors.

JsonSchemaInputProcessor

Class for processing JSON Schema

OpenAPIInputProcessor

Class for processing OpenAPI V3.0 inputs

SwaggerInputProcessor

Class for processing Swagger inputs

TemplateInputProcessor

Class for processing X input

LoggerClass

Logger class for the model generation library

This class acts as a forefront for any external loggers which is why it also implements the interface itself.

Functions

convertToUnionModel()

Converts a CommonModel into multiple models wrapped in a union model.

Because a CommonModel might contain multiple models, it's name for each of those models would be the same, instead we slightly change the model name. Each model has it's type as a name prepended to the union name.

If the CommonModel has multiple types

isDictionary()

Determine whether we have a dictionary or an object. because in some cases inputs might be: { "type": "object", "additionalProperties": { "$ref": "#" } } which is to be interpreted as a dictionary not an object model.

getOriginalInputFromAdditionalAndPatterns()

Return the original input based on additionalProperties and patternProperties.

convertAdditionalAndPatterns()

Function creating the right meta model based on additionalProperties and patternProperties.

NO_DUPLICATE_PROPERTIES(constrainedObjectModel, objectModel, propertyName, namingFormatter)

Because a lot of the other constrain functions (such as NO_NUMBER_START_CHAR, NO_EMPTY_VALUE, etc) they might manipulate the property names by append, prepend, or manipulate it any other way. We then need to make sure that they don't clash with any existing properties, this is what this function handles. If so, prepend reserved_ to the property name and recheck.

NO_DUPLICATE_ENUM_KEYS(constrainedEnumModel, enumModel, enumKey, namingFormatter, enumKeyToCheck, onNameChange, onNameChangeToCheck)string

Because a lot of the other constrain functions (such as NO_NUMBER_START_CHAR, NO_EMPTY_VALUE, etc) they might manipulate the enum keys by append, prepend, or manipulate it any other way. We then need to make sure that they don't clash with any existing enum keys, this is what this function handles. If so, prepend reserved_ to the enum key and recheck.

renderJavaScriptDependency(toImport, fromModule, moduleSystem)

Function to make it easier to render JS/TS dependencies based on module system

makeUnique(array)

Function to make an array of ConstrainedMetaModels only contain unique values (ignores different in memory instances)

lengthInUtf8Bytes()

Convert a string into utf-8 encoding and return the byte size.

hasPreset(presets, preset)

Returns true if and only if a given preset is already included in a list of presets Check is done using referential equality

trySplitModel(model, options, models)

Try split the model

split(model, options, models)

Overwrite the nested models with references where required.

interpretAdditionalItems(schema, model, interpreter, interpreterOptions)

Interpreter function for additionalItems keyword.

interpretAdditionalProperties(schema, model, interpreter, interpreterOptions)

Interpreter function for additionalProperties keyword.

interpretAllOf(schema, model, interpreter, interpreterOptions)

Interpreter function for allOf keyword.

It either merges allOf schemas into existing model or if allowed, create inheritance.

interpretAnyOf(schema, model, interpreter, interpreterOptions)

Interpreter function for anyOf keyword.

It puts the schema reference into the items field.

interpretConst(schema, model)

Interpreter function for const keyword for draft version > 4

interpretDependencies(schema, model)

Interpreter function for dependencies keyword.

interpretEnum(schema, model)

Interpreter function for enum keyword

interpretItems(schema, model, interpreter, interpreterOptions)

Interpreter function for items keyword.

interpretArrayItems(rootSchema, itemSchemas, model, interpreter, interpreterOptions)

Internal function to process all item schemas

interpretNot(schema, model, interpreter, interpreterOptions)

Interpreter function for not keyword.

interpretOneOf(schema, model, interpreter, interpreterOptions)

Interpreter function for oneOf keyword.

It puts the schema reference into the items field.

interpretOneOfWithAllOf(schema, model, interpreter, interpreterOptions)

Interpreter function for oneOf keyword combined with the allOf keyword.

It merges the allOf schemas into all of the oneOf schemas. Shared properties are merged. The oneOf schemas are then added as union to the model.

interpretOneOfWithProperties(schema, model, interpreter, interpreterOptions)

Interpreter function for oneOf keyword combined with properties.

It merges the properties of the schema into the oneOf schemas. Shared properties are merged. The oneOf schemas are then added as union to the model.

interpretPatternProperties(schema, model, interpreter, interpreterOptions)

Interpreter function for patternProperties keyword.

interpretProperties(schema, model, interpreter, interpreterOptions)

Interpreter function for interpreting properties keyword.

isEnum(model)

Check if CommonModel is an enum

isModelObject(model)

Check if CommonModel is a separate model or a simple model.

inferTypeFromValue(value)

Infers the JSON Schema type from value

interpretName(schema)

Find the name for simplified version of schema

isClass(obj)

Return true or false based on whether the input object is a regular object or a class

Taken from: https://stackoverflow.com/a/43197340/6803886

mergePartialAndDefault()

Merge a non optional value with custom optional values to form a full value that has all properties sat.

AbstractGenerator

Abstract generator which must be implemented by each language

Kind: global class

abstractGenerator.getDependencyManagerInstance()

This function returns an instance of the dependency manager which is either a factory or an instance.

Kind: instance method of AbstractGenerator

abstractGenerator.generateCompleteModels()

Generates the full output of a model, instead of a scattered model.

OutputModels result is no longer the model itself, but including package, package dependencies and model dependencies.

Kind: instance method of AbstractGenerator

abstractGenerator.generate()

Generates a scattered model where dependencies and rendered results are separated.

Kind: instance method of AbstractGenerator

abstractGenerator.processInput(input)

Process any of the input formats to the appropriate InputMetaModel type and split out the meta models based on the requirements of the generators

Kind: instance method of AbstractGenerator

Param
input

abstractGenerator.getPresets()

Get all presets (default and custom ones from options) for a given preset type (class, enum, etc).

Kind: instance method of AbstractGenerator

AbstractRenderer

Abstract renderer with common helper methods

Kind: global class

AsyncapiV2Schema

AsyncAPI schema model

Based on Draft 7 with additions

https://www.asyncapi.com/docs/specifications/v2.0.0#schemaObject https://www.asyncapi.com/docs/specifications/v2.1.0#schemaObject https://www.asyncapi.com/docs/specifications/v2.2.0#schemaObject https://www.asyncapi.com/docs/specifications/v2.3.0#schemaObject

Kind: global class

AsyncapiV2Schema.toSchema(object)

Takes a deep copy of the input object and converts it to an instance of AsyncapiV2Schema.

Kind: static method of AsyncapiV2Schema

Param
object

CommonModel

Common internal representation for a model.

Kind: global class

commonModel.getFromOriginalInput(key) ⇒ any

Retrieves data from originalInput by given key

Kind: instance method of CommonModel

Param Description
key given key

commonModel.setType(type)

Set the types of the model

Kind: instance method of CommonModel

Param
type

commonModel.removeType(types)

Removes type(s) from model type

Kind: instance method of CommonModel

Param
types

commonModel.addTypes(types)

Adds types to the existing model types.

Makes sure to only keep a single type incase of duplicates.

Kind: instance method of CommonModel

Param Description
types which types we should try and add to the existing output

commonModel.isRequired(propertyName) ⇒ boolean

Checks if given property name is required in object

Kind: instance method of CommonModel

Param Description
propertyName given property name

commonModel.addItem(itemModel, originalInput)

Adds an item to the model.

If items already exist the two are merged.

Kind: instance method of CommonModel

Param Description
itemModel
originalInput corresponding input that got interpreted to this model

commonModel.addItemTuple(tupleModel, originalInput, index)

Adds a tuple to the model.

If a item already exist it will be merged.

Kind: instance method of CommonModel

Param Description
tupleModel
originalInput corresponding input that got interpreted to this model
index

commonModel.addItemUnion(unionModel)

Adds a union model to the model.

Kind: instance method of CommonModel

Param
unionModel

commonModel.addEnum(enumValue)

Add enum value to the model.

Ensures no duplicates are added.

Kind: instance method of CommonModel

Param
enumValue

commonModel.removeEnum(enumValue)

Remove enum from model.

Kind: instance method of CommonModel

Param
enumValue

commonModel.addProperty(propertyName, propertyModel, originalInput)

Adds a property to the model. If the property already exist the two are merged.

Kind: instance method of CommonModel

Param Description
propertyName
propertyModel
originalInput corresponding input that got interpreted to this model

commonModel.addAdditionalProperty(additionalPropertiesModel, originalInput)

Adds additionalProperty to the model. If another model already exist the two are merged.

Kind: instance method of CommonModel

Param Description
additionalPropertiesModel
originalInput corresponding input that got interpreted to this model corresponding input that got interpreted to this model

commonModel.addPatternProperty(pattern, patternModel, originalInput)

Adds a patternProperty to the model. If the pattern already exist the two models are merged.

Kind: instance method of CommonModel

Param Description
pattern
patternModel
originalInput corresponding input that got interpreted to this model

commonModel.addAdditionalItems(additionalItemsModel, originalInput)

Adds additionalItems to the model. If another model already exist the two are merged.

Kind: instance method of CommonModel

Param Description
additionalItemsModel
originalInput corresponding input that got interpreted to this model

commonModel.addExtendedModel(extendedModel)

Adds another model this model should extend.

It is only allowed to extend if the other model have $id and is not already being extended.

Kind: instance method of CommonModel

Param
extendedModel

CommonModel.toCommonModel(object) ⇒

Takes a deep copy of the input object and converts it to an instance of CommonModel.

Kind: static method of CommonModel
Returns: CommonModel instance of the object

Param Description
object to transform

CommonModel.mergeProperties(mergeTo, mergeFrom, originalInput, alreadyIteratedModels)

Merge two common model properties together

Kind: static method of CommonModel

Param Description
mergeTo
mergeFrom
originalInput corresponding input that got interpreted to this model
alreadyIteratedModels

CommonModel.mergeAdditionalProperties(mergeTo, mergeFrom, originalInput, alreadyIteratedModels)

Merge two common model additionalProperties together

Kind: static method of CommonModel

Param Description
mergeTo
mergeFrom
originalInput corresponding input that got interpreted to this model
alreadyIteratedModels

CommonModel.mergeAdditionalItems(mergeTo, mergeFrom, originalInput, alreadyIteratedModels)

Merge two common model additionalItems together

Kind: static method of CommonModel

Param Description
mergeTo
mergeFrom
originalInput corresponding input that got interpreted to this model
alreadyIteratedModels

CommonModel.mergeItems(mergeTo, mergeFrom, originalInput, alreadyIteratedModels)

Merge items together, prefer tuples over simple array since it is more strict.

Kind: static method of CommonModel

Param Description
mergeTo
mergeFrom
originalInput corresponding input that got interpreted to this model
alreadyIteratedModels

CommonModel.mergePatternProperties(mergeTo, mergeFrom, originalInput, alreadyIteratedModels)

Merge two common model pattern properties together

Kind: static method of CommonModel

Param Description
mergeTo
mergeFrom
originalInput corresponding input that got interpreted to this model
alreadyIteratedModels

CommonModel.mergeTypes(mergeTo, mergeFrom)

Merge types together

Kind: static method of CommonModel

Param
mergeTo
mergeFrom

CommonModel.mergeCommonModels(mergeTo, mergeFrom, originalInput, alreadyIteratedModels)

Only merge if left side is undefined and right side is sat OR both sides are defined

Kind: static method of CommonModel

Param Description
mergeTo
mergeFrom
originalInput corresponding input that got interpreted to this model
alreadyIteratedModels

Draft4Schema

JSON Draft 4 schema model

Kind: global class

Draft4Schema.toSchema(object)

Takes a deep copy of the input object and converts it to an instance of Draft4Schema.

Kind: static method of Draft4Schema

Param
object

Draft6Schema

JSON Draft 6 schema model

Kind: global class

Draft6Schema.toSchema(object)

Takes a deep copy of the input object and converts it to an instance of Draft6Schema.

Kind: static method of Draft6Schema

Param
object

Draft7Schema

JSON Draft7Schema Draft 7 model

Kind: global class

Draft7Schema.toSchema(object)

Takes a deep copy of the input object and converts it to an instance of Draft7Schema.

Kind: static method of Draft7Schema

Param
object

InputMetaModel

Since each input processor can create multiple meta models this is a wrapper to a MetaModel to make that possible.

Kind: global class

OpenapiV3Schema

OpenAPI 3.0 -> 3.0.4 schema model

Based on Draft 6, but with restricted keywords and definitions Modifications

  • type, cannot be an array nor contain 'null'

Restrictions (keywords not allowed)

  • patternProperties
  • not

https://swagger.io/specification/#schema-object

Kind: global class

OpenapiV3Schema.toSchema(object)

Takes a deep copy of the input object and converts it to an instance of OpenapiV3Schema.

Kind: static method of OpenapiV3Schema

Param
object

OutputModel

Common representation for the output model.

Kind: global class

RenderOutput

Common representation for the rendered output.

Kind: global class

SwaggerV2Schema

OpenAPI 2.0 (Swagger 2.0) schema model

Based on Draft 4, but with restricted keywords and definitions

Restrictions (keywords not allowed)

  • oneOf
  • anyOf
  • patternProperties
  • not

https://swagger.io/specification/v2/#schemaObject

Kind: global class

SwaggerV2Schema.toSchema(object)

Takes a deep copy of the input object and converts it to an instance of SwaggerV2Schema.

Kind: static method of SwaggerV2Schema

Param
object

AsyncAPIInputProcessor

Class for processing AsyncAPI inputs

Kind: global class

asyncAPIInputProcessor.process(input)

Process the input as an AsyncAPI document

Kind: instance method of AsyncAPIInputProcessor

Param
input

asyncAPIInputProcessor.shouldProcess(input)

Figures out if an object is of type AsyncAPI document

Kind: instance method of AsyncAPIInputProcessor

Param
input

asyncAPIInputProcessor.tryGetVersionOfDocument(input)

Try to find the AsyncAPI version from the input. If it cannot undefined are returned, if it can, the version is returned.

Kind: instance method of AsyncAPIInputProcessor

Param
input

AsyncAPIInputProcessor.isFromParser(input)

Figure out if input is from the AsyncAPI parser.

Kind: static method of AsyncAPIInputProcessor

Param
input

AsyncAPIInputProcessor.isFromNewParser(input)

Figure out if input is from the new AsyncAPI parser.

Kind: static method of AsyncAPIInputProcessor

Param
input

InputProcessor

Main input processor which figures out the type of input it receives and delegates the processing into separate individual processors.

Kind: global class

inputProcessor.setProcessor(type, processor)

Set a processor.

Kind: instance method of InputProcessor

Param Description
type of processor
processor

inputProcessor.getProcessors() ⇒

Kind: instance method of InputProcessor
Returns: all processors

inputProcessor.process(input, options)

The processor code which delegates the processing to the correct implementation.

Kind: instance method of InputProcessor

Param Description
input to process
options passed to the processors

JsonSchemaInputProcessor

Class for processing JSON Schema

Kind: global class

jsonSchemaInputProcessor.process(input)

Function for processing a JSON Schema input.

Kind: instance method of JsonSchemaInputProcessor

Param
input

jsonSchemaInputProcessor.shouldProcess(input)

Unless the schema states one that is not supported we assume its of type JSON Schema

Kind: instance method of JsonSchemaInputProcessor

Param
input

jsonSchemaInputProcessor.processDraft7(input)

Process a draft-7 schema

Kind: instance method of JsonSchemaInputProcessor

Param Description
input to process as draft 7

jsonSchemaInputProcessor.processDraft4(input)

Process a draft-4 schema

Kind: instance method of JsonSchemaInputProcessor

Param Description
input to process as draft 4

jsonSchemaInputProcessor.processDraft6(input)

Process a draft-6 schema

Kind: instance method of JsonSchemaInputProcessor

Param Description
input to process as draft-6

jsonSchemaInputProcessor.handleRootReference()

This is a hotfix and really only a partial solution as it does not cover all cases.

But it's the best we can do until we find or build a better library to handle references.

Kind: instance method of JsonSchemaInputProcessor

JsonSchemaInputProcessor.reflectSchemaNames(schema, namesStack, name, isRoot)

Each schema must have a name, so when later interpreted, the model have the most accurate model name.

Reflect name from given schema and save it to x-modelgen-inferred-name extension.

This reflects all the common keywords that are shared between draft-4, draft-7 and Swagger 2.0 Schema

Kind: static method of JsonSchemaInputProcessor

Param Description
schema to process
namesStack is a aggegator of previous used names
name to infer
isRoot indicates if performed schema is a root schema

JsonSchemaInputProcessor.ensureNamePattern(previousName, ...newParts)

Ensure schema name using previous name and new part

Kind: static method of JsonSchemaInputProcessor

Param Description
previousName to concatenate with
...newParts

JsonSchemaInputProcessor.convertSchemaToCommonModel(schema)

Simplifies a JSON Schema into a common models

Kind: static method of JsonSchemaInputProcessor

Param Description
schema to simplify to common model

OpenAPIInputProcessor

Class for processing OpenAPI V3.0 inputs

Kind: global class

openAPIInputProcessor.process(input)

Process the input as a OpenAPI V3.0 document

Kind: instance method of OpenAPIInputProcessor

Param
input

openAPIInputProcessor.shouldProcess(input)

Figures out if an object is of type OpenAPI V3.0.x document and supported

Kind: instance method of OpenAPIInputProcessor

Param
input

openAPIInputProcessor.tryGetVersionOfDocument(input)

Try to find the AsyncAPI version from the input. If it cannot undefined are returned, if it can, the version is returned.

Kind: instance method of OpenAPIInputProcessor

Param
input

OpenAPIInputProcessor.convertToInternalSchema(schema, name)

Converts a schema to the internal schema format.

Kind: static method of OpenAPIInputProcessor

Param Description
schema to convert
name of the schema

SwaggerInputProcessor

Class for processing Swagger inputs

Kind: global class

swaggerInputProcessor.process(input)

Process the input as a Swagger document

Kind: instance method of SwaggerInputProcessor

Param
input

swaggerInputProcessor.shouldProcess(input)

Figures out if an object is of type Swagger document and supported

Kind: instance method of SwaggerInputProcessor

Param
input

swaggerInputProcessor.tryGetVersionOfDocument(input)

Try to find the swagger version from the input. If it cannot, undefined are returned, if it can, the version is returned.

Kind: instance method of SwaggerInputProcessor

Param
input

SwaggerInputProcessor.convertToInternalSchema(schema, name)

Converts a Swagger 2.0 Schema to the internal schema format.

Kind: static method of SwaggerInputProcessor

Param Description
schema to convert
name of the schema

TemplateInputProcessor

Class for processing X input

Kind: global class

LoggerClass

Logger class for the model generation library

This class acts as a forefront for any external loggers which is why it also implements the interface itself.

Kind: global class

loggerClass.setLogger(logger)

Sets the logger to use for the model generation library

Kind: instance method of LoggerClass

Param Description
logger to add

convertToUnionModel()

Converts a CommonModel into multiple models wrapped in a union model.

Because a CommonModel might contain multiple models, it's name for each of those models would be the same, instead we slightly change the model name. Each model has it's type as a name prepended to the union name.

If the CommonModel has multiple types

Kind: global function

isDictionary()

Determine whether we have a dictionary or an object. because in some cases inputs might be: { "type": "object", "additionalProperties": { "$ref": "#" } } which is to be interpreted as a dictionary not an object model.

Kind: global function

getOriginalInputFromAdditionalAndPatterns()

Return the original input based on additionalProperties and patternProperties.

Kind: global function

convertAdditionalAndPatterns()

Function creating the right meta model based on additionalProperties and patternProperties.

Kind: global function

NO_DUPLICATE_PROPERTIES(constrainedObjectModel, objectModel, propertyName, namingFormatter)

Because a lot of the other constrain functions (such as NO_NUMBER_START_CHAR, NO_EMPTY_VALUE, etc) they might manipulate the property names by append, prepend, or manipulate it any other way. We then need to make sure that they don't clash with any existing properties, this is what this function handles. If so, prepend reserved_ to the property name and recheck.

Kind: global function

Param Description
constrainedObjectModel the current constrained object model, which contains already existing constrained properties
objectModel the raw object model which is non-constrained to the output language.
propertyName one of the properties in objectModel which might have been manipulated
namingFormatter the name formatter which are used to format the property key

NO_DUPLICATE_ENUM_KEYS(constrainedEnumModel, enumModel, enumKey, namingFormatter, enumKeyToCheck, onNameChange, onNameChangeToCheck) ⇒ string

Because a lot of the other constrain functions (such as NO_NUMBER_START_CHAR, NO_EMPTY_VALUE, etc) they might manipulate the enum keys by append, prepend, or manipulate it any other way. We then need to make sure that they don't clash with any existing enum keys, this is what this function handles. If so, prepend reserved_ to the enum key and recheck.

Kind: global function
Returns: string - the potential new enum key that does not clash with existing enum keys.

Param Description
constrainedEnumModel the current constrained enum model, which contains already existing constrained enum keys
enumModel the raw enum model which is non-constrained to the output language.
enumKey one of the enum keys in enumModel which might have been manipulated.
namingFormatter the name formatter which are used to format the enum key.
enumKeyToCheck the enum key to use for checking if it already exist, defaults to enumKey.
onNameChange callback to change the name of the enum key that needs to be returned.
onNameChangeToCheck callback to change the enum key which is being checked as part of the existing models.

renderJavaScriptDependency(toImport, fromModule, moduleSystem)

Function to make it easier to render JS/TS dependencies based on module system

Kind: global function

Param
toImport
fromModule
moduleSystem

makeUnique(array)

Function to make an array of ConstrainedMetaModels only contain unique values (ignores different in memory instances)

Kind: global function

Param Description
array to make unique

lengthInUtf8Bytes()

Convert a string into utf-8 encoding and return the byte size.

Kind: global function

hasPreset(presets, preset)

Returns true if and only if a given preset is already included in a list of presets Check is done using referential equality

Kind: global function

Param Description
presets the list to check
preset the preset to check for

trySplitModel(model, options, models) ⇒

Try split the model

Kind: global function
Returns: whether the new or old MetaModel to use.

Param
model
options
models

split(model, options, models) ⇒

Overwrite the nested models with references where required.

Kind: global function
Returns: an array of all the split models

Param
model
options
models

interpretAdditionalItems(schema, model, interpreter, interpreterOptions)

Interpreter function for additionalItems keyword.

Kind: global function

Param Description
schema
model
interpreter
interpreterOptions to control the interpret process

interpretAdditionalProperties(schema, model, interpreter, interpreterOptions)

Interpreter function for additionalProperties keyword.

Kind: global function

Param Description
schema
model
interpreter
interpreterOptions to control the interpret process

interpretAllOf(schema, model, interpreter, interpreterOptions)

Interpreter function for allOf keyword.

It either merges allOf schemas into existing model or if allowed, create inheritance.

Kind: global function

Param Description
schema
model
interpreter
interpreterOptions to control the interpret process

interpretAnyOf(schema, model, interpreter, interpreterOptions)

Interpreter function for anyOf keyword.

It puts the schema reference into the items field.

Kind: global function

Param Description
schema
model
interpreter
interpreterOptions to control the interpret process

interpretConst(schema, model)

Interpreter function for const keyword for draft version > 4

Kind: global function

Param
schema
model

interpretDependencies(schema, model)

Interpreter function for dependencies keyword.

Kind: global function

Param
schema
model

interpretEnum(schema, model)

Interpreter function for enum keyword

Kind: global function

Param
schema
model

interpretItems(schema, model, interpreter, interpreterOptions)

Interpreter function for items keyword.

Kind: global function

Param Description
schema
model
interpreter
interpreterOptions to control the interpret process

interpretArrayItems(rootSchema, itemSchemas, model, interpreter, interpreterOptions)

Internal function to process all item schemas

Kind: global function

Param Description
rootSchema
itemSchemas
model
interpreter
interpreterOptions to control the interpret process

interpretNot(schema, model, interpreter, interpreterOptions)

Interpreter function for not keyword.

Kind: global function

Param Description
schema
model
interpreter
interpreterOptions to control the interpret process

interpretOneOf(schema, model, interpreter, interpreterOptions)

Interpreter function for oneOf keyword.

It puts the schema reference into the items field.

Kind: global function

Param Description
schema
model
interpreter
interpreterOptions to control the interpret process

interpretOneOfWithAllOf(schema, model, interpreter, interpreterOptions)

Interpreter function for oneOf keyword combined with the allOf keyword.

It merges the allOf schemas into all of the oneOf schemas. Shared properties are merged. The oneOf schemas are then added as union to the model.

Kind: global function

Param Description
schema
model
interpreter
interpreterOptions to control the interpret process

interpretOneOfWithProperties(schema, model, interpreter, interpreterOptions)

Interpreter function for oneOf keyword combined with properties.

It merges the properties of the schema into the oneOf schemas. Shared properties are merged. The oneOf schemas are then added as union to the model.

Kind: global function

Param Description
schema
model
interpreter
interpreterOptions to control the interpret process

interpretPatternProperties(schema, model, interpreter, interpreterOptions)

Interpreter function for patternProperties keyword.

Kind: global function

Param Description
schema
model
interpreter
interpreterOptions to control the interpret process

interpretProperties(schema, model, interpreter, interpreterOptions)

Interpreter function for interpreting properties keyword.

Kind: global function

Param Description
schema
model
interpreter
interpreterOptions to control the interpret process

isEnum(model)

Check if CommonModel is an enum

Kind: global function

Param
model

isModelObject(model)

Check if CommonModel is a separate model or a simple model.

Kind: global function

Param
model

inferTypeFromValue(value)

Infers the JSON Schema type from value

Kind: global function

Param Description
value to infer type of

interpretName(schema)

Find the name for simplified version of schema

Kind: global function

Param Description
schema to find the name

isClass(obj)

Return true or false based on whether the input object is a regular object or a class

Taken from: https://stackoverflow.com/a/43197340/6803886

Kind: global function

Param
obj

mergePartialAndDefault()

Merge a non optional value with custom optional values to form a full value that has all properties sat.

Kind: global function