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

reference object throwing error in Studio #278

Closed
michael-j-oreilly opened this issue Feb 28, 2022 · 4 comments
Closed

reference object throwing error in Studio #278

michael-j-oreilly opened this issue Feb 28, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@michael-j-oreilly
Copy link

Describe the bug

I am receiving an error in studio when leveraging file paths as part of the reference object.

Offending yaml
- $ref: '../models/base-event.yaml#/components/schemas/BaseEvent'

Error shown
undefined is not an object (evaluating 'e.t0.errors[0]')

How to Reproduce

Leverage AsyncAPI studio to create the following schema (below)
Use a relative file path in the reference object.

But using studio or backstage.io to compile the html it throws the error above. Is there something I am not following or need to account for in these sorts of use cases?

It compiles fine using the generator

`asyncapi: 2.3.0
info:
title: Main App
version: 1.0.0
description: That old good app

channels:
client:
publish:
operationId: publishClient
message:
name: client
title: 'EOR Client'
description: 'Broadcasts create, update, and delete modifications to Customers.'
payload:
allOf:
- $ref: '../models/base-event.yaml#/components/schemas/BaseEvent'
- type: object
properties:
payload:
$ref: '../models/client.yaml#/components/schemas/Client'`

Expected behavior

Not to throw unclear error. Could look at graceful error handling/user experience maybe. Is it bad practice to divide or organise schemas internally this way?

@michael-j-oreilly michael-j-oreilly added the bug Something isn't working label Feb 28, 2022
@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.

@magicmatatjahu
Copy link
Member

magicmatatjahu commented Feb 28, 2022

@michael-j-oreilly Hi! As I see you are using the local reference to the file and atm we don't support that because we do not have access to the filesystem in the browser. backstage is also a web app, so it should also won't work, but you can create issue for that in the backstage repo.

Not to throw unclear error. Could look at graceful error handling/user experience maybe. Is it bad practice to divide or organise schemas internally this way?

We are using underneath the 3rd package to resolve all reference (to make pure JSON with all data) but sure, we should improve that output errors. Could you create feature request for that in the https://github.com/asyncapi/parser-js/issues repo? I would appreciate it.

When we will support that #195 we can thinking how to handle local file system :)

Do you want to add something?

@michael-j-oreilly
Copy link
Author

Thanks @magicmatatjahu for the quick response, really appreciated. That makes sense. I will reach out to the backstage repo with the bug and get that on their radar as well. I will also enter a feature request as advised.
Not sure on handling the local-file system, I guess we would need to look at approaches to parsing directories. I will defer to you guys the experts on this one :)
I will close this ticket.
Thanks,
Michael.

@aykonsvk
Copy link

any updates on this?

KhudaDad414 pushed a commit to KhudaDad414/studio that referenced this issue Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants