Forum Discussion

jshier's avatar
Occasional Contributor
6 years ago

Custom Response Examples vs. ref examples

I have a spec that has several different calls that return the same type of object. However, we need the different calls to return the object with slightly different values (e.g. one status field). However, a ref + example field has a warning, and just an example by itself returns nothing, I'm guessing due to the fact that the response isn't otherwise defined. Is there any way to accomplish what I want here with defining different refs for each object with a particular value?

2 Replies

  • jshier's avatar
    Occasional Contributor

    Looks like my spec had the example at the same indentation as the $ref, and it needed to be one level higher. Once that change was made, the mock service properly returned the new example. Perhaps this is an additional validation that should be made?

    • MarcusJ's avatar



      If no error was thrown doing this, then yes this should be an additional validation check added to the editor.  Do you have a spec you can share that shows this?  If so you can attach the file to this post or share the link.  If it is private please make swaggerhub-support a collaborator in SwaggerHub.





      SmartBear Support