swagger

Springfox Swagger 'Whitelabel Error Page' :com.google.common.base.Predicate cannot be resolved

假如想象 提交于 2019-12-11 07:06:22
问题 I am trying to use the swagger-ui for the rest services. I have a swaggerconfig class as follows. @Configuration @EnableSwagger2 public class SwaggerConfig { @Bean public Docket api(){ return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) .select() .paths(PathSelectors.regex("\\.*")) .build(); } @SuppressWarnings("deprecation") private ApiInfo apiInfo() { return new ApiInfoBuilder() .title("Spring REST Sample with Swagger") .description("Spring REST Sample with Swagger")

How to display object properties as separate fields in Swagger UI?

和自甴很熟 提交于 2019-12-11 07:05:51
问题 I am writing API documentation using OpenAPI 3.0. At the moment I have: paths: /script/update: post: tags: - "Script" summary: Update a script operationId: updateScript responses: '200': description: OK "404": description: Not Found requestBody: description: A script object in order to make the request required: true content: application/x-www-form-urlencoded: schema: type: object properties: subsite_id: type: string script: type: object properties: script: $ref: '#/components/schemas

Add a newline to swagger output

限于喜欢 提交于 2019-12-11 06:50:09
问题 I am using swagger-jersey2-jaxrs version 1.5.15 . I am on swagger-ui 3.0.9 . I added a description to a header using @SwaggerDefinition annotation and tags (as the description parameter is now deprecated). The code goes like: @Api(tags = { "Hello World" }) @SwaggerDefinition(tags = { @Tag(name = "Hello World", description = "Description about world: " + " \n" + "1. Hello " + "\n" + "2. World " + "<br>" )}) By using this, I was able to add a description to the "Hello World" header. My question

Swashbuckle Swagger generate an actual guid

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 06:47:12
问题 I am using Swashbuckle to generate Swagger in my .Net Core WebAPI project. As you can see below, it generates a GUID of type string. I would like to generate a random Guid and replace "string" with "" or an empty guid "00000000-0000-0000-0000-000000000000". This would allow my example to actually work when I post it. { "payload": [ { "GUID": "string", "status": "string" } ] } while I am at it, would it be possible to the same with any string so that JSON is different each time? 回答1: Decorate

BigDecimal as String in Swagger defenition

核能气质少年 提交于 2019-12-11 06:39:38
问题 I would like to define an object with BigDecimal as String in swagger.json Right now I can do "MyObject": { "type": "object", "properties": { "amountOfMoney": { "type": "string", "pattern": "d+([.]d+)?" }, "name": { "type": "string" } }, "title": "MyObject" } Another way, I can Define amountOfMoney as a number. "MyObject": { "type": "object", "properties": { "amountOfMoney": { "type": "number" "minimum": 0.0, "maximum": 100.0, "exclusiveMinimum": false, "exclusiveMaximum": false }, "name": {

Object array rendered as empty array in Swagger UI

为君一笑 提交于 2019-12-11 06:39:11
问题 I have the following model definitions in an OpenAPI/Swagger spec: "definitions": { "models.Equipment": { "title": "Equipment", "type": "object", "properties": { "Features": { "type": "array", "items": { "$ref": "#/definitions/models.Feature" } }, "Id": { "type": "integer", "format": "int64" }, "IdType": { "type": "string" }, "Name": { "type": "string" }, "Price": { "type": "integer", "format": "int32" } } }, "models.Feature": { "title": "Feature", "type": "object", "properties": {

Swagger create API document: Swagger Editor

淺唱寂寞╮ 提交于 2019-12-11 06:34:52
问题 I am using swagger for documenting my REST API service. I have an specific input that I provide to the service. I am creating YAML code by myself using swagger editor. The issue I am facing is I am not able to get the input type as XML, it by default takes JSON. Is there any issue in my yaml code. The code is given below: swagger: "2.0" info: title: Order Update to Dealers description: API description in Markdown. version: 1.0.0 host: #Host name cannot be specified here basePath: /api

Swagger not working on Azure Web app running as OWIN

十年热恋 提交于 2019-12-11 06:29:51
问题 I have a ASP.NET Web API implemented as OWIN middleware. I hosted it on azure and now I have a problem using swagger. It is perfectly working on localhost but when I try it on azure I get this: The way I did my configuration for swagger on the API was to completely remove SwaggerConfig.cs file and add all the configuration into my Startup.cs class as shown here: How to generate documentation using swashbuckle for WebApi 2 with Owin . If it is going to help, I am trying to implement oAuth2

Automatically generate default 200 OK response while specifying other response types

最后都变了- 提交于 2019-12-11 06:22:38
问题 According to #216, Swashbuckle will automatically generate a 200 success response as the default behavior, or otherwise expects all response types to be specified. I'd like to be able to add a 404/400 error response to some endpoints in the XML comments while keeping the 200 success responses for all endpoints, including those with a 404/400 error response. Is it possible to make Swashbuckle continue to automatically generate a 200 success response for all endpoints even when an error

Why do I get 404 when running Flask app on 0.0.0.0

£可爱£侵袭症+ 提交于 2019-12-11 06:21:11
问题 I am testing my Flask app on AWS EC2 instance (Ubuntu). Main app: from sonip.api.factory import create_app app = create_app() def main(): app.run(debug=True, threaded=True) if __name__ == "__main__": main() The actual set up of the Flask app is done in a factory including registering blueprint , etc. def create_app(): app = Flask(__name__) app.config['SERVER_NAME'] = settings.FLASK_SERVER_NAME app.config['SWAGGER_UI_DOC_EXPANSION'] = settings.RESTPLUS_SWAGGER_UI_DOC_EXPANSION app.config[