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

v1.10.6 does not support absolute path in $ref #797

Closed
dvemnt opened this issue Jun 13, 2023 · 12 comments
Closed

v1.10.6 does not support absolute path in $ref #797

dvemnt opened this issue Jun 13, 2023 · 12 comments
Labels
bug Something isn't working stale

Comments

@dvemnt
Copy link

dvemnt commented Jun 13, 2023

Describe the bug

The latest version of the parser does not support referencing by absolute path. It works in version 1.9.18.

How to Reproduce

  1. Create Async API doc file with absolute path $ref and file on this path in same folder.
  2. Try to build using HTML template.
asyncapi: "2.4.0"
defaultContentType: application/json

info:
  title: Test Absolute Path
  version: "1.0.0"

channels:
  TestOperation:
    publish:
      message:
        $ref: "/absolute-path/File.yaml"

Expected behavior

Done! ✨
Check out your shiny new generated files at ...

Actual behavior

Something went wrong:
Error: Input is not a corrent AsyncAPI document so it cannot be processed.
    at Generator.generateFromString (/usr/local/lib/node_modules/@asyncapi/generator/lib/generator.js:264:19)
    at async /usr/local/lib/node_modules/@asyncapi/generator/cli.js:157:9
Errors:
[
  {
    "code": "invalid-ref",
    "path": [
      "channels",
      "TestOperation",
      "publish",
      "message",
      "$ref"
    ],
    "message": "ENOENT: no such file or directory, open '/absolute-path/absolute-path/File.yaml'",
    "severity": 0,
    "range": {
      "start": {
        "line": 11,
        "character": 14
      },
      "end": {
        "line": 11,
        "character": 40
      }
    },
    "source": "/absolute-path/asyncapi.yaml"
  }
]

@dvemnt dvemnt added the bug Something isn't working label Jun 13, 2023
@github-actions
Copy link

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@amelluk
Copy link

amelluk commented Jun 15, 2023

duplicate of asyncapi/generator#963 - I have the same problem :/

@dvemnt
Copy link
Author

dvemnt commented Jun 15, 2023

duplicate of asyncapi/generator#963 - I have the same problem :/

I don't think that's duplicate. asyncapi/generator#963 is about the spec and unsupported place for reference, here is about paths handling.

@eivindga
Copy link

eivindga commented Jun 19, 2023

As far as I understand, the spec does no longer allow absolute paths in references?

See also:
#405

@dvemnt
Copy link
Author

dvemnt commented Jun 19, 2023

As far as I understand, the spec does no longer allow absolute paths in references?

Looks like, the spec still allow absolute paths in references, but generator (or parser) handles such paths in wrong way, as local paths, I think.

@derberg
Copy link
Member

derberg commented Jul 3, 2023

sorry but I'm unable to replicate your issue. I created a file that you shared and all was good.

I also opened a PR to show tests with different local references work asyncapi/generator#1003

on message level references should and were always possible.

As far as I understand, the spec does no longer allow absolute paths in references?

not sure where you got this message from, but spec is definitely still supporting $ref in message object

@dvemnt
Copy link
Author

dvemnt commented Jul 3, 2023

Hi, @derberg.
I don't see absolute references in your PR, only relative references (here and here). And my issue still reproduces.

Screenshot from 2023-07-03 16-53-22

@derberg
Copy link
Member

derberg commented Jul 3, 2023

you're right, sorry, I misunderstood your initial example.

yes, I can replicate this problem. It is for sure something that should work, and worked before

As a workaround, add file: to the reference. And I'm moving this issue to parser repo, as it is bug in the repo, and not even the repo but the fact there was a move to another reference parser tool that do not work as expected: https://github.com/stoplightio/json-ref-resolver. So apparently some regression was introduced in functionality

@derberg derberg transferred this issue from asyncapi/generator Jul 3, 2023
@github-actions
Copy link

github-actions bot commented Jul 3, 2023

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

Copy link

github-actions bot commented Nov 1, 2023

This issue has been automatically marked as stale because it has not had recent activity 😴

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience ❤️

@github-actions github-actions bot added the stale label Nov 1, 2023
@derberg
Copy link
Member

derberg commented Dec 18, 2023

I think the issue is still there

Copy link

This issue has been automatically marked as stale because it has not had recent activity 😴

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience ❤️

@github-actions github-actions bot added the stale label Apr 17, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests

4 participants