diff --git a/json2mo/element.js b/json2mo/element.js index cdbf11dc..5c934838 100644 --- a/json2mo/element.js +++ b/json2mo/element.js @@ -45,8 +45,8 @@ function parse (content, rawJson = false) { if (content.replaceable != null) { if (content.replaceable) { moOutput += 'replaceable ' - if (content.class_definition != null) { - moOutput += classDefinitionParser.parse(content.class_definition, rawJson) + if (content.element_class_definition != null) { + moOutput += classDefinitionParser.parse(content.element_class_definition, rawJson) } else if (content.component_clause != null) { moOutput += componentClauseParser.parse(content.component_clause, rawJson) } @@ -67,15 +67,15 @@ function parse (content, rawJson = false) { } moOutput += ';\n' } else { - if (content.class_definition != null) { - moOutput += classDefinitionParser.parse(content.class_definition, rawJson) + if (content.element_class_definition != null) { + moOutput += classDefinitionParser.parse(content.element_class_definition, rawJson) } else if (content.component_clause != null) { moOutput += componentClauseParser.parse(content.component_clause, rawJson) } } } else { - if (content.class_definition != null) { - moOutput += classDefinitionParser.parse(content.class_definition, rawJson) + if (content.element_class_definition != null) { + moOutput += classDefinitionParser.parse(content.element_class_definition, rawJson) } else if (content.component_clause != null) { moOutput += componentClauseParser.parse(content.component_clause, rawJson) } diff --git a/lib/jsonquery.js b/lib/jsonquery.js index f4553c7d..2b168f55 100644 --- a/lib/jsonquery.js +++ b/lib/jsonquery.js @@ -151,7 +151,7 @@ function elementList (eleLis) { { outer: outer || undefined }, { replaceable: replaceable || undefined }, { constraining_clause: conCla ? this.constrainingClause(conCla) : undefined }, - { class_definition: claDef ? this.classDefinition(claDef) : undefined }, + { element_class_definition: claDef ? this.classDefinition(claDef) : undefined }, { component_clause: comCla ? this.componentClause(comCla) : undefined }, { description: !ut.isEmptyObject(desObj) ? desObj : undefined })) } diff --git a/schema-modelica.json b/schema-modelica.json index a401d2fe..9539921a 100644 --- a/schema-modelica.json +++ b/schema-modelica.json @@ -32,6 +32,29 @@ } } }, + "element_class_definition": { + "description": "Element class definition", + "type": "object", + "required": [ + "class_prefixes", + "class_specifier" + ], + "additionalProperties": false, + "properties": { + "final": { + "type": "boolean" + }, + "encapsulated": { + "type": "boolean" + }, + "class_prefixes": { + "type": "string" + }, + "class_specifier": { + "$ref": "#/definitions/class_specifier" + } + } + }, "class_specifier": { "description": "Class specifier", "oneOf": [ @@ -168,8 +191,8 @@ "constraining_clause": { "$ref": "#/definitions/constraining_clause" }, - "class_definition": { - "$ref": "#/definitions/class_definition" + "element_class_definition": { + "$ref": "#/definitions/element_class_definition" }, "component_clause": { "$ref": "#/definitions/component_clause"