swagger

Actions require unique method/path combination for Swagger

有些话、适合烂在心里 提交于 2021-02-20 06:32:03
问题 I have 2 HTTP GET method in same controller and give me this error HTTP method "GET" & path "api/DataStore" overloaded by actions - DPK.HostApi.Controllers.DataStoreController.GetByIdAsync (DPK.HostApi),DPK.HostApi.Controllers.DataStoreController.GetAllAsync (DPK.HostApi). Actions require unique method/path combination for Swagger 2.0. My Controller : [Route("api/[controller]")] [ApiController] public class DataStoreController : ApiControllerBase { private readonly IDataStoreService

Actions require unique method/path combination for Swagger

和自甴很熟 提交于 2021-02-20 06:30:24
问题 I have 2 HTTP GET method in same controller and give me this error HTTP method "GET" & path "api/DataStore" overloaded by actions - DPK.HostApi.Controllers.DataStoreController.GetByIdAsync (DPK.HostApi),DPK.HostApi.Controllers.DataStoreController.GetAllAsync (DPK.HostApi). Actions require unique method/path combination for Swagger 2.0. My Controller : [Route("api/[controller]")] [ApiController] public class DataStoreController : ApiControllerBase { private readonly IDataStoreService

How to disable “Django Login” page when trying to access swagger api in browser?

纵然是瞬间 提交于 2021-02-20 02:52:22
问题 I am getting a blank page with just a "Django Login" link when trying to access generated swagger docs. I am using drf_yasg library to render swagger documentation. Code to generate swagger docs is similar to mentioned in swagger docs. schema_view = get_schema_view( openapi.Info( title="Snippets API", default_version='v1', description="Test description", terms_of_service="https://www.google.com/policies/terms/", contact=openapi.Contact(email="contact@snippets.local"), license=openapi.License

JSON Schema - array of different objects

蓝咒 提交于 2021-02-19 07:44:20
问题 I'd like to know how to specify a JSON schema for an array of different objects. This thread gives me half the answer, but fails when I have multiple instances of each type of object. Here's a sample XML, based on the example given here but with the " Product " object being repeated:- { "things": [ { "entityType" : "Product", "name" : "Pepsi Cola", "brand" : "pepsi" }, { "entityType" : "Product", "name" : "Coca Cola", "brand" : "coke" }, { "entityType" : "Brand", "name" : "Pepsi Cola" } ] }

How do we secure Swagger UI with Windows Authentication

让人想犯罪 __ 提交于 2021-02-19 06:11:12
问题 We have a .Net Core 2.2 Web Api that uses swagger ui to expose the Web Api definitions. We want to secure this endpoint to only users inside of a certain AD Group. We currently are using Both Windows and Anonymous Authentication. Problem is we cannot enforce Swagger to use Windows Authentication to block users. Any Ideas? 回答1: Although frustrating, the easiest path to securing the Swagger endpoint (via Swashbuckle) I've found thus far is just to put it under its own route and then use a

OpenAPI 3.0 - allOf inside oneOf

帅比萌擦擦* 提交于 2021-02-17 03:33:19
问题 The following YAML: openapi: 3.0.0 info: title: test version: 1.0.0 paths: /test: get: summary: test responses: '200': description: Test content: application/json: schema: oneOf: - allOf: - type: object properties: firstA: type: string - type: object properties: firstB: type: string - allOf: - type: object properties: secondA: type: string - type: object properties: secondB: type: string Does not render at all in the swagger editor. In ReDoc it also fails to render properly: If nesting

Mutually excluding properties in swagger

我与影子孤独终老i 提交于 2021-02-17 03:19:58
问题 How do I indicate that in my_object you can have property_1 or property_2, but not both? my_object: type: object properties: property_1: type: string property_2: type: string 回答1: You may want to switch to OpenAPI 3.0, which supports oneOf keyword to define mutually exclusive conditions: here is an example : my_object: type: object properties: property_1: type: string property_2: type: integer oneOf: - required: [property_1] - required: [property_2] 回答2: In OpenAPI 3.0 ( openapi: 3.0.0 ), you

Mutually excluding properties in swagger

我怕爱的太早我们不能终老 提交于 2021-02-17 03:19:45
问题 How do I indicate that in my_object you can have property_1 or property_2, but not both? my_object: type: object properties: property_1: type: string property_2: type: string 回答1: You may want to switch to OpenAPI 3.0, which supports oneOf keyword to define mutually exclusive conditions: here is an example : my_object: type: object properties: property_1: type: string property_2: type: integer oneOf: - required: [property_1] - required: [property_2] 回答2: In OpenAPI 3.0 ( openapi: 3.0.0 ), you

How to put header information in swagger json

北城以北 提交于 2021-02-17 02:00:17
问题 I followed the following link from swagger documentation to create swagger json for my rest api. https://swagger.io/docs/specification/2-0/describing-request-body/ In my rest api, I have request body and http headers like Content-Type and Authorization that go along with the service request. I was wondering if there is a way to include request body and http header information in the swagger json ? I don't see that information in the swagger docs. 回答1: The Content-Type header of requests and

Enabling Cross Origin Resource sharing (CORS) in ExpressJS framework on NodeJS developed using Swagger

房东的猫 提交于 2021-02-16 17:56:42
问题 I've hosted a nodejs server on localhost generated using Swagger and I'm trying to make API calls to it using Swagger UI again hosted on localhost. The network profile in chrome is showing connection refused everytime I'm making a call because CORS header are not added to the request. This is my app.js file which was generated using Swagger: 'use strict'; var SwaggerExpress = require('swagger-express-mw'); var app = require('express')(); module.exports = app; // for testing var config = {