OneMainF / raml-language-server

A RAML Language Server for VS Code and future Atom
GNU General Public License v3.0
3 stars 2 forks source link

AMF Validation Profiles not running #9

Open dtsimpson2 opened 5 years ago

dtsimpson2 commented 5 years ago
amfProfile = <amf.ProfileName>(<unknown>await amf.AMF.loadValidationProfile(settings.validation.rules));
validationResults = await amf.AMF.validate(model, amfProfile, amf.MessageStyles.RAML);

The above code in the server.ts file doesn't seem to actually run the validation profile passed in. It does still validate RAML, but when the file referenced in settings.validation.rules contains the following:

#%Validation Profile 1.0

profile: Custom

extends: RAML

violation:
  - version-constraints

validations:

  version-constraints:
    message: Version is mandatory and must be a semantic version M.m.r?
    targetClass: schema.WebAPI
    propertyConstraints:
      schema.version:
        minCount: 1
        pattern: "\d+\.\d+(\.\d+)?"

The it doesn't matter what the version: in the root of the RAML is. It reports no errors.

Will need to refer more to the documentation here to understand why.

May also need to set up a basic test separate from the extension to do more testing.

dtsimpson2 commented 4 years ago

the java code located here also seems to indicate that that code should work just fine. setting up a simpler script separate from the extension to see what may be wrong.