File tree Expand file tree Collapse file tree 1 file changed +12
-9
lines changed
Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change 2929THISDIR = os .path .dirname (os .path .realpath (__file__ ))
3030LOGGER = logging .getLogger (__name__ )
3131SCHEMA = f"{ THISDIR } { os .sep } resources{ os .sep } schema"
32+ SCHEMA_VERSIONS = ['csv2bufr-template-v2.json' , 'csv2bufr-template-v3.json' ]
3233TEMPLATE_DIRS = [] # [Path("./")]
3334
3435_SUCCESS_ = True
@@ -178,15 +179,17 @@ def index_templates() -> bool:
178179 # check if valid mapping file
179180 with template .open () as fh :
180181 tmpl = json .load (fh )
181- if 'csv2bufr-template-v3.json' not in tmpl .get ("conformsTo" ,[]): # noqa
182- if 'csv2bufr-template-v2.json' in tmpl .get ("conformsTo" ,[]): # noqa
183- LOGGER .warning ("Deprecated 'csv2bufr-template-v2.json' found in " + # noqa
184- f"conformsTo for file { template } " ) # noqa
185- LOGGER .warning ("Support for 'csv2bufr-template-v2.json' will be removed in a future release" ) # noqa
186- else :
187- LOGGER .warning ("'csv2bufr-template-v3.json' not found in " + # noqa
188- f"conformsTo for file { template } , skipping" ) # noqa
189- continue
182+ valid_schema = False
183+ for sc in SCHEMA_VERSIONS :
184+ if sc in tmpl .get ("conformsTo" ,[]):
185+ valid_schema = True
186+ break
187+ if not valid_schema :
188+ LOGGER .warning (
189+ "No valid schema not found in " + # noqa
190+ f"conformsTo for file { template } , skipping" ) # noqa
191+ continue
192+
190193 if validate_template (tmpl ) == _SUCCESS_ :
191194 # get label if exists else set to empty string
192195 fname = str (template )
You can’t perform that action at this time.
0 commit comments