Skip to content

Commit

Permalink
Merge pull request #99 from hackolade/fix/validation-schema-registrie…
Browse files Browse the repository at this point in the history
…s-script-files

Validation: fix validation of .avsc files with format option
  • Loading branch information
Vitalii4as authored May 26, 2023
2 parents f423dba + dbe212d commit 581f01e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions forward_engineering/helpers/validateAvroScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ let _;
const validateAvroScript = (script, scriptType, logger) => {
_ = dependencies.lodash;

scriptType = detectScriptType(script) || scriptType;
const scripts = parseScript(script, scriptType);
const validator = getScriptValidator(scriptType);

Expand All @@ -29,6 +30,12 @@ const validateAvroScript = (script, scriptType, logger) => {
return getMessageForMultipleSchemaValidation(_.flatten(validationMessages));
};

const detectScriptType = script => {
if (parseJson(script).type) {
return SCRIPT_TYPES.COMMON;
}
};

const parseScript = (script, scriptType) =>{
switch(scriptType){
case SCRIPT_TYPES.CONFLUENT_SCHEMA_REGISTRY:
Expand Down

0 comments on commit 581f01e

Please sign in to comment.