Search code examples
apirestmockingopenapi

How to extract RAML or OpenAPI spec from readme.io , mocking OpenAPISpec


I am tasked with consuming an endpoint hosted by client . They have exposed their API spec on readme.io ( looks like Swagger UI )

Their spec defines a POST endpoint that I need to call / invoke Being a post it has a Body with nearly hundred mandatory attributes

So I was thinking along these lines : #1 get the RAML / swagger / openAPI spec from readme.io #2 import this api spec file in some mocking tool like Sandbox

Then test my code to make calls to the mocked api

However what is blocking me is : #1 I cannot see any way to extract the API spec from readme.io where it has been hosted , how do I go about it ? #2 is there a mocking tool that would honour the contract defined in RAML / Swagger / OpenAPI spec ? ( things like required attributes , so mocking tool should send 400 responses if required fields are missing / null )

Sorry this is not really a code specific question , but more so related to SDLC and tooling Thank you


Solution

  • Apparently an undocumented feature, the openapi spec can be found under /openapi. It is either directly below the domain of the documentation or below the reference, e.g. https://docs.readme.com/main/openapi . According to the readme.io support, this is not necessarily the spec uploaded by the owner of the documentation, but might have been generated from a swagger spec or Postman collection. So your milage may wary.