OAI / OpenAPI-Specification

The OpenAPI Specification Repository
https://openapis.org
Apache License 2.0
28.94k stars 9.07k forks source link

Reusable components across repo's in a service oriented architecture #3605

Closed aravindhbw closed 5 months ago

aravindhbw commented 8 months ago

In OpenAPI 3.0, I understand there is a way to create reusable components across files in the same repo and reference them using $ref. Curious if there is a way to host global components in a private repo which can be referenced across services in their own repos in a microservice world. Mainly for consistency and preventing redundancy. Any pointers would be really helpful.

SSYH commented 8 months ago

[like] s mhahn.com reacted to your message:


From: aravindhbw @.> Sent: Friday, February 23, 2024 8:43:30 PM To: OAI/OpenAPI-Specification @.> Cc: Subscribed @.***> Subject: [OAI/OpenAPI-Specification] Reusable components across repo's in a service oriented architecture (Issue #3605)

In OpenAPI 3.0, I understand there is a way to create reusable components across files in the same repo and reference them using $ref. Curious if there is a way to host global components in a private repo which can be referenced across services in their own repos in a microservice world. Mainly for consistency and preventing redundancy. Any pointers would be really helpful.

— Reply to this email directly, view it on GitHubhttps://github.com/OAI/OpenAPI-Specification/issues/3605, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AACMHLCNSXOBAIDAS6HGRS3YVD5PFAVCNFSM6AAAAABDXKGGYSVHI2DSMVQWIX3LMV43ASLTON2WKOZSGE2TCNZWHE2DSNA. You are receiving this because you are subscribed to this thread.Message ID: @.***>

handrews commented 8 months ago

@aravindhbw in theory, $ref can point to any resource with a URL. In practice, support for this can be inconsistent across tooling, so you should look into what your tools support. We are working on improving this in future releases, and on adding more info on this to learn.openapis.org.

handrews commented 5 months ago

I don't think there is a spec change to consider here, and it looks like my answer was acceptable enough, so I'm going to go ahead and close it. We are clarifying how referencing works in 3.0.4 and 3.1.1 which will be out in the next few months (ideally no later than July, but don't quote me on that). So if you want more guidance you can look at those works-in-progress.

Otherwise, if your tools don't support this, the answer is to lobby them to add support once 3.0.4 and 3.1.1 come out.

Please feel free to open a new issue if there is something specific you would like to see changed, or if I missed something here!