spec icon indicating copy to clipboard operation
spec copied to clipboard

Unify all referencing mechanisms in v3

Open fmvilas opened this issue 3 years ago • 3 comments

Spin off from this conversation: https://github.com/asyncapi/spec/issues/663#issuecomment-1158094050.

Summary

We use different referencing mechanisms in the spec:

  • By name in components: SecurityRequirement Object
  • By name in servers: Channel.servers property
  • By using $ref: pretty much everywhere

This issue is to discuss if we should unify all of them and how.

fmvilas avatar Sep 01 '22 14:09 fmvilas

I'm in favor of using $ref everywhere possible. More details in https://github.com/asyncapi/spec/issues/663#issuecomment-1158094050.

fmvilas avatar Sep 01 '22 14:09 fmvilas

I agree. Having it unique would be a good idea. $ref looks for me as the best solution as well.

Contra:

  • $ref would allow illegal references
operations:
  sendUserSignedUp:
    action: send
    channel:
      $ref: '#/message/xyz' <--- should be /channel/ not /message/

But there for we have schema validator to point out mistakes like this.

Pro:

  • It is unique we not need to be use to handle multiple ways to solve the same problem
  • It is supported by most IDE. Your have jump marks and mouse over support
  • Be more like brother project OpenAPI

GreenRover avatar Sep 07 '22 08:09 GreenRover

let's do $ref but consistently everywhere

derberg avatar Sep 07 '22 15:09 derberg

I agree let's use $ref everywhere. Side effect this way makes it easier for tooling as well.

$ref would allow illegal references

That would almost always be the case (when using references) but as this is always caught by validators and parsers, I am not sure we can even say it's a con 😄

jonaslagoni avatar Sep 28 '22 14:09 jonaslagoni

/progress 60

PR is in place now: https://github.com/asyncapi/spec/pull/852.

fmvilas avatar Oct 13 '22 18:10 fmvilas

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

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 :heart:

github-actions[bot] avatar Feb 11 '23 00:02 github-actions[bot]

I cannot seem to find the changes in the parser, @fmvilas are you sure this change is complete?

I have the changes in for the spec https://github.com/asyncapi/spec/pull/852 and JSON Schema files https://github.com/asyncapi/spec-json-schemas/pull/316.

jonaslagoni avatar Mar 02 '23 11:03 jonaslagoni

Yes, it's missing. I created an issue here: https://github.com/asyncapi/parser-js/issues/746. Thanks for the pointer!

fmvilas avatar Apr 04 '23 08:04 fmvilas