swagger

Generate a Swagger file for certain endpoints from another Swagger or OpenAPI file

佐手、 提交于 2019-12-07 23:57:50
问题 Having one big Swagger/OpenAPI YAML specification, how can I safely extract certain API endpoints and generate a new .yaml for them exclusively? It's easy to identify API endpoints from a certain level (like defined with one indent or more): paths: /users: ... - $ref: '#/requests/getUser' /repos: ... requests: getUser: ... I'd just copy all sections, except paths , into a new specs file. And then I'd copy certain paths subsections like /users: based on indents. In Python, with a regex. But is

Optional WebAPI routing parameters with Swagger documentation

旧街凉风 提交于 2019-12-07 23:45:18
问题 I have a WebAPI method with routing defined in an attribute, having one mandatory parameter and one optional: [HttpGet] [Route("api/ChargeCard/{cif}/{feeScheme=null}")] [ResponseType(typeof(ChargeCardRoot))] public IHttpActionResult Get(string cif, string feeScheme, ChargeCardRequestMode mode = ChargeCardRequestMode.Basic) { I also use Swashbuckle / Swagger to generate documentation. The problem is that Swagger always marks my optional parameter as required. Changing optional parameter

How can I hide the 'id' attribute in Loopback explorer?

≡放荡痞女 提交于 2019-12-07 19:18:14
问题 Is it possible to hide the id attribute in a method in swagger-ui generated by explorer in Strongloop Loopback? I don want the user to create a new resource and send the id attribute. I know that if the user send the id it can be ignored but I want to hide it in the explorer. 回答1: In order to hide the 'id' attribute, you need declare this field as hidden. In YOUR_MODEL.json file: { "name": "YOUR_MODEL", . . . "properties": { // your custom properties }, "hidden": ["id"], // this attribute

How to integrate swagger with jersey + spring-boot

旧巷老猫 提交于 2019-12-07 18:08:45
问题 I am using springboot + jersey for web restful implementation. Now I am going to integrate swagger into our application. I did following. @Configuration @EnableSwagger2 public class JerseyConfiguration extends ResourceConfig { public JerseyConfiguration(){ register(HelloworldAPI.class); configureSwagger(); } private void configureSwagger() { BeanConfig beanConfig = new BeanConfig(); beanConfig.setVersion("1.0.2"); beanConfig.setSchemes(new String[]{"http"}); beanConfig.setHost("localhost:8080

Swagger generating javascript-closure-angular-client

纵然是瞬间 提交于 2019-12-07 18:05:10
问题 I am new to swagger, I have generated a javascript closure angular client from the swagger's online editor, it gave me a DefaultAPI.js and other JS files that match my objects definitions. I've searched in swagger docs and on the net for a way to use the generated files in an angular application but didn't find any explanation, any clue ? 来源: https://stackoverflow.com/questions/40936437/swagger-generating-javascript-closure-angular-client

How to define an array of another schema in OpenAPI 3? [duplicate]

╄→尐↘猪︶ㄣ 提交于 2019-12-07 17:12:29
问题 This question already has an answer here : Return an array of object in Swaggerhub (1 answer) Closed last year . I have this schema defined: User: type: object required: - id - username properties: id: type: integer format: int32 readOnly: true xml: attribute: true description: The user ID username: type: string readOnly: true description: The username first_name: type: string description: Users First Name last_name: type: string description: Users Last Name avatar: $ref: '#/components

Swagger not scanning ApiModel and ApiModelProperty annotations in entity classes that are in a different jar file

此生再无相见时 提交于 2019-12-07 16:34:41
问题 I have the following two entity classes. The first class is SampleApiEntity : package my.company.rest; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.hibernate.annotations.Type; import java.io.Serializable; import java.sql.Timestamp; import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @ApiModel ( value = "SampleApiEntity", description = "This is a sample entity from the Api

Can I add versions to YAML Swagger objects?

ぃ、小莉子 提交于 2019-12-07 15:15:24
问题 I am creating a API definition, and a I wanto to split my canonical model to different documents and use the JSON pointer '$ref' to reuse them. I need to find a way to add version in the YAML files. For instance: ***pj.yaml*** pJType: verison: 1.0 type: object properties: cnpj: type: integer ***afastamento.yaml*** oswagger: '2.0' info: version: '1.0' title: AfastamentoService consumes: - application/json produces: - application/json paths: '/{nis}': get: parameters: - in: path name: nis type:

Springfox swagger inheritance support

余生颓废 提交于 2019-12-07 13:20:33
问题 Is there any way to expose inheritance/ polymorphism in springfox swagger (2.7.0)? I know that swagger specification supports allOf. Is springfox support this? Below is sample domain model. @ApiModel public abstract class Animal{ private String name; } @ApiModel(parent=Animal.class) public class Dog extends Animal{ ... } @ApiModel(parent=Animal.class) public class Cat extends Animal{ ... } If controller returns Animal, swagger contract doesn't expose Cat or Dog. It only returns Animal with it

Swagger: Not showing UI

*爱你&永不变心* 提交于 2019-12-07 10:00:57
问题 I want to use Swagger with Spring MVC. I have following entries in the build.gradle file compile 'com.mangofactory:swagger-springmvc:0.9.4' compile 'com.wordnik:swagger-annotations:1.3.12' compile 'org.webjars:swagger-ui:2.0.12' I have enable it using @EnableSwagger annotation. @EnableAutoConfiguration(exclude = {EmbeddedServletContainerAutoConfiguration.EmbeddedJetty.class, LiquibaseAutoConfiguration.class, org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration.class})