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

Cannot retrieve RAML annotations applied to Library #779

Closed
1 of 4 tasks
kdubb opened this issue Dec 17, 2020 · 6 comments
Closed
1 of 4 tasks

Cannot retrieve RAML annotations applied to Library #779

kdubb opened this issue Dec 17, 2020 · 6 comments

Comments

@kdubb
Copy link

kdubb commented Dec 17, 2020

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?

RAML Library level annotations are lost or inaccessible after parsing. API's add the annotation(s) to the root encoded object in EncodesModel.encode.

  • 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.
    Given the following RAML library example...
#%RAML 1.0 Library
uses:
  gen: ../generator.raml

(gen.javaModelPackage): io.test.lib

types:

  Test:
    type: object
    properties:
      value: string

There is no way to retrieve the javaModelPackage annotation. On an API (aka Document) there's and EncodesModel trait and the annotation is applied to the root of the encoded model. With a Library there is no way to retrieve the top level annotation.

Note that generator.raml just defines some annotations for generating code.

  • What is the expected behavior?

It should be possible to retrieve the annotations from Library & Fragment modules as well.

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

  • Please tell us about your environment:

    • AMF Version: 4.5.1
    • AMF Distribution: JVM or JS
    • Operating System: macOS
    • Link to your project:
  • Other information (e.g. detailed explanation, stack traces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, Gitter, etc)

@kdubb
Copy link
Author

kdubb commented Dec 18, 2020

A "proper" solution might be adding a customDomainProperties to BaseUnit where top-level annotations are available for all RAML module types.

@looseale
Copy link
Contributor

Hi @kdubb .
You are right, the spec allows that function and currently the annotations in the root level are missing because they don't have a place in the current library model (Module).
I created the internal ticket https://www.mulesoft.org/jira/browse/APIMF-2769 to check this. We will keep you informed of any news.

@kdubb
Copy link
Author

kdubb commented Dec 22, 2020

I'm willing to contribute a PR if you can point me in the right direction. We're moving from the old RAML parser and this is a blocking issue for us.

@kdubb
Copy link
Author

kdubb commented Dec 22, 2020

@looseale Also, it's worth noting that although the 3.0 OpenAPI spec only allow "extensions" on certain elements... all the notable parser implementations seem to allow extension nearly everywhere; specifically on document root and schema items.

@kdubb
Copy link
Author

kdubb commented Jan 14, 2021

@looseale Any thoughts on when this might be fixed or how I can help get this started?

@tomsfernandez
Copy link
Contributor

Hi @kdubb. This issue was resolved in #817. It will be available on the release of AMF's next version next week.

Thanks for raising the issue.
With the merged PR I'm closing the issue.

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

3 participants