Expose the swagger generation route(s) in the swagger.json with Swashbuckle - swashbuckle

I am trying to expose the routes which give back the swagger.json documents for an ASP.Net 6 web api, in the generated swagger.json itself.
I just need to see the swagger generation route used to generate the JSON document, alongside the other endpoints of my API.
I tried both app.UseSwagger and app.MapSwagger but the route template (containing the {documentName} token) never make its way to the Operations parsed by Swashbuckle.
How can I achieve this goal ?
Thx !

Related

WSO2 AM API DOCS - Is there a way to use swagger as API Documentation in DevPortal?

The company that i work for is developing an API to allow an integration with our applications. We're using WSO2 AM as our gateway. I hava to document the API and they want me to use WSO2 devportal to do so. But the problem is that they also wanna use Swagger to create this documentation. Is there a way to add Swagger in the API Docs?
One workaround would be, you can add document type of Markdown and add the swagger content as code.
So it can be viewed from Devportal as shown below:

How to programmatically generate a collection from an openAPI / Swagger endpoint?

Generating a Postman collection from an openAPI / Swagger documentation JSON file is already possible using the Postman API Client (a desktop app).
However, for purposes of programmatically modifying an existing collection using the NodeJs-based Postman SDK I'd like to be able to automate the process of generating a postman collection.
Whether that is via a command line tool (I haven't found any such tool), Postman API REST request (I haven't been able to find out how) or otherwise, does not really matter.
As long as it is possible to do without pressing a button in some app.
Is this possible at all?
Postman uses this module in the APP to convert from OpenAPI to a Postman Collection.
https://github.com/postmanlabs/OpenAPI-to-Postman
This should provide you with a programmatical way of doing this outside of the app.

how implement api that call some dependent api?

Suppose admin can add api that later user use this ,api but sometime 2 api that admin added could dependent together how to handle in backend that one of response in for example add to header other api and send request and all things shall is dynamic
thx
Check the wiring of the Url starting from the settings of the web application down to the API let them be able to talk to each other if the API is RESTful.

Mock ups in Mule Esb web services

I have some web service (CXF) on Mule Esb (3.4). At the current moment I try to find the simple way to set up web service response that I need for UAT. I read a lot of information in the internet and as I understood there is a special framework Munit for all types of testing. But, it seems, this framework is used for more complex things than I need. So, could anybody recommend me a simple way to force Mule Esb return predefined xml response. It will be fine if I create an xml response as xml document, upload it in any folder and Mule will send it as response when I call a web service. Thank you for any info for solving my task.
You could probably upload the example responses to the classpath and then, in your flows just load that file and set it as payload.
See this other stackoverflow question around how to accomplish this.
You could use 2 flows.
1 flow for production with the Webservice implementation and 1 flow for UAT testing which returns you just a predefined XML (for example via the http endpoint).
Put both files in a seperate file and make a mule-deploy.properties file for both UAT and Production where you include the corect flows respectivly.

Is it possible for Spring RESTful services to privde a WADL or something similar?

Situation:
We are planning to build a set of new services a long side a set of old SOAP (Spring, apache CXF) web services. Our customers are used to being able to use ?wsdl to get a wsdl describing a service and the content it will accept/return.
I'm looking at providing the new services via spring controllers and RESTful urls. However not all of a request can be handled via a RESTful url, so we still need to have a payload request and responses. I'm looking at use #RequestBody and #ResponseBody and spring's Message Converters to auto(magically) handle both XML and JSON content. The idea being to let spring do as much of the heaving lifting as possible.
The problem:
I'm trying to figure out if it's possible given the REST/Message converter concept, to be able to provide a description of a service and it's request/response data in a similar fashion to the ?wsdl request. I understand that there are WADL documents that can be generated by some systems, but they appear to be a proposel and not fully accepted yet.
Does anyone know if spring can generate WADLs or something else that I can use to allow clients to query the RESTful services data structures?
SpringMVC doesn't support WADL auto generation, mostly because it doesn't use the JSR-311 standard REST API.
I have create a blog entry with a simple WADL generation Controller in java :
Tuxgalaxy Blog Entry.
But Tomasz Nurkiewicz also provide a WADL generation Controller in scala :
nurkiewicz Blog Entry.
You could use CXF JAX-RS for your REST services since you're already using it for SOAP (you can even expose the same service as SOAP and REST with CXF), and CXF gives you the WADL that you want by adding ?_wadl&_type=xml
The following code will work with Spring REST 4x and its based on the suggested code by tuxgalaxy provided on below https://jira.spring.io/browse/SPR-8705
http://javattitude.com/2014/05/26/wadl-generator-for-spring-rest/