cancel
Showing results for 
Search instead for 
Did you mean: 

Troubleshooting Mock API Generation Failure

SOLVED
Highlighted
Occasional Contributor

Troubleshooting Mock API Generation Failure

I'm currently building an OpenAPI3 spec and trying to get the mock service to work with it. Unfortunately I'm constantly getting an integration failure from the mock API. All it says is to check the validity of the spec, which the UI says is valid. Is there any way I can troubleshoot this or get better diagnostics?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Moderator

Re: Troubleshooting Mock API Generation Failure

Thanks for sharing your spec! Please see the notes below.

 

1) $refs need / after #:

# wrong
$ref: '#components/schemas/ModelName'

# correct
$ref: '#/components/schemas/ModelName'

 

2) Some paths have parameters defined directly under the path rather than inside operations. While this is valid syntax, the mock currently cannot handle it. This is a known issue and the devs are working on a fix. For now, please move the parameters inside operations as a workaround.

/v....../{id}:
# Don't put the parameters here #parameters: # - $ref: '#/components/parameters/...' get: ...
# Put them here for now
parameters:
...

 

Other than that, your spec looks OK.

 

After you make the changes, either save the spec again or trigger the mock manually from the integrations list.

 

Let me know if this helps.


Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

7 REPLIES 7
Highlighted
Moderator

Re: Troubleshooting Mock API Generation Failure

Hi jshier,

 

Could you please post a link to your spec, so that support could have a look? Or if it's private, please share it with the swaggerhub-support user.

 

Thanks!


Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Highlighted
Occasional Contributor

Re: Troubleshooting Mock API Generation Failure

It is private, so I've shared with swaggerhub-support.

Highlighted
Moderator

Re: Troubleshooting Mock API Generation Failure

Thanks for sharing your spec! Please see the notes below.

 

1) $refs need / after #:

# wrong
$ref: '#components/schemas/ModelName'

# correct
$ref: '#/components/schemas/ModelName'

 

2) Some paths have parameters defined directly under the path rather than inside operations. While this is valid syntax, the mock currently cannot handle it. This is a known issue and the devs are working on a fix. For now, please move the parameters inside operations as a workaround.

/v....../{id}:
# Don't put the parameters here #parameters: # - $ref: '#/components/parameters/...' get: ...
# Put them here for now
parameters:
...

 

Other than that, your spec looks OK.

 

After you make the changes, either save the spec again or trigger the mock manually from the integrations list.

 

Let me know if this helps.


Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

Highlighted
Occasional Contributor

Re: Troubleshooting Mock API Generation Failure

Fixing those issues made the mock API work, thanks. In addition to the fixes for the mock server on that second point, I hope you're also tracking improvements to the editor's validator to catch these issues as well as for the error presentation for the mock API integration.

Highlighted
Staff

Re: Troubleshooting Mock API Generation Failure

Hi jshier,

 

We are working on improvements to the validator - we work closely with the open source team and we might be able to fix this directly there. Thank you for taking the time to write and sorry we didn't catch it on the spot. The auto mocking issue has been fixed. We expect to deploy it around Jan 26th.

 

On another note, we are interviewing customers for improvements in the editor, including how to improve the validation errors and how they are displayed. Would you be available for a quick call with us? We'd really appreciate it. You may use this link to schedule a date/time when it's most convenient: https://calendly.com/swaggerhub-editor-team/swaggerhub-editor-usability

 

Thanks,
Fernando

Highlighted
Occasional Contributor

Re: Troubleshooting Mock API Generation Failure

Highlighted
Moderator

Re: Troubleshooting Mock API Generation Failure

Hi jshier,

 

Just a quick update - the fix for path-level parameters was deployed yesterday, so the workaround is no longer needed.


Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements