Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annotations are not validated for types in referenced files #2007

Open
1 of 4 tasks
deiteris opened this issue Jun 4, 2024 · 0 comments
Open
1 of 4 tasks

Annotations are not validated for types in referenced files #2007

deiteris opened this issue Jun 4, 2024 · 0 comments

Comments

@deiteris
Copy link

deiteris commented Jun 4, 2024

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant