Skip to content

Commit

Permalink
fix: update ecalc validation for yaml file in web (#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
krisolba1 authored Oct 17, 2023
1 parent 3634a9e commit 2981f2c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/libecalc/expression/expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def __modify_schema__(cls, field_schema):
{"type": "number"},
{
"type": "string",
"pattern": r"^[\w * ^ . : ; () {} = > < + \- /]+$",
"pattern": r"^[\w * ^ . : ; () {} = > < + \- /$]+$",
},
],
examples=["SIM1;OIL_PROD {+} 1000", 5],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,14 @@
},
{
"type": "object",
"properties": {
"SPEED": { "type": "number" },
"RATE": { "type": "array", "items": { "type": "number" } },
"HEAD": { "type": "array", "items": { "type": "number" } },
"EFFICIENCY": { "type": "array", "items": { "type": "number" } }
"properties": {
"SPEED": { "type": "number" },
"RATE": { "type": "array", "items": { "type": "number" } },
"HEAD": { "type": "array", "items": { "type": "number" } },
"EFFICIENCY": { "type": "array", "items": { "type": "number" } }
},
"additionalProperties": false
}
}
]
},
"DESIGN_RATE": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@
"NAME",
"TYPE",
"FLUID_MODEL",
"COMPRESSOR_TRAIN",
"PRESSURE_CONTROL"
"COMPRESSOR_TRAIN"
]
},
"INLET_TEMPERATURE": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def schema_extra(schema: Dict[str, Any], model: Type["YamlGeneratorSet"]) -> Non
title="NAME",
description="Name of the generator set.\n\n$ECALC_DOCS_KEYWORDS_URL/NAME",
)
category: ConsumerUserDefinedCategoryType = CategoryField(...)
category: YamlTemporalModel[ConsumerUserDefinedCategoryType] = CategoryField(...)
fuel: YamlTemporalModel[str] = Field(
None,
title="FUEL",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -652,9 +652,15 @@
"additionalProperties": false,
"properties": {
"CATEGORY": {
"allOf": [
"anyOf": [
{
"$ref": "#/definitions/ConsumerUserDefinedCategoryType"
},
{
"additionalProperties": {
"$ref": "#/definitions/ConsumerUserDefinedCategoryType"
},
"type": "object"
}
],
"description": "Output category/tag.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/CATEGORY",
Expand Down Expand Up @@ -834,7 +840,7 @@
"type": "number"
},
{
"pattern": "^[\\w * ^ . : ; () {} = > < + \\- /]+$",
"pattern": "^[\\w * ^ . : ; () {} = > < + \\- /$]+$",
"type": "string"
}
],
Expand All @@ -854,7 +860,7 @@
"type": "number"
},
{
"pattern": "^[\\w * ^ . : ; () {} = > < + \\- /]+$",
"pattern": "^[\\w * ^ . : ; () {} = > < + \\- /$]+$",
"type": "string"
}
],
Expand Down Expand Up @@ -886,7 +892,7 @@
"type": "number"
},
{
"pattern": "^[\\w * ^ . : ; () {} = > < + \\- /]+$",
"pattern": "^[\\w * ^ . : ; () {} = > < + \\- /$]+$",
"type": "string"
}
],
Expand All @@ -906,7 +912,7 @@
"type": "number"
},
{
"pattern": "^[\\w * ^ . : ; () {} = > < + \\- /]+$",
"pattern": "^[\\w * ^ . : ; () {} = > < + \\- /$]+$",
"type": "string"
}
],
Expand Down Expand Up @@ -1370,7 +1376,7 @@
"type": "number"
},
{
"pattern": "^[\\w * ^ . : ; () {} = > < + \\- /]+$",
"pattern": "^[\\w * ^ . : ; () {} = > < + \\- /$]+$",
"type": "string"
}
],
Expand Down Expand Up @@ -2816,6 +2822,7 @@
"type": "object"
},
{
"additionalProperties": false,
"properties": {
"EFFICIENCY": {
"items": {
Expand Down Expand Up @@ -3477,8 +3484,7 @@
"NAME",
"TYPE",
"FLUID_MODEL",
"COMPRESSOR_TRAIN",
"PRESSURE_CONTROL"
"COMPRESSOR_TRAIN"
],
"then": {
"unevaluatedProperties": {
Expand Down

0 comments on commit 2981f2c

Please sign in to comment.