Adding New Controllers Not Showing in UI
Currently, I have 4 controllers/categories on my UI ready and working. However, I have 7 controllers in my folder. The expectation is to have them show up, along with the others, in the screenshot above. I can't figure out why they aren't showing. Even the JSON view isn't picking them up. I've built and rebuilt the project but to no avail. Any ideas?SolvedSwagger $ref won't work
Hey, I started to use swagger with swagger-ui-express andswagger-jsdoc to autodocument my existing api, which is written with nodejs and express (like described here -example).I came across a problem when I tried to add a $ref to an existing json schema file (that sits inside my project on the same directory as all my js files) on my annotation. My directory looks like this - And my annotation looks like this - /** * @swagger * /testing: * get: * description: This should show the json schema * responses: * 200: * description: "successful operation" * schema: * $ref: "schema.json" */ I wrote the local path(as writen above) and theabsolute path, tried to use #, using many syntaxes and nothing worked, i keep geting the same error - Resolver error at paths./testing.get.responses.200.schema.$ref Could not resolve reference: Tried to resolve a relative URL, without having a basePath. path: 'schema.json' basePath: 'undefined' I looked the problem up online and couldn’t find any clear answer. I saw a solution that suggested I should put my schema on a server and access it with an url address and I prefer not to do it on this point. Also, atsome point I put the scheme into a variable and then put it in the $ref and it worked. The only problem was that the scheme included some inner refs to element in the same file and swagger didn’t even resolved those. Is there a way to work with $ref in swagger-ui-express? Thank you 😊How to express an array in a swagger definition
How can I express an array of objects in a defition. Here's the sample json { "resourceType": "Patient", "extension": [{ "url": "http://hl7.org/fhir/StructureDefinition/us-core-race", "extension": [{ "url": "ombCategory", "valueCoding": { "system": "http://hl7.org/fhir/v3/Race", "code": "2106-3", "display": "White" } }] }, { "url": "http://hl7.org/fhir/StructureDefinition/us-core-ethnicity", "extension": [{ "url": "ombCategory", "valueCoding": { "system": "http://hl7.org/fhir/v3/Ethnicity", "code": "2135-2", "display": "Hispanic or Latino" } }] } ] }SolvedHow to remove/hide body parameter from Swagger UI in file upload API
Hello, I'm newbie to swagger UI development using jersey framework. I'm looking out for the resolution for below mentioned issue. Issue: Unable to remove/hide body parameter from Swagger UI Please find my Java source code: @POST @Path("/createSchedule") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces({ MediaType.APPLICATION_JSON }) @ApiOperation(httpMethod = HttpMethod.POST, value = "Create a new export schedule(s)") @ApiImplicitParams({ @ApiImplicitParam(name = "file", value = "Upload the template (.xlsx) to create schedule(s).", required = true, dataType = "file", paramType = "formData") }) public Response createSchedule(@FormDataParam(value="file") InputStream inputStream, @FormDataParam(value="file") FormDataContentDisposition fileMetaData) throws ScheduleException { } I have used Jersey 2.29.1(jersey-container-servlet) & Swagger 1.5.0 (swagger-jaxrs) API's. Also do let me know how to allow only specific file extensions (like .xlsx) to upload from swagger ui. Thanks in advance! Cheers!Solved15KViews0likes2CommentsHow to hide Model Information
I described Schema information like below in my swagger.yaml. I want to show the only B to Swagger UI. But, this will also show A. How to hide A from Swagger UI? components: schemas: B: allOf: - type: object properties: bbb: type: string - $ref: '#/components/schemas/A' A: - type: object properties: aaa: type: stringSolvedEnum of defined objects
Hello, I'm not sure if this is the right board but I want to define a property of a definition which should have a value from an enum but this enum is of object type. And its values should be of other definitions ($ref). The problem is, that the enum values are not shown in the presentation of the swagger. Is it only to be possible to make a description or is there another possibility? I attach a demo swagger file where you can see that the colors in the Buble definition are empty. I expect the definitions of the three colors as a choice.Solved12KViews0likes2CommentsCan't execute API with swagger ui behind NGINX Plus kubernetes ingress
I am unsuccessfully trying to make Swagger UI work inside my kubernetes cluster. I am running NGINX Plus as my kubernetes ingress controller. The ingress is re-writing the URL path. External path is /dev/hello-world/hello Internal path is just / The ingress is also terminating TLS on 443 and forwarding the request as plain HTTP on port 8080 Here is a sample of the request headers that are logged by my API: Header 'host' = k8s-dev-kr.eastus.cloudapp.azure.com Header 'x-real-ip' = 173.186.244.247 Header 'x-forwarded-for' = 173.186.244.247 Header 'x-forwarded-host' = k8s-dev-kr.eastus.cloudapp.azure.com Header 'x-forwarded-port' = 443 Header 'x-forwarded-proto' = https Header 'connection' = close Header 'user-agent' = Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36 Header 'accept' = */* Header 'referer' = https://k8s-dev-kr.eastus.cloudapp.azure.com/dev/hello-world/hello/swagger-ui.html Header 'accept-encoding' = gzip, deflate, br Header 'accept-language' = en-US,en;q=0.9 I can access the swagger UI and navigate around, but I cannot execuite my API from Swagger UI. When I click execute, I do not see any request hit my ingress controller, nothing is logged there. Nor is anything logged by my API, the request does not appear to be getting to the kubernetes cluster. My API is a spring boot rest application. Here are my gradle dependencies to address any questions on what version I am running: dependencies { compile 'io.springfox:springfox-swagger2:2.9.2' compile 'io.springfox:springfox-swagger-ui:2.9.2' compile group: 'com.google.code.gson', name: 'gson', version: '2.8.5' compile group: 'commons-codec', name: 'commons-codec', version: '1.9' compile 'org.apache.httpcomponents:httpclient:4.5.9' compile 'org.apache.httpcomponents:httpclient-cache:4.5.9' compile 'org.apache.httpcomponents:httpmime:4.5.9' compile 'org.apache.httpcomponents:fluent-hc:4.5.9' compile group: 'mysql', name: 'mysql-connector-java', version: '5.1.13' compile 'org.springframework.boot:spring-boot-starter-jdbc' compile group: 'com.auth0', name: 'java-jwt', version: '3.8.1' compile group: 'com.auth0', name: 'jwks-rsa', version: '0.8.2' implementation 'org.springframework.boot:spring-boot-starter-web' testImplementation 'org.springframework.boot:spring-boot-starter-test' } Here is my SwaggerConfig class, I added the pathMapping to try to address the path re-write function of the ingress: @Configuration @EnableSwagger2 public class SwaggerConfig { @Value("${kubernetes.path}") private String kubePath; Logger log = LoggerFactory.getLogger(SwaggerConfig.class); @Bean public Docket api() { Docket docket = new Docket(DocumentationType.SWAGGER_2) .select() .apis(RequestHandlerSelectors.any()) .paths(PathSelectors.any()) .build(); // if running in kubernetes change the pathMapping // the KUBERNETES_SERVICE_HOST environment variable is always set by kubernetes. // So I am using it to detect that we are running on kubernetes if (System.getenv("KUBERNETES_SERVICE_HOST") != null) { log.debug("Kubernetes detected! Setting pathMapping to: " + kubePath); docket.pathMapping(kubePath); } return docket; } } The only error I see in my logs is a 404 not found forGET "//csrf", parameters={} But I don't think that has anything to do with my problem. I think the clientside java script is using a bad URL but, I do ot know how to tell what URL it is using. Any help on this is greatly appreciated! Thanks in advance! KarlSolvedHow to set default values into Swagger form
Hi, I have a Swagger ui and a C# Controller with a GET. Tha GET need's a json File as atribute. Each time I will test my Api I have to write surtain values into the form (json). Because it is allways the same value, I would like to have a prefilled field. How can I set default values into this Swagger form? Thanks for help. FrankAdditional properties not allowed: oneOf
Hi everyone ! It's been few days that I'm trying to create a "clean" configuration with swagger, but swagger-cli doesn't validate some of it. To explain the context, first of all I use swagger-cli with swagger-ui, and I bundle the following output used by swagger-ui with swagger-cli : "choices": { "type": "array", "description": "The choices", "items": { "anyOf": [ { "$ref": "../../../choice/choice.boolean.output.json" }, { "$ref": "../../../choice/choice.integer.output.json" }, { "$ref": "../../../choice/choice.text.output.json" } ] } } And everytime I'm trying to validate the schema with the following command : swagger-cli validate api-description.yaml I have the same error : Additional properties not allowed: oneOf at #/properties/.../items/properties/choices I try lot of combinations with docs : https://swagger.io/docs/specification/data-models/inheritance-and-polymorphism/ https://swagger.io/docs/specification/data-models/oneof-anyof-allof-not/ https://swagger.io/docs/specification/data-models/data-types/ https://swagger.io/docs/specification/describing-responses/ And I notice something weird about that, that I'm able to bundle it with the same package swagger-cli and display part of it in the swagger-ui "Example value" section : But in the model view I have an empty model : Do you know why ? I really need help :(