Skip to content

Annotations are not validated for types in referenced files #2007

@deiteris

Description

@deiteris

Your issue may already be reported! Please search on Github issues before creating one.

  • I'm submitting a ...

    • bug report
    • feature request
    • question
    • other
  • What is the current behavior?

When a RAML file references a RAML library with types that use invalid anntations, those are not validated by RAML validator. However, they are validated when the RAML library is validated directly.

  • If the current behavior is a bug, please provide the minimal steps to reproduce with AMF code. Please don't upload AMF code mixed with yours.

Consider the following RAML files:

root.raml

#%RAML 1.0 Library

uses:
    lib: lib.raml

lib.raml

#%RAML 1.0 Library

types:
    MyType:
        (invalid_annotation): test

And the following code in TypeScript:

import amf from 'amf-client-js'

(async () => {
  const client = amf.RAMLConfiguration.RAML10().baseUnitClient()

  let res = await client.parseLibrary("file://root.raml")
  console.log(res.conforms) // OK: true

  let validation = await client.validate(res.baseUnit)
  console.log(validation.conforms) // Not OK: true

  res = await client.parseLibrary("file://lib.raml")
  console.log(res.conforms) // OK: true

  validation = await client.validate(res.baseUnit)
  console.log(validation.conforms) // OK: false
})();

The output will be:

true
true
true
false
  • What is the expected behavior?

When validating root.raml, the validator should fail validation due to invalid annotation used in the RAML type provided in referenced library.

  • What is the motivation/use case for changing the behavior? (for feature requests)

  • Please tell us about your environment:

    • AMF Version: 5.4.5 and 5.5.2
    • AMF Distribution: JS
    • Operating System: Windows 10 21H2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions