Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue239 correct schema #244

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions json2mo/element.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion lib/jsonquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }))
}
Expand Down
27 changes: 25 additions & 2 deletions schema-modelica.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down Expand Up @@ -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"
Expand Down