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

Avro $ref, documentation and parser #414

Closed
safetytrick opened this issue Jul 17, 2020 · 16 comments
Closed

Avro $ref, documentation and parser #414

safetytrick opened this issue Jul 17, 2020 · 16 comments

Comments

@safetytrick
Copy link

The $ref in the Avro documentation is misleading:

https://www.asyncapi.com/docs/specifications/2.0.0/#message-object-example

Specifically:

"$ref": "path/to/user-create.avsc#/UserCreate"

An Avro schema doesn't have this kind of structure, instead the UserCreate record would be represented at this path (jsonpath syntax):

$.types.[?(@.name=='UserCreate')]

Example Avro schema for reference:

https://github.com/spring-cloud/spring-cloud-schema-registry/pull/41/files#diff-f84d47e6ddc1b7ccd0d9fb0bcbae8a3dR4

Expected behavior
The docs should be updated to remove this misleading reference and probably explain the state of the Avro support here (References to elements within an Avro schema aren't possible due to the difference in structure between Avro and asynapi)

@github-actions
Copy link

Welcome to AsyncAPI. Thanks a lot for reporting your first issue.

Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity 😴
It will be closed in 30 days if no further activity occurs. To unstale this issue, add a comment with detailed explanation.
Thank you for your contributions ❤️

@github-actions github-actions bot added the stale label Sep 16, 2020
@derberg derberg removed the stale label Sep 16, 2020
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity 😴
It will be closed in 30 days if no further activity occurs. To unstale this issue, add a comment with detailed explanation.
Thank you for your contributions ❤️

@github-actions github-actions bot added the stale label Nov 16, 2020
@derberg derberg removed the stale label Nov 16, 2020
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity 😴
It will be closed in 60 days if no further activity occurs. To unstale this issue, add a comment with detailed explanation.
Thank you for your contributions ❤️

@github-actions github-actions bot added the stale label Jan 16, 2021
@derberg
Copy link
Member

derberg commented Jan 18, 2021

@safetytrick you mean it should be "$ref": "path/to/user-create.avsc#/$.types.[?(@.name=='UserCreate')]"?

@derberg derberg removed the stale label Jan 18, 2021
@fmvilas fmvilas added this to the AsyncAPI specification 2.1.0 milestone Jan 31, 2021
@github-actions
Copy link

github-actions bot commented Apr 2, 2021

This issue has been automatically marked as stale because it has not had recent activity 😴
It will be closed in 60 days if no further activity occurs. To unstale this issue, add a comment with detailed explanation.
Thank you for your contributions ❤️

@github-actions github-actions bot added the stale label Apr 2, 2021
@derberg derberg removed the stale label Apr 2, 2021
@fmvilas fmvilas removed this from the Next specification version milestone May 12, 2021
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity 😴
It will be closed in 60 days if no further activity occurs. To unstale this issue, add a comment with detailed explanation.
Thank you for your contributions ❤️

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity 😴
It will be closed in 60 days if no further activity occurs. To unstale this issue, add a comment with detailed explanation.
Thank you for your contributions ❤️

@github-actions github-actions bot added the stale label Sep 11, 2021
@derberg derberg removed the stale label Sep 13, 2021
@github-actions
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 Jan 12, 2022
@derberg
Copy link
Member

derberg commented Jan 12, 2022

@safetytrick is this still something you are interested with?

@github-actions github-actions bot removed the stale label Jan 13, 2022
@github-actions
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 May 14, 2022
@github-actions github-actions bot removed the stale label Jul 30, 2022
@VladT86
Copy link

VladT86 commented Aug 1, 2022

Hi @derberg

I'm having a similar issue while trying to parse an avro schema containing more objects definitions. What is the proper syntax to select one of the objects from the avsc file that has attributes of other object types defined in the same avsc file?

Thanks

@derberg
Copy link
Member

derberg commented Aug 16, 2022

@dalelane @M3lkior hi folks, did you try more complex references to Avro files? you have some examples?

@dalelane
Copy link
Collaborator

My interpretation of this, and how I've been using it, was that the $ref specifies

  • location of the schema file
  • fully-qualified name of the record in the schema file
    (separated by #/)

(And I only include the name of the record where the schema file contains more than one record - typically, I try to keep the avsc file containing a single definition, and in those cases I would just point the $ref at the avsc file without additional qualification).

But, in the rare occasions where I need to point at an avsc file containing multiple records, such as the example specified I would've written

"$ref": "path/to/user-create.avsc#/org.springframework.cloud.schema.avro.User1"

I hadn't considered using jsonpath to identify where in the avsc file the schema lives - I've just fully-qualified the name of the schema I want to use, as this is consistent with how I reference other Avro schemas within an Avro schema file.

But I've been using this for user-readable documentation purposes, and haven't yet tried running this through the parser to see what it would do.

@dalelane
Copy link
Collaborator

FYI - There is also a related discussion about being more consistent with JSON schema in how we use $ref in #649

@github-actions
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 Oct 29, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants