cancel
Showing results for 
Search instead for 
Did you mean: 

Auto Mocking Plugin

Highlighted
New Member

Auto Mocking Plugin

Hello,

 

When I add in a Host and basePath, the Auto Mocking Plugin overrides this.

 

Is there anyway to stop this happening?

 

Regards,

Steve

2 REPLIES 2
Highlighted

Hi @steveconnolly 

Yes, you can do this by removing the Auto Mock integration from the API.  This is done on the integrations menu in the SwaggerHub editor.

Here are some documentation pages to help you:

https://app.swaggerhub.com/help/integrations/api-auto-mocking

https://app.swaggerhub.com/help/integrations/index

Hope that helps.

Regards,

Tim

Highlighted
Moderator

Hi Steve,

 

To prevent the host and basePath from being overwritten, disable the "Update host setting" option in API Auto Mocking settings. In this case, the API definition and "try it out" will point to your original host/basePath, but you can still make requests to the mock server using cURL, Swagger Inspector, or similar tools.

curl -X GET https://virtserver.swaggerhub.com/MyOrg/MyApi/1.0.0/<endpoint_path>

 

Alternatively, consider using OpenAPI 3.0 instead - in this case the mock server will be added as a separate entry in the servers list:

servers:
  - description: SwaggerHub API Auto Mocking
    url: https://virtserver.swaggerhub.com/MyOrg/MyApi/1.0.0

  - url: 'https://petstore.swagger.io/v2'

Helen Kosova
SmartBear Documentation Team Lead
________________________
Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
New Here?
Join us and watch the welcome video:
Announcements