Open JorisZwaenepoel opened 8 years ago
The documentation is generated on the fly directly from your implementation so u should see it update along with your code. Have you confirmed that your actual API changes have taken effect - maybe there's a deployment issue or some caching going on
Swashbuckle reflects WebAPI's API Explorer, which in turn depends on proper naming conventions to discover Controllers. You mentioned you changed the name of the Controller - make sure it still has the suffix "....Controller". I once had a dev spend 3 days figuring out why "OptionsContoller" wasn't getting discovered.
I can confirm that the updated service is deployed and works correctly using the new route, but the swagger UI still shows the original API (and using the "Try it out!" button results in a 404 Response Code (Not Found).
Also, the title on the swagger page still shows "A title for your API" instead of the string that is currently in the code.
I tried this with a completely new project and have the same issue there.
This is the case when I run the service locally on IIS Express and on the Azure server.
I can update the reported API, if I modify the version that I give as a parameter in SingleApiVersion. Do I really need to update that version every single time I add or modify a controller?
Is there documentation available where I can learn how to use swashbuckle? What is WebAPI's API Explorer?
ApiExplorer is a class in System.Web.Http.Description that Swashbuckle leverages to discover the APIs to be documented.
That being said, would you be able to elaborate a tad on how your configuration is wired up ? There are a few things that come into play depending on your configuration/startup/deploy strategy:
Now, you mentioned earlier that you tried this on both IIS and Azure. How is your application startup code invoked in each instance ?
It could be that because of incorrect wiring up of the Swagger initialization code with your application startup code, the swagger config is not running every single time, instead running only when you force a change in the config code (that you essentially did by "changing the version"). That is just a thought, and arguably still a shot in the dark without understanding your application startup strategy completely.
Also, HttpConfiguration config = new HttpConfiguration()
- you may want to verify if that instance of config is being wired up properly with the global configuration.
I think this is a bad case of application cache, I had the same issue earlier this year - turned out to be the application cache serving the same old code no matter what i did.
@JorisZwaenepoel - did any of the above suggestions work for you. The behavior you're seeing is definitely unexpected and something I'm unable to repro. There has to be something strange (likely some for of caching) going on with your specific setup.
I'll chime in here rather than creating a new thread. I'm having a very similar issue to what is described about. In an attempt to resolve I added a custom index.html and had that print the current assembly version and what I'm seeing is that Swagger is always 1 version behind the deployed version (my CI server updates the assembly version#). This may well be a separate issue to what @JorisZwaenepoel is describing, but thought it was worth adding to the conversation.
Note: this doesn't happen locally if I run with IIS Express
I've run into this issue on my machine, the issue is with IIS. An iisreset
from the command console reset things for me.
When my project setting in VS 2013 for Web
was set to Local IIS
I ran into this caching issue, but changing to IIS Express
changed the behavior.
I've solved the error by allowing the release configuration to generate the xml file that swagger uses to generate the JSON that will fulfill our UI, by the way I am using Asp.Net core.
If you're on a farm... make sure that your server replication is setup correctly. This was the issue for me.
Is there any solution
I just ran this issue on my backend application. The techs I'm using are: Typescript, Express, Nginx, and Cloudflare as my DNS Records management as well as Caching. I was bamboozled since no matter what I did, the swagger docs simply wouldn't change on prod, and after many trial and error to find what's the culrpit. Btw, I am using swagger-jsdoc v6.2.8 and swagger-ui-express v5.0.1.
I managed to fix it by sequentially doing these:
I am not sure yet whether I needed to do everything or I could simply skip steps (e.g. skipping step one). I hope this might help anyone that encounter this annoying issue in the future. cheers.
Hi,
I am a beginner with Azure services and created a service with multiple tablecontrollers + 1 apicontroller. I added swashbuckle.core to the project and I can use the swagger UI to look at my (currently just 1) API function and test it from the browser, which was my main reason to install swashbuckle.
Now I modified the API by changing the name of the controller, and adding a route attribute. However, those changes are not reflected in the swagger UI.
What do I need to do to see the actual API instead of the initial one? Where can I find documentation or a tutorial on how to use swashbuckle?
Thanks,
Joris