var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/* Generated from Java with JSweet 2.3.7 - http://www.jsweet.org */
import { JsonCompat } from '../../../compat/JsonCompat';
import { NodeCompat } from '../../../compat/NodeCompat';
import { Constants } from '../../../core/Constants';
import { OasDataModelReader } from '../../io/OasDataModelReader';
/**
 * A data model reader for the OpenAPI 2.0 data model.
 * @author eric.wittmann@gmail.com
 * @class
 * @extends OasDataModelReader
 */
var Oas30DataModelReader = /** @class */ (function (_super) {
    __extends(Oas30DataModelReader, _super);
    function Oas30DataModelReader() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * @see io.apicurio.datamodels.core.io.DataModelReader#readDocument(java.lang.Object, io.apicurio.datamodels.core.models.Document)
     * @param {*} json
     * @param {Document} node
     */
    Oas30DataModelReader.prototype.readDocument = function (json, node) {
        var _this = this;
        var doc = node;
        var openapi = JsonCompat.consumePropertyString(json, Constants.PROP_OPENAPI);
        var servers = JsonCompat.consumePropertyArray(json, Constants.PROP_SERVERS);
        var components = JsonCompat.consumeProperty(json, Constants.PROP_COMPONENTS);
        doc.openapi = openapi;
        if (servers != null) {
            var serverModels = ([]);
            servers.forEach((function (doc, serverModels) {
                return function (server) {
                    var serverModel = doc.createServer();
                    _this.readServer(server, serverModel);
                    /* add */ (serverModels.push(serverModel) > 0);
                };
            })(doc, serverModels));
            doc.servers = serverModels;
        }
        if (components != null) {
            doc.components = doc.createComponents();
            this.readComponents(components, doc.components);
        }
        _super.prototype.readDocument.call(this, json, doc);
    };
    /**
     * Reads a Components model.
     * @param {*} json
     * @param {Oas30Components} node
     */
    Oas30DataModelReader.prototype.readComponents = function (json, node) {
        var _this = this;
        var schemas = JsonCompat.consumeProperty(json, Constants.PROP_SCHEMAS);
        var responses = JsonCompat.consumeProperty(json, Constants.PROP_RESPONSES);
        var parameters = JsonCompat.consumeProperty(json, Constants.PROP_PARAMETERS);
        var examples = JsonCompat.consumeProperty(json, Constants.PROP_EXAMPLES);
        var requestBodies = JsonCompat.consumeProperty(json, Constants.PROP_REQUEST_BODIES);
        var headers = JsonCompat.consumeProperty(json, Constants.PROP_HEADERS);
        var securitySchemes = JsonCompat.consumeProperty(json, Constants.PROP_SECURITY_SCHEMES);
        var links = JsonCompat.consumeProperty(json, Constants.PROP_LINKS);
        var callbacks = JsonCompat.consumeProperty(json, Constants.PROP_CALLBACKS);
        if (schemas != null) {
            JsonCompat.keys(schemas).forEach((function (schemas) {
                return function (name) {
                    var schema = JsonCompat.consumeProperty(schemas, name);
                    var schemaModel = node.createSchemaDefinition(name);
                    _this.readSchema(schema, schemaModel);
                    node.addSchemaDefinition(name, schemaModel);
                };
            })(schemas));
        }
        if (responses != null) {
            JsonCompat.keys(responses).forEach((function (responses) {
                return function (name) {
                    var response = JsonCompat.consumeProperty(responses, name);
                    var responseModel = node.createResponseDefinition(name);
                    _this.readResponse(response, responseModel);
                    node.addResponseDefinition(name, responseModel);
                };
            })(responses));
        }
        if (parameters != null) {
            JsonCompat.keys(parameters).forEach((function (parameters) {
                return function (name) {
                    var parameter = JsonCompat.consumeProperty(parameters, name);
                    var parameterModel = node.createParameterDefinition(name);
                    _this.readParameter(parameter, parameterModel);
                    node.addParameterDefinition(name, parameterModel);
                };
            })(parameters));
        }
        if (examples != null) {
            JsonCompat.keys(examples).forEach((function (examples) {
                return function (name) {
                    var example = JsonCompat.consumeProperty(examples, name);
                    var exampleModel = node.createExampleDefinition(name);
                    _this.readExample(example, exampleModel);
                    node.addExampleDefinition(name, exampleModel);
                };
            })(examples));
        }
        if (requestBodies != null) {
            JsonCompat.keys(requestBodies).forEach((function (requestBodies) {
                return function (name) {
                    var requestBody = JsonCompat.consumeProperty(requestBodies, name);
                    var requestBodyModel = node.createRequestBodyDefinition(name);
                    _this.readRequestBody(requestBody, requestBodyModel);
                    node.addRequestBodyDefinition(name, requestBodyModel);
                };
            })(requestBodies));
        }
        if (headers != null) {
            JsonCompat.keys(headers).forEach((function (headers) {
                return function (name) {
                    var header = JsonCompat.consumeProperty(headers, name);
                    var headerModel = node.createHeaderDefinition(name);
                    _this.readHeader(header, headerModel);
                    node.addHeaderDefinition(name, headerModel);
                };
            })(headers));
        }
        if (securitySchemes != null) {
            JsonCompat.keys(securitySchemes).forEach((function (securitySchemes) {
                return function (name) {
                    var securityScheme = JsonCompat.consumeProperty(securitySchemes, name);
                    var securitySchemeModel = node.createSecurityScheme(name);
                    _this.readSecurityScheme(securityScheme, securitySchemeModel);
                    node.addSecurityScheme(name, securitySchemeModel);
                };
            })(securitySchemes));
        }
        if (links != null) {
            JsonCompat.keys(links).forEach((function (links) {
                return function (name) {
                    var link = JsonCompat.consumeProperty(links, name);
                    var linkModel = node.createLinkDefinition(name);
                    _this.readLink(link, linkModel);
                    node.addLinkDefinition(name, linkModel);
                };
            })(links));
        }
        if (callbacks != null) {
            JsonCompat.keys(callbacks).forEach((function (callbacks) {
                return function (name) {
                    var callback = JsonCompat.consumeProperty(callbacks, name);
                    var callbackModel = node.createCallbackDefinition(name);
                    _this.readCallback(callback, callbackModel);
                    node.addCallbackDefinition(name, callbackModel);
                };
            })(callbacks));
        }
    };
    /**
     * @see io.apicurio.datamodels.core.io.DataModelReader#readSecurityScheme(java.lang.Object, io.apicurio.datamodels.core.models.common.SecurityScheme)
     * @param {*} json
     * @param {SecurityScheme} node
     */
    Oas30DataModelReader.prototype.readSecurityScheme = function (json, node) {
        var oasNode = node;
        var $ref = JsonCompat.consumePropertyString(json, Constants.PROP_$REF);
        var scheme = JsonCompat.consumePropertyString(json, Constants.PROP_SCHEME);
        var bearerFormat = JsonCompat.consumePropertyString(json, Constants.PROP_BEARER_FORMAT);
        var flows = JsonCompat.consumeProperty(json, Constants.PROP_FLOWS);
        var openIdConnectUrl = JsonCompat.consumePropertyString(json, Constants.PROP_OPEN_ID_CONNECT_URL);
        oasNode.$ref = $ref;
        oasNode.scheme = scheme;
        oasNode.bearerFormat = bearerFormat;
        oasNode.openIdConnectUrl = openIdConnectUrl;
        if (flows != null) {
            oasNode.flows = oasNode.createOAuthFlows();
            this.readOAuthFlows(flows, oasNode.flows);
        }
        _super.prototype.readSecurityScheme.call(this, json, oasNode);
    };
    /**
     * @see io.apicurio.datamodels.openapi.io.OasDataModelReader#readPathItem(java.lang.Object, io.apicurio.datamodels.openapi.models.OasPathItem)
     * @param {*} json
     * @param {OasPathItem} node
     */
    Oas30DataModelReader.prototype.readPathItem = function (json, node) {
        var _this = this;
        var pi = node;
        var summary = JsonCompat.consumePropertyString(json, Constants.PROP_SUMMARY);
        var description = JsonCompat.consumePropertyString(json, Constants.PROP_DESCRIPTION);
        var trace = JsonCompat.consumeProperty(json, Constants.PROP_TRACE);
        var servers = JsonCompat.consumePropertyArray(json, Constants.PROP_SERVERS);
        pi.summary = summary;
        pi.description = description;
        if (trace != null) {
            pi.trace = pi.createOperation(Constants.PROP_TRACE);
            this.readOperation(trace, pi.trace);
        }
        if (servers != null) {
            servers.forEach((function (pi) {
                return function (server) {
                    var serverModel = pi.createServer();
                    _this.readServer(server, serverModel);
                    pi.addServer$io_apicurio_datamodels_openapi_v3_models_Oas30Server(serverModel);
                };
            })(pi));
        }
        _super.prototype.readPathItem.call(this, json, node);
    };
    /**
     * @see io.apicurio.datamodels.openapi.io.OasDataModelReader#readHeader(java.lang.Object, io.apicurio.datamodels.openapi.models.OasHeader)
     * @param {*} json
     * @param {OasHeader} node
     */
    Oas30DataModelReader.prototype.readHeader = function (json, node) {
        var _this = this;
        var header = node;
        var $ref = JsonCompat.consumePropertyString(json, Constants.PROP_$REF);
        var required = JsonCompat.consumePropertyBoolean(json, Constants.PROP_REQUIRED);
        var schema = JsonCompat.consumeProperty(json, Constants.PROP_SCHEMA);
        var allowEmptyValue = JsonCompat.consumePropertyBoolean(json, Constants.PROP_ALLOW_EMPTY_VALUE);
        var deprecated = JsonCompat.consumePropertyBoolean(json, Constants.PROP_DEPRECATED);
        var style = JsonCompat.consumePropertyString(json, Constants.PROP_STYLE);
        var explode = JsonCompat.consumePropertyBoolean(json, Constants.PROP_EXPLODE);
        var allowReserved = JsonCompat.consumePropertyBoolean(json, Constants.PROP_ALLOW_RESERVED);
        var example = JsonCompat.consumeProperty(json, Constants.PROP_EXAMPLE);
        var examples = JsonCompat.consumeProperty(json, Constants.PROP_EXAMPLES);
        var content = JsonCompat.consumeProperty(json, Constants.PROP_CONTENT);
        header.$ref = $ref;
        header.required = required;
        header.allowEmptyValue = allowEmptyValue;
        header.deprecated = deprecated;
        header.style = style;
        header.explode = explode;
        header.allowReserved = allowReserved;
        header.example = example;
        if (schema != null) {
            header.schema = header.createSchema();
            this.readSchema(schema, header.schema);
        }
        if (examples != null) {
            JsonCompat.keys(examples).forEach((function (examples, header) {
                return function (name) {
                    var exx = JsonCompat.consumeProperty(examples, name);
                    var exampleModel = header.createExample(name);
                    _this.readExample(exx, exampleModel);
                    header.addExample(exampleModel);
                };
            })(examples, header));
        }
        if (content != null) {
            JsonCompat.keys(content).forEach((function (header, content) {
                return function (name) {
                    var mediaType = JsonCompat.consumeProperty(content, name);
                    var mediaTypeModel = header.createMediaType(name);
                    _this.readMediaType(mediaType, mediaTypeModel);
                    header.addMediaType(name, mediaTypeModel);
                };
            })(header, content));
        }
        _super.prototype.readHeader.call(this, json, node);
    };
    /**
     * @see io.apicurio.datamodels.openapi.io.OasDataModelReader#readParameter(java.lang.Object, io.apicurio.datamodels.core.models.common.Parameter)
     * @param {*} json
     * @param {Parameter} node
     */
    Oas30DataModelReader.prototype.readParameter = function (json, node) {
        var _this = this;
        var param = node;
        var deprecated = JsonCompat.consumePropertyBoolean(json, Constants.PROP_DEPRECATED);
        var style = JsonCompat.consumePropertyString(json, Constants.PROP_STYLE);
        var explode = JsonCompat.consumePropertyBoolean(json, Constants.PROP_EXPLODE);
        var allowReserved = JsonCompat.consumePropertyBoolean(json, Constants.PROP_ALLOW_RESERVED);
        var example = JsonCompat.consumeProperty(json, Constants.PROP_EXAMPLE);
        var examples = JsonCompat.consumeProperty(json, Constants.PROP_EXAMPLES);
        var content = JsonCompat.consumeProperty(json, Constants.PROP_CONTENT);
        param.deprecated = deprecated;
        param.style = style;
        param.explode = explode;
        param.allowReserved = allowReserved;
        param.example = example;
        if (examples != null) {
            JsonCompat.keys(examples).forEach((function (examples, param) {
                return function (name) {
                    var exx = JsonCompat.consumeProperty(examples, name);
                    var exampleModel = param.createExample(name);
                    _this.readExample(exx, exampleModel);
                    param.addExample(exampleModel);
                };
            })(examples, param));
        }
        if (content != null) {
            JsonCompat.keys(content).forEach((function (param, content) {
                return function (name) {
                    var mediaType = JsonCompat.consumeProperty(content, name);
                    var mediaTypeModel = param.createMediaType(name);
                    _this.readMediaType(mediaType, mediaTypeModel);
                    param.addMediaType(name, mediaTypeModel);
                };
            })(param, content));
        }
        _super.prototype.readParameter.call(this, json, node);
    };
    /**
     * @see io.apicurio.datamodels.openapi.io.OasDataModelReader#readOperation(java.lang.Object, io.apicurio.datamodels.core.models.common.Operation)
     * @param {*} json
     * @param {Operation} node
     */
    Oas30DataModelReader.prototype.readOperation = function (json, node) {
        var _this = this;
        var operation = node;
        var requestBody = JsonCompat.consumeProperty(json, Constants.PROP_REQUEST_BODY);
        var callbacks = JsonCompat.consumeProperty(json, Constants.PROP_CALLBACKS);
        var servers = JsonCompat.consumePropertyArray(json, Constants.PROP_SERVERS);
        if (requestBody != null) {
            operation.requestBody = operation.createRequestBody();
            this.readRequestBody(requestBody, operation.requestBody);
        }
        if (callbacks != null) {
            JsonCompat.keys(callbacks).forEach((function (callbacks, operation) {
                return function (name) {
                    var callback = JsonCompat.consumeProperty(callbacks, name);
                    var callbackModel = operation.createCallback(name);
                    _this.readCallback(callback, callbackModel);
                    operation.addCallback(name, callbackModel);
                };
            })(callbacks, operation));
        }
        if (servers != null) {
            servers.forEach((function (operation) {
                return function (server) {
                    var serverModel = operation.createServer();
                    _this.readServer(server, serverModel);
                    operation.addServer(serverModel);
                };
            })(operation));
        }
        _super.prototype.readOperation.call(this, json, node);
    };
    /**
     * Reads an OAS 3.0 Callback object from the given JS data.
     * @param {*} json
     * @param {Oas30Callback} node
     */
    Oas30DataModelReader.prototype.readCallback = function (json, node) {
        var _this = this;
        JsonCompat.keys(json).forEach(function (name) {
            if (NodeCompat.equals(name, Constants.PROP_$REF)) {
                node.$ref = JsonCompat.consumePropertyString(json, name);
            }
            else {
                var pathItem = JsonCompat.consumeProperty(json, name);
                var pathItemModel = node.createPathItem(name);
                _this.readPathItem(pathItem, pathItemModel);
                node.addPathItem(name, pathItemModel);
            }
        });
        this.readExtensions(json, node);
        this.readExtraProperties(json, node);
    };
    /**
     * Reads an OAS 3.0 Request Body object from the given JS data.
     * @param {*} json
     * @param {Oas30RequestBody} node
     */
    Oas30DataModelReader.prototype.readRequestBody = function (json, node) {
        var _this = this;
        var $ref = JsonCompat.consumePropertyString(json, Constants.PROP_$REF);
        var description = JsonCompat.consumePropertyString(json, Constants.PROP_DESCRIPTION);
        var content = JsonCompat.consumeProperty(json, Constants.PROP_CONTENT);
        var required = JsonCompat.consumePropertyBoolean(json, Constants.PROP_REQUIRED);
        node.$ref = $ref;
        node.description = description;
        node.required = required;
        if (content != null) {
            JsonCompat.keys(content).forEach((function (content) {
                return function (name) {
                    var mediaType = JsonCompat.consumeProperty(content, name);
                    var mediaTypeModel = node.createMediaType(name);
                    _this.readMediaType(mediaType, mediaTypeModel);
                    node.addMediaType(name, mediaTypeModel);
                };
            })(content));
        }
        this.readExtensions(json, node);
        this.readExtraProperties(json, node);
    };
    /**
     * Reads an OAS 3.0 Media Type from the given js data.
     * @param {*} json
     * @param {Oas30MediaType} node
     */
    Oas30DataModelReader.prototype.readMediaType = function (json, node) {
        var _this = this;
        var schema = JsonCompat.consumeProperty(json, Constants.PROP_SCHEMA);
        var example = JsonCompat.consumePropertyObject(json, Constants.PROP_EXAMPLE);
        var examples = JsonCompat.consumeProperty(json, Constants.PROP_EXAMPLES);
        var encodings = JsonCompat.consumeProperty(json, Constants.PROP_ENCODING);
        node.example = example;
        if (schema != null) {
            node.schema = node.createSchema();
            this.readSchema(schema, node.schema);
        }
        if (examples != null) {
            JsonCompat.keys(examples).forEach((function (examples) {
                return function (name) {
                    var exx = JsonCompat.consumeProperty(examples, name);
                    var exampleModel = node.createExample(name);
                    _this.readExample(exx, exampleModel);
                    node.addExample(exampleModel);
                };
            })(examples));
        }
        if (encodings != null) {
            JsonCompat.keys(encodings).forEach((function (encodings) {
                return function (name) {
                    var encoding = JsonCompat.consumeProperty(encodings, name);
                    var encodingModel = node.createEncoding(name);
                    _this.readEncoding(encoding, encodingModel);
                    node.addEncoding(name, encodingModel);
                };
            })(encodings));
        }
        this.readExtensions(json, node);
        this.readExtraProperties(json, node);
    };
    /**
     * Reads an OAS 3.0 Example from the given js data.
     * @param {*} json
     * @param {Oas30Example} node
     */
    Oas30DataModelReader.prototype.readExample = function (json, node) {
        var $ref = JsonCompat.consumePropertyString(json, Constants.PROP_$REF);
        var summary = JsonCompat.consumePropertyString(json, Constants.PROP_SUMMARY);
        var description = JsonCompat.consumePropertyString(json, Constants.PROP_DESCRIPTION);
        var value = JsonCompat.consumePropertyObject(json, Constants.PROP_VALUE);
        var externalValue = JsonCompat.consumePropertyString(json, Constants.PROP_EXTERNAL_VALUE);
        node.$ref = $ref;
        node.summary = summary;
        node.description = description;
        node.value = value;
        node.externalValue = externalValue;
        this.readExtensions(json, node);
        this.readExtraProperties(json, node);
    };
    /**
     * Reads an OAS 3.0 Encoding from the given js data.
     * @param {*} json
     * @param {Oas30Encoding} node
     */
    Oas30DataModelReader.prototype.readEncoding = function (json, node) {
        var _this = this;
        var contentType = JsonCompat.consumePropertyString(json, Constants.PROP_CONTENT_TYPE);
        var headers = JsonCompat.consumeProperty(json, Constants.PROP_HEADERS);
        var style = JsonCompat.consumePropertyString(json, Constants.PROP_STYLE);
        var explode = JsonCompat.consumePropertyBoolean(json, Constants.PROP_EXPLODE);
        var allowReserved = JsonCompat.consumePropertyBoolean(json, Constants.PROP_ALLOW_RESERVED);
        node.contentType = contentType;
        node.style = style;
        node.explode = explode;
        node.allowReserved = allowReserved;
        if (headers != null) {
            JsonCompat.keys(headers).forEach((function (headers) {
                return function (name) {
                    var header = JsonCompat.consumeProperty(headers, name);
                    var headerModel = node.createHeader(name);
                    _this.readHeader(header, headerModel);
                    node.addHeader(name, headerModel);
                };
            })(headers));
        }
        this.readExtensions(json, node);
        this.readExtraProperties(json, node);
    };
    /**
     * @see io.apicurio.datamodels.openapi.io.OasDataModelReader#readResponse(java.lang.Object, io.apicurio.datamodels.openapi.models.OasResponse)
     * @param {*} json
     * @param {OasResponse} node
     */
    Oas30DataModelReader.prototype.readResponse = function (json, node) {
        var _this = this;
        var response = node;
        var headers = JsonCompat.consumeProperty(json, Constants.PROP_HEADERS);
        var content = JsonCompat.consumeProperty(json, Constants.PROP_CONTENT);
        var links = JsonCompat.consumeProperty(json, Constants.PROP_LINKS);
        if (headers != null) {
            JsonCompat.keys(headers).forEach((function (headers, response) {
                return function (name) {
                    var header = JsonCompat.consumeProperty(headers, name);
                    var headerModel = response.createHeader(name);
                    _this.readHeader(header, headerModel);
                    response.addHeader(name, headerModel);
                };
            })(headers, response));
        }
        if (content != null) {
            JsonCompat.keys(content).forEach((function (response, content) {
                return function (name) {
                    var mediaType = JsonCompat.consumeProperty(content, name);
                    var mediaTypeModel = response.createMediaType(name);
                    _this.readMediaType(mediaType, mediaTypeModel);
                    response.addMediaType(name, mediaTypeModel);
                };
            })(response, content));
        }
        if (links != null) {
            JsonCompat.keys(links).forEach((function (response, links) {
                return function (name) {
                    var link = JsonCompat.consumeProperty(links, name);
                    var linkModel = response.createLink(name);
                    _this.readLink(link, linkModel);
                    response.addLink(name, linkModel);
                };
            })(response, links));
        }
        _super.prototype.readResponse.call(this, json, node);
    };
    /**
     * Reads an OAS 3.0 Link object from the given js data.
     * @param {*} json
     * @param {Oas30Link} node
     */
    Oas30DataModelReader.prototype.readLink = function (json, node) {
        var $ref = JsonCompat.consumePropertyString(json, Constants.PROP_$REF);
        var operationRef = JsonCompat.consumePropertyString(json, Constants.PROP_OPERATION_REF);
        var operationId = JsonCompat.consumePropertyString(json, Constants.PROP_OPERATION_ID);
        var parameters = JsonCompat.consumeProperty(json, Constants.PROP_PARAMETERS);
        var requestBody = JsonCompat.consumePropertyString(json, Constants.PROP_REQUEST_BODY);
        var description = JsonCompat.consumePropertyString(json, Constants.PROP_DESCRIPTION);
        var server = JsonCompat.consumeProperty(json, Constants.PROP_SERVER);
        node.$ref = $ref;
        node.operationRef = operationRef;
        node.operationId = operationId;
        node.description = description;
        if (parameters != null) {
            JsonCompat.keys(parameters).forEach((function (parameters) {
                return function (name) {
                    var expression = JsonCompat.consumePropertyString(parameters, name);
                    node.addLinkParameter(name, expression);
                };
            })(parameters));
        }
        if (requestBody != null) {
            node.requestBody = node.createLinkRequestBodyExpression(requestBody);
        }
        if (server != null) {
            node.server = node.createServer();
            this.readServer(server, node.server);
        }
        this.readExtensions(json, node);
        this.readExtraProperties(json, node);
    };
    /**
     * @see io.apicurio.datamodels.openapi.io.OasDataModelReader#readSchema(java.lang.Object, io.apicurio.datamodels.core.models.common.Schema)
     * @param {*} json
     * @param {Schema} node
     */
    Oas30DataModelReader.prototype.readSchema = function (json, node) {
        var _this = this;
        var schema = node;
        var oneOf = JsonCompat.consumePropertyArray(json, Constants.PROP_ONE_OF);
        var anyOf = JsonCompat.consumePropertyArray(json, Constants.PROP_ANY_OF);
        var not = JsonCompat.consumeProperty(json, Constants.PROP_NOT);
        var discriminator = JsonCompat.consumeProperty(json, Constants.PROP_DISCRIMINATOR);
        var nullable = JsonCompat.consumePropertyBoolean(json, Constants.PROP_NULLABLE);
        var writeOnly = JsonCompat.consumePropertyBoolean(json, Constants.PROP_WRITE_ONLY);
        var deprecated = JsonCompat.consumePropertyBoolean(json, Constants.PROP_DEPRECATED);
        schema.nullable = nullable;
        schema.writeOnly = writeOnly;
        schema.deprecated = deprecated;
        if (oneOf != null) {
            oneOf.forEach((function (schema) {
                return function (oneOfSchema) {
                    var oneOfSchemaModel = schema.createOneOfSchema();
                    _this.readSchema(oneOfSchema, oneOfSchemaModel);
                    schema.addOneOfSchema(oneOfSchemaModel);
                };
            })(schema));
        }
        if (anyOf != null) {
            anyOf.forEach((function (schema) {
                return function (anyOfSchema) {
                    var anyOfSchemaModel = schema.createAnyOfSchema();
                    _this.readSchema(anyOfSchema, anyOfSchemaModel);
                    schema.addAnyOfSchema(anyOfSchemaModel);
                };
            })(schema));
        }
        if (not != null) {
            schema.not = schema.createNotSchema();
            this.readSchema(not, schema.not);
        }
        if (discriminator != null) {
            schema.discriminator = schema.createDiscriminator();
            this.readDiscriminator(discriminator, schema.discriminator);
        }
        _super.prototype.readSchema.call(this, json, node);
    };
    /**
     * Reads an OAS 3.0 Discriminator object from the given JS data.
     * @param {*} json
     * @param {Oas30Discriminator} node
     */
    Oas30DataModelReader.prototype.readDiscriminator = function (json, node) {
        var propertyName = JsonCompat.consumePropertyString(json, Constants.PROP_PROPERTY_NAME);
        var mapping = JsonCompat.consumeProperty(json, Constants.PROP_MAPPING);
        node.propertyName = propertyName;
        if (mapping != null) {
            JsonCompat.keys(mapping).forEach((function (mapping) {
                return function (key) {
                    var value = JsonCompat.consumePropertyString(mapping, key);
                    node.addMapping(key, value);
                };
            })(mapping));
        }
        this.readExtensions(json, node);
        this.readExtraProperties(json, node);
    };
    return Oas30DataModelReader;
}(OasDataModelReader));
export { Oas30DataModelReader };
Oas30DataModelReader["__class"] = "io.apicurio.datamodels.openapi.v3.io.Oas30DataModelReader";
//# sourceMappingURL=Oas30DataModelReader.js.map