Skip to content

add custom semantic validator to swagger editor project  #4122

@boulbababenjabeur

Description

@boulbababenjabeur

i want to add a custom validator in the existing system of swagger editor project (or modify a current one)
i added a validator file in src/plugins/validation/semantic-validation/validators and imported that function in SemanticValidatorsPlugin but the project is not reading the file does anyone know a way to apply my modification ?
this is the function i want to add that controls the version of the swagger definition file

export const myValidator = sys => {
return sys.validateSelectors
.allInfos()
.then(nodes => {
return nodes.reduce((acc, node) => {
const value = node.node;

    if (value.version !== '2.0' && value.version !== '3.0.0') {
      acc.push({
        level: 'error',
        message: `Unsupported Swagger version: ${value.version}`,
        path: [...node.path, 'version']
      });
    }

    return acc;
  }, []);
});

};

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions