Class: module:"openapi-transformers/nullable-not-required.js"

module:"openapi-transformers/nullable-not-required.js"()

Transformer to make properties which are nullable non-required to work around partial support for x-nullable in Autorest. Currently nullable data types are used (e.g. Nullable) but the Validate() method doesn't allow null. See: https://github.com/Azure/autorest/issues/3300

Constructor

new module:"openapi-transformers/nullable-not-required.js"()

Source:

Methods

(inner) isNullable(schemanon-null, hasNullType, refNullable) → {boolean}

Determines whether a given Schema can have a null value.
Parameters:
Name Type Description
schema object OpenAPI Schema object.
hasNullType boolean Whether 'null' is a valid Schema type.
refNullable boolean Treat $ref as nullable.
Source:
Returns:
true if null is a valid value for schema.
Type
boolean

(inner) isPropNullable(schemanon-null, propName, hasNullType, refNullable) → (nullable) {boolean}

Determines whether a given property of a given schema can have a null value.
Parameters:
Name Type Description
schema object OpenAPI Schema object.
propName string Name of property to check.
hasNullType boolean Whether 'null' is a valid Schema type.
refNullable boolean Treat $ref as nullable.
Source:
Returns:
true if null is known to be a valid value for propName in schema, false if null is known to be an invalid value for propName in schema. undefined if propName is not constrained by schema.
Type
boolean