Questions tagged [swagger]

1

votes
1

answer
168

Views

AspNetCore 2.2 Custom/Explicit Swagger OperationId

I am creating restful APIs using aspnet core 2.2. I have a standard setup where each model has it's own controller with a GET and a POST actions. I am using Swashbuckle.AspNetCore NUGET package and using this article from Microsoft docs. Now, when I look at the generated swagger file, it has multipl...
CoOl
6

votes
3

answer
179

Views

Spring Boot and Swagger text/html response mapping

I have got one very simple java spring boot + swagger project. Only for test purposes I've created two mapping classes: Names.java and NamesContainer.java public class Names { @XmlAttribute(name='ref') @ApiModelProperty(notes = 'The auto-generated version of the product...') private String key; @Xml...
Armer B.
0

votes
0

answer
2

Views

Redirect from root url to /swagger/ui/index issue

I have a WebApi project with Swashbuckle installed onto it. By default, API documentation is accessible at URL http://localhost:4444/swagger/ui/index. I used the next approach https://stackoverflow.com/a/38614984/7819575. But it doesn't work correctly. I can get worked it by changing the url from '/...
Anri
0

votes
0

answer
3

Views

How to get header in swaggerLume?

i want to get the header which has bearer apitoken. I already define the header in annotation in my controller, but when I tried it in swagger, the swagger cann't get the header. Here is my controller : /** * @SWG\SecurityScheme( * @SWG\Swagger( * schemes={'https'}, * @SWG\SecurityDefinition...
Josh Parinussa
1

votes
0

answer
5

Views

Pass multiple parameters to org.apache.cxf.jaxrs.swagger.Swagger2Feature in web.xml

Good morning at all, I have a java REST server projects built with CXFNonSpringJaxrsServlet class. I need to configure Swagger2Feature passing multiple parameters into on web.xml. this is my Actual web.xml: CXFNonSpringJaxrsServlet CXFNonSpringJaxrsServlet org.apache.cxf.jaxrs.servlet.CXFNonSpring...
Giacomo Mattiuzzi
0

votes
0

answer
5

Views

Writing API documentation with Swagger OpenAPI 3

I'm trying to write API documentation with Swagger OpenAPI 3 the most important part , is to write a schema for the requestBody check the below example requestBody: { content: { 'application/json': { schema: {'x-ts-type': {x: String}}, }, }, }, the result is empty Schema , it does not work , where's...
Ahmed Mohsen
0

votes
0

answer
4

Views

Customize the json generated by NSwag

I was wondering if it would be possible to customize the JSON generated by NSwag at /swagger/index.html?url=/swagger/v1/swagger.json and also update the generated swagger UI accordingly. Ideally, I would like to have the ability to add a label in front of every endpoint with a custom value. Someth...
sh comp
0

votes
0

answer
3

Views

POSTMAN @GET Couldn't get any response and Swagger @GET The request has been terminated

@GET http://localhost:8080/batchConfig/findConfigs My controller @RestController @RequestMapping(path = '/batchConfig') public class BatchJobConfigController { @Autowired private BatchJobConfigRepository repository; /* * Mapping url exmaple:http://localhost:8080/batchConfig/findConfigs */ @GetMappin...
Titi
0

votes
0

answer
13

Views

Not able to get json data in browser using c#

I am reading a json file in C# and trying to get the json data in brower using service . I have created a service Where I am reading the Json file and while running this service I am getting the json data. But copying the same api and getting in other tab its giving message like this.. 'This XML fil...
Rajan Bosh
2

votes
0

answer
15

Views

How to Authorize Swagger to use MS Graph API

We are building a Web API wrapper for MS Graph API. I want to use Swagger to test my APIs. But I can't get the configuration right. I keep getting Bad Request and no other clue. I can't install Fiddler or other tools on this corporate laptop to help me investigate. Here is the Error And here is the...
jokab
1

votes
1

answer
16

Views

OAS3 specified Service Versioning

We are currently specifying a new REST service API using OpenAPI Service Specification v3 OAS3. Because of a bunch of different reasons we need/want to make the service API versioned from the start (this is mandated by factors not within our control). The versioning scheme we would like to use is UR...
fgysin
1

votes
2

answer
478

Views

Escape character for sqare brackets in php swagger annotation json property

