swagger

Can we set global “consumes” and “produces” in Swagger?

牧云@^-^@ 提交于 2020-01-14 14:04:06
问题 In the each path I need to set consumes and produces . Can I set them globally? post: summary: "" description: "" consumes: - "application/json" - "application/xml" produces: - "application/xml" - "application/json" 回答1: Sure. You can specify consumes and produces on the root level of the spec, and they will be inherited by all operations. Global consumes and produces can be overridden on the operation level if needed. consumes: - application/json - application/xml produces: - application/xml

Swagger Yaml schema definition for object without a fixed property list

…衆ロ難τιáo~ 提交于 2020-01-14 13:33:31
问题 I am implementing an API-first application with the help of Swagger. One of the most important objects to be returned is a DICOM object, which returns a collection of attributes with flexible names, for example: { "00080005": {"vr":"CS","Value":["ISO_IR 100"]}, "00080020": {"vr":"DA","Value":["20160602"]}, "00080030": {"vr":"TM","Value":["171855.7490"]}, "00080050": {"vr":"SH","Value":["1234"]}, "00080090": {"vr":"PN","Value":[{"Alphabetic":"Parikh MD^Anush^M"}]} } So I cannot know the name

In Swagger, how to define an API that consumes a file along with a schema parameter?

偶尔善良 提交于 2020-01-14 09:38:54
问题 I am trying to use Swagger to define an API that accepts an actual file and a schema object that describes the contents of a file. Here is a snippet of the Swagger YAML. However it won't validate in the Swagger Editor. /document: post: summary: Api Summary description: Api Description consumes: - multipart/form-data parameters: - name: documentDetails in: formData description: Document Details required: true schema: $ref: '#/definitions/Document' - name: document in: formData description: The

Set one ProducesResponseType typeof for several HttpStatusCodes

心已入冬 提交于 2020-01-14 08:32:35
问题 I am setting the ProducesResponseType so as to have it documented with Swagger. If the response is succesful (OK => 200), then it produces a IEnumerable. [ProducesResponseType(typeof(IEnumerable<MyModel>), 200)] But when I get an exception, I catch it, and then generate an object of my custom APIError class. When I populate the object, I can set different HttpStatusCodes, but in the end, what I want is to be able to set that ProducesResponseType is my APIError class for all the remaining

Set one ProducesResponseType typeof for several HttpStatusCodes

China☆狼群 提交于 2020-01-14 08:32:12
问题 I am setting the ProducesResponseType so as to have it documented with Swagger. If the response is succesful (OK => 200), then it produces a IEnumerable. [ProducesResponseType(typeof(IEnumerable<MyModel>), 200)] But when I get an exception, I catch it, and then generate an object of my custom APIError class. When I populate the object, I can set different HttpStatusCodes, but in the end, what I want is to be able to set that ProducesResponseType is my APIError class for all the remaining

Set one ProducesResponseType typeof for several HttpStatusCodes

巧了我就是萌 提交于 2020-01-14 08:32:03
问题 I am setting the ProducesResponseType so as to have it documented with Swagger. If the response is succesful (OK => 200), then it produces a IEnumerable. [ProducesResponseType(typeof(IEnumerable<MyModel>), 200)] But when I get an exception, I catch it, and then generate an object of my custom APIError class. When I populate the object, I can set different HttpStatusCodes, but in the end, what I want is to be able to set that ProducesResponseType is my APIError class for all the remaining

Swagger HK2 service reification failed

瘦欲@ 提交于 2020-01-14 07:46:08
问题 This application use Swagger (swagger-jersey2-jaxrs, 1.5.18), Spring-boot (spring-boot-starter-jersey, 2.0.1.RELEASE) and Java 9. When application ran Swagger UI loads without an issue. But I can see following warning in the logs. Appreciate any idea to solve this. I have tried upgrading versions but couldn't help. 2018-04-17 14:27:19.792 WARN 24810 --- [nio-7070-exec-5] org.glassfish.jersey.internal.Errors : The following warnings have been detected: WARNING: HK2 service reification failed

How to change controller's name in swagger-ui?

↘锁芯ラ 提交于 2020-01-14 06:49:08
问题 if I have the following: MySimpleTestController : ApiController { } Is it possible to have the controller name appear as "My Simple Test" instead of "MySimpleTest" in the generated API docs? I did a search but I mostly found ways to do it in Java using an @Api annotation but I am using C# (.net 4.5.2). Here is one way to do it but it requires adding an annotation to every single route in the Controller which would be cumbersome as my controller has many routes. Is there a better way? 回答1:

Swagger single interactive html [closed]

。_饼干妹妹 提交于 2020-01-13 19:26:10
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago . I'm trying to make a single html with the try out button. The swagger-code gen nor the swagger-ui gives me that result. Do you have any suggestion? 回答1: You can try changing Swagger UI into "one big messy HTML file" as follows: Download Swagger UI (link to the latest master). Go to the dist folder.

swagger UI is not showing anything in webapi

十年热恋 提交于 2020-01-13 10:04:38
问题 I followed this up to the xml doc part in order to create Swagger documentation using Swashbuckle. It should allow me to view the endpoints via (in my case): http://localhost:51854/swagger/ui/index Unfortunately, I cannot see any endpoints: Any ideas why and how to fix this? Please note that I created my webapi from an empty webapi project - maybe that's the problem. Something must be missing but I am not sure what ... I have now identified the following code as the root cause. In Global.asax