Revision f8dedf60
Added by koszko about 1 year ago
common/jsonschema.js | ||
---|---|---|
57 | 57 |
|
58 | 58 |
#FROM common/jsonschema/scan.js IMPORT SchemaScanResult, scan |
59 | 59 |
|
60 |
#FROM common/entities.js IMPORT haketilo_schema_name_regex |
|
61 |
|
|
60 | 62 |
#EXPORT scan |
61 | 63 |
#EXPORT SchemaScanResult |
62 | 64 |
|
... | ... | |
86 | 88 |
#INCLUDE schemas/2.x/common_definitions-2.schema.json |
87 | 89 |
].reduce((ac, s) => Object.assign(ac, {[s.$id]: s}), {}); |
88 | 90 |
|
89 |
const name_base_re = "(?<name_base>[^/]*)"; |
|
90 |
const major_number_re = "(?<major>[1-9][0-9]*)"; |
|
91 |
const minor_number_re = "(?:[1-9][0-9]*|0)"; |
|
92 |
const numbers_rest_re = `(?:\\.${minor_number_re})*`; |
|
93 |
const version_re = `(?<ver>${major_number_re}${numbers_rest_re})`; |
|
94 |
const schema_name_re = `${name_base_re}-${version_re}\\.schema\\.json`; |
|
95 |
|
|
96 |
const haketilo_schema_name_regex = new RegExp(schema_name_re); |
|
97 |
|
|
98 | 91 |
for (const [$id, schema] of [...Object.entries(haketilo_schemas)]) { |
99 | 92 |
const match = haketilo_schema_name_regex.exec($id); |
100 | 93 |
const schema_name = |
... | ... | |
103 | 96 |
} |
104 | 97 |
|
105 | 98 |
#EXPORT haketilo_schemas |
106 |
#EXPORT haketilo_schema_name_regex |
|
107 | 99 |
|
108 | 100 |
const haketilo_validator = new Validator(); |
109 | 101 |
Object.values(haketilo_schemas) |
Also available in: Unified diff
allow eval() in injected scripts