I write API in Php Laravel and use swagger (2.0) annotations (lib: darkaonline/l5-swagger which use swagger-php) to generate swagger.json, however I have following problem - when I type: /** * * Space Schema * * @SWG\Get( * path='/api/v1/client/space/schema', * @SWG\Response( * resp...
Kamil Kiełczewski
1

votes
1

answer
66

Views

How to hide endpoints from Swagger documentation in Spring Boot

I have a Spring Boot project with next dependency of Swagger: io.springfox springfox-swagger2 2.9.2 compile io.springfox springfox-swagger-ui 2.9.2 And I have my Interface: import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind....
Alberto
0

votes
1

answer
14

Views

Convert Swagger 2.0 to OpenApi 3.0

Is there a tool for programmatically convert swagger 2.0 json/yaml to OpenApi 3.0 json/yampl?
pera.coyote
0

votes
0

answer
5

Views

How to model api with google json style

As stated in the question. I would like to model google style json format in openapi yaml https://google.github.io/styleguide/jsoncstyleguide.xml Google json style specify data or errors as dynamic field how can i put that data/error model in definition which takes another definition as the value...
Fan Cheung
0

votes
0

answer
4

Views

java.io.StreamCorruptedException: invalid stream header: FROM SWAGGER

I am very new to swagger API. when i am try to post object stream from swagger ui i am getting Invalid stream header. if same code test from standlone HTTPCOnnection client its working fine please help me Thanks in advance @RestController @RequestMapping('/') public class TestController { @Autowir...
laxman
1

votes
0

answer
12

Views

Defind return object model

I am using springfox and springboot to create MVC API. I have a common response class/pojo, which is use to return the following JSON: { 'data': {}, 'status': 'string' } The data field I defined it as Object: private Object data; So I can assign any Object into the data, before response. My question...
Alvin
0

votes
0

answer
2

Views

Is there a URL method to validate that swaggers mock mode is turned off when being used with node

Can you ping a completed server from a browser with a request that will validate that swaggers mock mode is turned off? The server is using swagger through node.
Keith
1

votes
1

answer
419

Views

Reference an external URL for swagger-UI

I'm working on a project with Spring boot and we already have a swagger documentation for it as a json file. We just included Swagger-ui and it's rendered under /projectName/swagger-ui.html. We would like to make use of the external URL that references our Swagger json which is /projectName/docs/swa...
Habchi
1

votes
2

answer
2.2k

Views

How to generate a Swagger #definition from sample JSON

Take the following #definition from the pet store example. Given a #definition section a JSON structure can be generated e.g. Is there something that can do the reverse given a largeish complex JSON file? Given the below JSON Structure can I get the #defintion section of a swagger file generated to...
user1605665
-3

votes
0

answer
22

Views

Create HTTP delete method with parameters

I have swagger url http://somehost/swagger/index.html end methods there as shown on image: I am trying to create HTTP DELETE web request refer to DELETE method. this delete method have parameters as shown on image Here is my code writen in console application to refer this delete method and put ther...
Vaso Miruashvili
0

votes
0

answer
4

Views

Set Request Validator of API Gateway by serverless

I want to set Request Validator of API Gateway by serverless. I tried two different settings for the Request Validator. But, both methods have failed. I have summarized what I did, so please let me know if there is something wrong. I write the API specification in swagger(OAS3.0). Therefore I tried...
gnk
1

votes
1

answer
523

Views

generating swagger YAML from template?

I am trying to find a solution where I have something like a YAML template with variables, and a configuration file with variable definitions. I run this tool on the YAML template and it will generate a YAML file for each configuration file. I am honestly most likely not searching using the right ke...
Konstantino Sparakis
1

votes
1

answer
581

Views

how to hide field during serialization (but not deserialization)

In our project (springMVC) Rest API project I wish to only use ONE model for both request and response (to avoid having to add tons of code to copy field from object to object) I'd like to use Swagger to handle all the doc, but I'm running into a little problem. For example let say I have a model Us...
Johny19
1

votes
2

answer
1.3k

Views

How can I get ServiceStack's Swagger implementation to use XML content-type?

I have a VERY basic ServiceStack experiment that uses Swagger for generating documentation. The service can be used with several different content-types (XML, JSON, etc.): Default metadata page However, I can only use content-type/json in the Swagger UI. Is there a configuration/attribute I can use,...
jk1990
1

votes
1

answer
191

Views

Dynamic Host can be passed except giving in .json file?

I am using Swagger-ui version 2.1.4, i have hosted it locally and provided it my own Json file and API it opens the document fine and lists all the method in the json file, host is given in .json file. i want to change it, that it is given by the user every time when it calls the index page. 'host'...
Uzair Xlade
1

votes
2

answer
881

Views

Get, java.lang.IllegalArgumentException: Path index.html does not start with a “/” character, when accessing swagger-ui

We are currently using Swagger-UI - 1.0.1 with Swagger-SpringMVC - 1.0.2. Recently we upgraded from Spring-boot 1.2 to 1.3.1 & ever we are facing a small issue in accessing swagger-ui. Earlier I could access it using http://localhost:8080/application-context but ever since the upgrade to spring-boo...
Amrut
1

votes
1

answer
1.6k

Views

How do you change swagger's path with Jersey and BeanConfig?

Is there any way of having swagger.json sitting somewhere else than the default location (/swagger.json)? Right now it's always deployed to http://localhost:8080/swagger.json, I'd like to have it at http://localhost:8080/api-docs/swagger.json The setup guide isn't much of a help. All it says is swa...
user384729
1

votes
1

answer
3.1k

Views

@RequestParam annotated method with swagger ui not showing description

I am attempting to mold Swagger-UI in order to modify not only that 'name' field but also the 'Description' field of an API input parameter. An example is here of someone appearing to do this successfully, utilizing both @ApiParam and @RequestParam: [link] The closest to modifying the description fi...
degreesightdc
1

votes
1

answer
623

Views

No request body in swagger-test

After a long search, I finally found swagger-test to be the best framework to test my REST services from a swagger spec. I followed the read me and the example in the Repo. This is my first xamples request/response pair. 'x-amples': [{ 'description': 'should save an object', 'request': { 'params': {...
egimaben
1

votes
1

answer
1.4k

Views

Springfox Swagger2 - @ApiOperation not working

I use springfox-swagger2 for my Spring MVC REST API. Everything works good with swagger but my problem is I cannot add additional information to my swagger documentation. Maven Dependency: io.springfox springfox-swagger2 2.2.2 io.springfox springfox-swagger-ui 2.2.2 My Swagger config class: @Configu...
K.E.
1

votes
1

answer
795

Views

SwashBuckle Customising Operation Tags

I'm simply looking to remove the word controller from appearing in the swagger documentation. I've looked at using an IOperationFilter or IDocumentFilter to manually edit the tags, but the properties are read-only. /// /// Home /// public class HomeController : ApiController { } I've ena...
Derek
1

votes
1

answer
1.5k

Views

Object array with keys in swagger

We got an existing webservice that we attempt to document using Swagger. It often seems to return objects using: schema: type: array items: $ref: '#/definitions/Tweets' In this model the id of the tweet is in the Tweets definition. My returned output is formatted like this: { '127':{ 'name':'Foo...
Jeroen M
1

votes
1

answer
2.2k

Views

How to Add Custom headers on swagger-api-explorer

I am trying to add Access-Control-Allow-Origin in header. To do so I added this lines: window.swaggerUi.api.clientAuthorizations.add('headerKey', apiKeyAuth); window.swaggerUi.api.clientAuthorizations.add('headerKey', new SwaggerClient.ApiKeyAuthorization('Allow-Access-Control-Origin', '*', 'header...
Nityanarayan44
1

votes
1

answer
455

Views

Edit the swagger.json before loading in the UI

Is there a way to edit the swagger.json before loading it in the ui. My requirement is to manipulate the swagger.json before loading it in the UI, are there any hooks provided by swagger team to accomplish this
Charity
1

votes
1

answer
1.3k

Views

Camel case code generation with swagger

I am trying to generate python client from a swagger yaml file. It works fine, except that the response models are all snake cased(words sep. by underscores) instead of camel cased. I provided the camel cased versions like this: definitions: serviceResponse: type: object properties: serviceResponseI...
Ravi
1

votes
1

answer
1k

Views

After add swagger lib, all response content-type changed to application/xml

I'm a rookie for swagger and springMVC. I just tried to integrate swagger into our system last week. Everything seems great till I deploy the new war. I found all response automatically changed to xml format...Can anyone give some direction about where I should investigate? I've tried the following...
Whispererli
1

votes
1

answer
1.5k

Views

How to unit test android app which requires a web service calls

Following are the tools and frameworks that I am using in my project . Retrofit Dagger 2 Swagger Swagger retrofit client generator I have also implemented MVP design pattern in my project . I just want to know whether I need use real backend or Just need to mock the backend for testing purpose . I...
Rahul
1

votes
1

answer
4.6k

Views

Parse date-time field defined in Swagger file

I have an API written in Swagger 2.0 that says an entity has a property called when of type date-time: properties: when: type: string format: date-time I don't know how to parse the string. How should I expect the date-time format to looks like? I cannot find this in the Swagger 2.0 documentation
mat_boy
1

votes
1

answer
3.2k

Views

Swagger with Spring Rest : api-docs does not generate the json

I am trying to integrate swagger2 with my Spring MVC. But when I try to access http://myhost/myapp/api-docs, I am not able to get the json. Could you please help me to figure out whats going wrong with my code. My Pom.xml (swagger related) io.springfox springfox-swagger2 2.2.2 io.springfox sprin...
user3733591

View additional questions