openapi

springdoc-openapi apply default global SecurityScheme possible?

谁都会走 提交于 2021-02-06 10:11:54
问题 I have the following SecurityScheme definition using springdoc-openapi for java SpringBoot RESTful app: @Bean public OpenAPI customOpenAPI() { return new OpenAPI() .components(new Components().addSecuritySchemes("bearer-jwt", new SecurityScheme().type(SecurityScheme.Type.HTTP).scheme("bearer").bearerFormat("JWT") .in(SecurityScheme.In.HEADER).name("Authorization"))) .info(new Info().title("App API").version("snapshot")); } Is it possible to apply it globally to all paths, without having to go

Is it possible to reference a single path and method in OpenAPI 3?

泪湿孤枕 提交于 2021-02-05 08:13:18
问题 Suppose I have an OpenAPI 3 document describing API Foo as follows: openapi: 3.0.0 info: version: '1' title: Foo paths: /foo: get: responses: 200: description: A Foo post: responses: 201: description: Foo created In another OpenAPI document for API Bar , I would like to reference only the GET /foo operation from API Foo . The OpenAPI docs talk a little about referencing a whole path. However, if I do the following: openapi: 3.0.0 info: version: '1' title: Bar paths: /foo: $ref: 'foo.yaml#

Is it possible to reference a single path and method in OpenAPI 3?

故事扮演 提交于 2021-02-05 08:10:03
问题 Suppose I have an OpenAPI 3 document describing API Foo as follows: openapi: 3.0.0 info: version: '1' title: Foo paths: /foo: get: responses: 200: description: A Foo post: responses: 201: description: Foo created In another OpenAPI document for API Bar , I would like to reference only the GET /foo operation from API Foo . The OpenAPI docs talk a little about referencing a whole path. However, if I do the following: openapi: 3.0.0 info: version: '1' title: Bar paths: /foo: $ref: 'foo.yaml#

Bug in OpenAPI generator? Wrong format for the example value of date datatype

烈酒焚心 提交于 2021-01-29 21:24:17
问题 I'm using a openapi-generator-maven-plugin with 4.2.3 version. My configuration looks like this: <typeMappings> <typeMapping>OffsetDate=LocalDate</typeMapping> <typeMapping>OffsetDateTime=LocalDateTime</typeMapping> </typeMappings> <importMappings> <importMapping>java.time.OffsetDate=java.time.LocalDate</importMapping> <importMapping>java.time.OffsetDateTime=java.time.LocalDateTime</importMapping> </importMappings> <!-- pass any necessary config options --> <configOptions> <java8>true</java8>

Javascript conversion of an OpenAPI V3 json object to Swagger HTML object to update DIV thru jQuery [duplicate]

久未见 提交于 2021-01-29 06:59:45
问题 This question already has answers here : How to embed Swagger UI into a webpage? (1 answer) how to pass json to SwaggerUIBundle (1 answer) Closed last month . In the context of a npm / nodejs web app, would there be a way to convert an OpenAPI V3 json object into Swagger HTML to dynamically update a DIV thru jQuery ? Thanks 来源: https://stackoverflow.com/questions/65308328/javascript-conversion-of-an-openapi-v3-json-object-to-swagger-html-object-to-upd

How to hide endpoints from OpenAPI documentation with Springdoc

倖福魔咒の 提交于 2021-01-28 14:02:43
问题 Springdoc automatically generates a API documentation for all handler methods. Even if there are no OpenAPI annotations. How can I hide endpoints from the API documentation? 回答1: The @io.swagger.v3.oas.annotations.Hidden annotation can be used at the method or class level of a controller to hide one or all endpoints. (See: https://springdoc.org/faq.html#how-can-i-hide-an-operation-or-a-controller-from-documentation) Example: @Hidden // Hide all endpoints @RestController @RequestMapping(path =

How to hide endpoints from OpenAPI documentation with Springdoc

瘦欲@ 提交于 2021-01-28 13:56:45
问题 Springdoc automatically generates a API documentation for all handler methods. Even if there are no OpenAPI annotations. How can I hide endpoints from the API documentation? 回答1: The @io.swagger.v3.oas.annotations.Hidden annotation can be used at the method or class level of a controller to hide one or all endpoints. (See: https://springdoc.org/faq.html#how-can-i-hide-an-operation-or-a-controller-from-documentation) Example: @Hidden // Hide all endpoints @RestController @RequestMapping(path =

Is there a way to generate swagger.json from json-server file

我的未来我决定 提交于 2021-01-28 05:53:40
问题 For prototyping we are using json-server library that creates fake REST api based on our db.json file. Now we would like to use swagger. So my question is, is there a way to generate swagger.json from our db.json file? If not, do you guys know some tool to generate swagger.json file easily? Thanks! 回答1: If you can make API calls to your 'fake' API, you can use Swagger Inspector to create an API Definition (swagger.json)! Steps: Go to https://inspector.swagger.io. You should create an account

Is it possible to disallow unknown query parameters in an OpenAPI v3 spec?

孤街浪徒 提交于 2021-01-28 02:02:56
问题 In OpenAPI, you can specify additionalProperties: false as part of an object schema to indicate that extra, unknown properties in a request or response body will be considered a validation error. Is there any way to do something similar when specifying query parameters for an API? I want to indicate that requests including other query parameters beyond those explicitly documented will be considered an error and trigger an HTTP 400 response. I see that you can mark individual parameters as

How to include the client from openapi-generator in a gradle java application?

拜拜、爱过 提交于 2021-01-27 17:39:29
问题 I want to create a gradle java application that generates a client from an openAPI specification file and uses that client. So I created a java application with gradle init (type:application, language:Java, DSL:groovy, test-framework:Junit Jupiter, project-name:simple-java-app, package-structure: a.aa ). Small example of what works: I can create a new source folder second/loc/src/main/java with a package b.bb and a class Foo . And with the following build.gradle plugins { id 'java' id