swagger-2.0

Additional properties not allowed: nullable swagger

谁说胖子不能爱 提交于 2019-12-01 14:19:12
I am using swagger 2.0 with node.js express 4.12.3 and mysql db. I have created following schema - Country: type: "object" properties: id: type: "integer" readOnly: true description: "Country Id" country: type: "string" description: "Country name" created_at: type: "string" readOnly: true format: "date-time" description: "Country record creation date" deleted_at: type: "string" format: "date-time" description: "Country record delete date" required: - country Here deleted_at field will be null and will not be present in db until the record is deleted. My express based nodejs server returns the

Additional properties not allowed: nullable swagger

◇◆丶佛笑我妖孽 提交于 2019-12-01 13:54:23
问题 I am using swagger 2.0 with node.js express 4.12.3 and mysql db. I have created following schema - Country: type: "object" properties: id: type: "integer" readOnly: true description: "Country Id" country: type: "string" description: "Country name" created_at: type: "string" readOnly: true format: "date-time" description: "Country record creation date" deleted_at: type: "string" format: "date-time" description: "Country record delete date" required: - country Here deleted_at field will be null

Unable to infer base url… springfox-swagger2 version 2.9.2

a 夏天 提交于 2019-12-01 12:34:24
Version of springfox-swagger that I am using What kind of issue is this? Project structure: SwaggerConfig is in automate.api.config.swagger.SwaggerConfiguration Auth Config is in automate.api.web.auth.keycloak.FalconKeycloakConfigurerAdapter dependencies As for Spring Boot <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.3.RELEASE</version> <relativePath/> </parent> As for swagger <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>${spring.springfox-swagger2.version}</version> <

Best way to denote time (without date) in Swagger spec

徘徊边缘 提交于 2019-12-01 11:51:53
What is the best way to represent a time field in a swagger specification, the closest type to denote it looks like date-time but this makes standard deserialisers to expect date field to be passed along with the time... Is there a standard or best practice to just denote time in a swagger spec that works well with the Jackson deserialisers? Is denoting time in milliseconds/seconds and using type string in swagger an acceptable approach? Depending on what you're trying to represent, this may or may not be a good idea. If you want to represent a specific timestamp, then it's probably much safer

How to define Swagger 2.0 JSON to populate default body parameter object in Swagger UI?

浪子不回头ぞ 提交于 2019-12-01 08:33:00
Our current deployment patterns require me to manually write my swagger json output that will be consumed by the Swagger-based UI in use at my company. I'd like the json I'm writing to provide 'default' values to populate the Swagger UI for all input fields, including the body input parameter. My body parameter is a referenced object as seen below. How do I define the returned swagger JSON to auto populate the body portion of the request when the "Try this operation" is clicked? An example Swagger spec that has no default/example data populated in the Swagger UI is below. { "swagger":"2.0",

How to define Swagger 2.0 JSON to populate default body parameter object in Swagger UI?

不羁的心 提交于 2019-12-01 05:54:49
问题 Our current deployment patterns require me to manually write my swagger json output that will be consumed by the Swagger-based UI in use at my company. I'd like the json I'm writing to provide 'default' values to populate the Swagger UI for all input fields, including the body input parameter. My body parameter is a referenced object as seen below. How do I define the returned swagger JSON to auto populate the body portion of the request when the "Try this operation" is clicked? An example

Swagger 2.0 offline validation

别说谁变了你拦得住时间么 提交于 2019-11-30 22:38:49
I know that there's a tool that is able to do an online validation: http://online.swagger.io/validator?url=http://petstore.swagger.io/v2/swagger.json I'm writing a JUnit test that validates the project's swagger.json file. It's important that this validation can be done offline , because the test runs as localhost , and that validation tool can't reach a localhost server. So, is it possible to validate a Swagger 2.0 JSON file, offline? I'm very satisfied with this Validator from Atlassian: https://bitbucket.org/atlassian/swagger-request-validator There is still active development, so I guess

Validating request path parameter of AWS API gateway?

老子叫甜甜 提交于 2019-11-30 22:24:26
Let's say I have an api with paths / and /{pets} and /{pets}/pet . Now I'm trying to validate the path {pets} parameter so that only path having alphanumerical characters of length 6 will be validated and processed to the backend lambda all others will be rejected. I tried the following swagger schema specifying format and type for the parameter. I even tried using pattern in the schema but it seems to be not working. May I know how can we limit only path parameters of certain IDs. { ...... "/{pets}/pet": { "get": { "consumes": [ "application/json" ], "produces": [ "application/json" ],

How to define role/permission security in Swagger

江枫思渺然 提交于 2019-11-30 17:37:30
In my API documentation, I would like to define the security necessary for each API endpoint. The project has defined roles and permissions that determine which users can access the APIs. What is the best way in Swagger to document this information? Is there a best practice or recommendation on how to show this detail? This what I tried out using securityDefinitions and a self-defined variable for the roles, but that information (x-role-names) didn't get copied over into the documentation when I ran it through swagger2markup or using swagger-ui. "securityDefinitions": { "baseUserSecurity": {

Swagger 2.0 offline validation

戏子无情 提交于 2019-11-30 17:20:18
问题 I know that there's a tool that is able to do an online validation: http://online.swagger.io/validator?url=http://petstore.swagger.io/v2/swagger.json I'm writing a JUnit test that validates the project's swagger.json file. It's important that this validation can be done offline , because the test runs as localhost , and that validation tool can't reach a localhost server. So, is it possible to validate a Swagger 2.0 JSON file, offline? 回答1: I'm very satisfied with this Validator from