Swagger: Add description with ref

For anyone using Swashbuckle with ASP.NET, you can use the following code to have the $ref construct put under the allOf (just like the : // do this wherever you are calling AddSwaggerGen() ArgBuilder.Services.AddSwaggerGen(opts => { opts.UseAllOfToExtendReferenceSchemas(); // add this line. }); Now if you have a model with two properties of the same type, … Read more

How to use ‘Authorization: Bearer ‘ in a Swagger Spec

Maybe this can help: swagger: ‘2.0’ info: version: 1.0.0 title: Bearer auth example description: > An example for how to use Bearer Auth with OpenAPI / Swagger 2.0. host: basic-auth-server.herokuapp.com schemes: – http – https securityDefinitions: Bearer: type: apiKey name: Authorization in: header description: >- Enter the token with the `Bearer: ` prefix, e.g. “Bearer … Read more

Slate vs Swagger – Which is better and which have more options? [closed]

Swagger and Slate serve two different purposes. Swagger is an attempt at a standardized way of describing a RESTful API (similar, for example, to ApiBlueprint) Swagger is a JSON based API definition format, which allows for the description of REST APIs. ~ API Design Tooling From Swagger Slate, on the other hand is a pretty … Read more

Swagger complex response model with dynamic key value hash maps

Your usage of additionalProperties is correct and your model is correct. additionalProperties In Swagger/OpenAPI, hashmap keys are assumed to be strings, so the key type is not defined explicitly. additionalProperties define the type of hashmap values. So, this schema type: object additionalProperties: type: string defines a string-to-string map such as: { “en”: “English text”, “de”: … Read more

Multi-line literals in swagger editor?

I believe the problem is the way you started the text on your description block. It must be indented one level to the right of description: Here’s an example of something that works for me: /{user-id}: get: summary: Facebook User description: | Displays all information about a Facebook user, depending on access privileges. Displays all … Read more

How to refer to enclosing type definition recursively in OpenAPI / Swagger?

Your definition is perfectly fine. It’s a known issue with rendering recursive schemas in Swagger Editor and Swagger UI: https://github.com/swagger-api/swagger-ui/issues/3325 To work around the “Example Value” showing null/”string”/undefined instead of a recursive element, you can add a custom example to your schema: definitions: TreeNode: type: object properties: name: type: string description: The name of the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)