Can Swagger autogenerate its yaml based on existing express routes?

I have experience in BOTH auto-generating the Swagger json and manually writing it out for an API that I helped build. Here are the pros/cons of both based on my experience. Swagger AUTOMATIC Documentation Generation: We used the swagger-node-express module in combination with swagger-ui. https://www.npmjs.com/package/swagger-node-express https://github.com/swagger-api/swagger-ui Pros Super easy to document. Just throw a few … Read more

Why there are no themes for swagger-ui? [closed]

A late answer, albeit a good one. This is pretty awesome! A slick implementation, and he has customized many things that are easy to tweak yet again for your needs: https://github.com/jensoleg/swagger-ui. Credits go to this google group: https://groups.google.com/forum/#!topic/swagger-swaggersocket/oeMyayrvKRI. Strange that this has not been posted here yet. For an action demo, please check out this … Read more

JWT Authentication and Swagger with .NET Core 3.0

After some research, I eventually found the answer here Before seeing this page, I knew that I should use AddSecurityRequirement after AddSecurityDefinition because of many samples, but it was a problem that the function parameters have changed on .NET Core 3.0. By the way, the final answer is as below: services.AddSwaggerGen(c => { c.SwaggerDoc(“v1”, new … Read more

Web Api How to add a Header parameter for all API in Swagger

What the user “G T” wrote is correct but it is not working with Swagger 5. We have some new changes: From: Operation to: OpenApiOperation From: IParameter to: OpenApiParameter From: NonBodyParameter to: OpenApiParameter, and the most important is… From: Type = “string” to: Schema = new OpenApiSchema { Type = “String” } using System.Collections.Generic; using … Read more

Swagger; specify two responses with same code based on optional parameter

OpenAPI 2.0 OAS2 does not support multiple response schemas per status code. You can only have a single schema, for example, a free-form object (type: object without properties). OpenAPI 3.x In OAS3 you can use oneOf to define multiple possible request bodies or response bodies for the same operation: openapi: 3.0.0 … paths: /path: get: … Read more

How to annotate a field as deprecated in OpenAPI (Swagger) 2.0?

The possibility to mark schemas and schema properties as deprecated was added in OpenAPI 3.0: openapi: 3.0.1 … components: schemas: Service: type: object properties: location: type: string description: Location of the service example: ‘400 Street name, City State postcode, Country’ deprecated: true # <——— If you use OpenAPI 2.0 (Swagger 2.0), the only thing you … Read more

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