Opened 4 weeks ago

Closed 4 weeks ago

#1518 closed defect (fixed)

WCST_Import check the evaluation expressions metadata result in ingredient file

Reported by: bphamhuu Owned by: bphamhuu
Priority: major Milestone: 9.4
Component: wcst_import Version: development
Keywords: wcst_import expression, ingredient file Cc: vmerticariu, dmisev
Complexity: Medium

Description

wcst_import evaluation expression has the syntax ${...} and the expression will be evaluated to get the value (e.g: netCDF variable's metadata).

However, if the $ is missing, it just pass the invalidate message to petascope such as: "description": "'{grib:marsClass}'",

and could lead to petascope postgresql query is not valid due to the expression is not evaluated:

SELECT id,label FROM ps_quantity WHERE uom_id='1'
AND description=''{grib:marsClass}'' AND nil_ids='{13}'

ERROR:  syntax error at or near "{"
LINE 1: ...OM ps_quantity WHERE uom_id='1' AND description=''{grib:mars...
                                                             ^

Ingredient file example: https://pastebin.com/FcAraFhC
which has invalid syntax in band's metadata with description element which needs to throw error in wcst_import

          "bands": [
            {
              "name": "2_metre_temperature_surface",
              "identifier": "'${grib:cfVarName}'",
	      "description": "'{grib:marsClass}'",
              "nilReason": "Nil value represents missing values.",
              "nilValue": "'${grib:missingValue}'"
            }

Change History (10)

comment:1 Changed 4 weeks ago by dmisev

So is this valid?

                "metadata": {
                    "type": "xml",
                    "global": {
                        "Title": "'This is a test coverage'"
                    }
                },

comment:2 Changed 4 weeks ago by bphamhuu

@Dimitar: the {} without $ is invalid, yours is valid.

comment:3 follow-up: Changed 4 weeks ago by dmisev

Just be careful; if you're going to change whether "'text'" is valid or not, make sure that existing ingredients files are not broken.

comment:4 in reply to: ↑ 3 Changed 4 weeks ago by bphamhuu

Replying to dmisev:

Just be careful; if you're going to change whether "'text'" is valid or not, make sure that existing ingredients files are not broken.

I only check if the evaluation with {} miss the $.

comment:5 follow-up: Changed 4 weeks ago by dmisev

Why is it invalid? I understand that "'This is a test coverage'" is just text; I can't have { or } in a title?

comment:6 in reply to: ↑ 5 Changed 4 weeks ago by bphamhuu

Replying to dmisev:

Why is it invalid? I understand that "'This is a test coverage'" is just text; I can't have { or } in a title?

metadata could be in JSON format then the "{" or "}" is keywords and should not be used in string.

comment:7 follow-up: Changed 4 weeks ago by dmisev

here it's xml type so they are valid I guess?

comment:8 in reply to: ↑ 7 Changed 4 weeks ago by bphamhuu

Replying to dmisev:

here it's xml type so they are valid I guess?

Actually, I'm not the one who created this syntax, so I will check wcst_import first, I think in the ticket error, it should just remove the and "{....}" is a valid string as well in SQL, instead of "'{....}'". "'" seems to be used for making this evaluation returns a string.

comment:9 Changed 4 weeks ago by bphamhuu

  • Summary changed from WCST_Import validate all the evaluation expressions in ingredient file to WCST_Import check the evaluation expressions metadata result in ingredient file

comment:10 Changed 4 weeks ago by bphamhuu

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.