Forum Discussion
Thanks for the solution - I have not tried this.
I can see it is possible to create an "On publish" integration when an API is published and then send to a WebHook.
From here it is a little vague for me what to do? Is it possible to setup a webhook listener on SwaggerHub which then can trigger a force publish on the Domain. If so - how do I know which Domain the API references - is this something that can be automatically set up - or do you see that as "manual" setup when creating the "On publish" integration (maybe as a header(s)?!?)
the webhook listener should not be deployed on the SwaggerHub VM. I would suggest a small Linux instance on the same sub-net.
there I would run a small node.js listener that accepts the POST from SwaggerHub and parses the json copy of the spec that is included in the POST payload.
the parsing would look for $refs that contain the “…/domain/…” url inductive of a domain reference. Parse out the domain location (organization), name and version contained the the url, then use either the swaggerhub cli or the SwaggerHub Registry Api to publish that domain/version. Repeat until the spec is completely parsed.
the node.js code to do this should be fairly simple, you’ll just need to be able to find the $refs that are remote anchors, then pick out the 3 sub-strings that describe the domain.