I am getting this error with jhipster+webflux, Gateway application error(JWT)
Application --> registry--gateway(angular)--multiple services(webflux)
http://localhost:8080/admin/docs
"type" : "https://www.jhipster.tech/problem/problem-with-message",
"title" : "Not Found",
"status" : 404,
"detail" : "404 NOT_FOUND",
"path" : "/swagger-ui.html",
"message" : "error.http.404"
.yo-rc.json
{
"generator-jhipster": {
"promptValues": {
"packageName": "org.abc.gateway",
"nativeLanguage": "en"
},
"jhipsterVersion": "6.10.3",
"applicationType": "gateway",
"baseName": "gateway",
"packageName": "org.abc.gateway",
"packageFolder": "org/abc/gateway",
"serverPort": "8080",
"authenticationType": "jwt",
"cacheProvider": "no",
"enableHibernateCache": false,
"websocket": false,
"databaseType": "mongodb",
"devDatabaseType": "mongodb",
"prodDatabaseType": "mongodb",
"searchEngine": false,
"messageBroker": false,
"serviceDiscoveryType": "eureka",
"buildTool": "maven",
"enableSwaggerCodegen": true,
"jwtSecretKey": "XXXXXXXXXXXXXXXX",
"embeddableLaunchScript": false,
"useSass": true,
"clientPackageManager": "npm",
"clientFramework": "angularX",
"clientTheme": "none",
"clientThemeVariant": "",
"creationTimestamp": 1602227915588,
"testFrameworks": ["gatling", "cucumber", "protractor"],
"jhiPrefix": "jhi",
"entitySuffix": "",
"dtoSuffix": "DTO",
"otherModules": [],
"enableTranslation": true,
"nativeLanguage": "en",
"languages": ["en", "hi"],
"blueprints": [],
"reactive": true
}
}
Error in swagger initialization
java.lang.NoSuchMethodError: springfox.documentation.spi.service.contexts.ParameterContext.(Lspringfox/documentation/service/ResolvedMethodParameter;Lspringfox/documentation/builders/ParameterBuilder;Lspringfox/documentation/spi/service/contexts/DocumentationContext;Lspringfox/documentation/spi/schema/GenericTypeNamingStrategy;Lspringfox/documentation/spi/service/contexts/OperationContext;)V
What do i need to check, to get swagger enabled with spring-Webflux projects..
I found an issue in jhipster project : https://github.com/jhipster/generator-jhipster/issues/12072#issuecomment-683282300
To fix it :
1- update the dependencies (remove the old dependencies)
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>${springfox.version}</version>
<exclusions>
<exclusion>
<groupId>io.springfox</groupId>
<artifactId>springfox-bean-validators</artifactId>
</exclusion>
<exclusion>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-bean-validators</artifactId>
<version>${springfox.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${springfox.version}</version>
</dependency>
2 - update the path "/v2/api-docs" to "/v3/api-docs" in the whole project (front + back)
3 - in docs.component.html change the URI
<iframe src="./swagger-ui/" width="100%" height="900" seamless
target="_top" title="Swagger UI" class="border-0"></iframe>
4 - I had a problem with the security.
I allow the swagger resource to permit all in SecurityConfiguration
Since I disable Swagger in production spring profile, it is not a problem for me.
Related
In serilog, I need to split the information in two files. i.e one file should contain the Information and the other should contain the error. with the below code and configuration, the information and the errors both displays in both files, instead of filtering out.
Note: I am trying this in .Net6 in Serverside Blazor. Please help us.
Thanks in Advance
"Serilog": {
"Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File", "Serilog.Expressions" ],
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"System": "Warning"
}
},
"Enrich": [
"FromLogContext",
"WithMachineName"
],
"WriteTo": [
{
"Name": "Console"
},
{
"Name": "File",
"Args": {
"path": "Logs/ex_.log",
"outputTemplate": "{Timestamp:o} [{Level:u3}] ({SourceContext}) {Message:lj}{NewLine}{Exception}",
"rollingInterval": "Day",
"retainedFileCountLimit": 7
}
},
{
"Name": "Logger",
"Args": {
"configureLogger": {
"Filter": [
{
"Name": "ByExcluding",
"Args": {
"expression": "(#Level = 'Information' )"
}
}
],
"WriteTo": [
{
"Name": "File",
"Args": {
"path": "Logs/ERROR_.log",
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff} [{Level:u3}] {Message:lj}{NewLine}{Exception}",
"rollingInterval": "Day",
"retainedFileCountLimit": 7
}
}
]
}
}
}
]
}
Log.Logger = new LoggerConfiguration()
.WriteTo.Console()
.CreateBootstrapLogger();
WebApplicationBuilder builder;
try
{
Log.Information("Application starting .....");
builder = WebApplication.CreateBuilder(args);
builder.Host.UseSerilog((ctx, lc) => lc
.WriteTo.Console()
.ReadFrom.Configuration(ctx.Configuration));
// Add services to the container.
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
builder.Services.AddTelerikBlazor();
builder.Services.AddSingleton<WeatherForecastService>();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseSerilogRequestLogging();
app.UseRouting();
app.MapBlazorHub();
app.MapFallbackToPage("/_Host");
app.Run();
}
catch (Exception ex)
{
Log.Fatal("Application even failed to start....");
}
You need to make sure the following NuGet packages are installed. You can find this working example code on GitHub here
Serilog,
Serilog.AspNetCore
Serilog.Settings.Configuration
Serilog.Sinks.File, Serilog.Sinks.* (whatever sink type you are
using, relevant package)
Serilog.Expressions,
Serilog.Enrichers.*(this package is an optional choice) if you want to use enrichers.
I am using Blazor Serverside with .Net6 example here.
Program.cs
using Serilog;
var builder = WebApplication.CreateBuilder(args);
var configuration = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json")
.Build();
Log.Logger = new LoggerConfiguration()
.ReadFrom.Configuration(configuration)
.WriteTo.Console()
.WriteTo.Logger(lc => lc
.Filter.ByIncludingOnly(" #l = 'Debug' or #l = 'Information' or #l = 'Warning'")
.WriteTo.File("Logs/Log-Information-{Date}.log", rollingInterval: RollingInterval.Day))
.WriteTo.Logger(lc => lc
.Filter.ByIncludingOnly(" #l = 'Error' or #l = 'Fatal'")
.WriteTo.File("Logs/Log-Error-{Date}.log", rollingInterval: RollingInterval.Day))
.CreateLogger();
Log.Information("Starting up");
Serilog.Log.Information("Starting application");
Serilog.Log.Error("Error");
Serilog.Log.Fatal("Fatal");
Serilog.Log.Debug("Debug");
// Add services to the container.
builder.Services.AddAuthentication(NegotiateDefaults.AuthenticationScheme)
.AddNegotiate();
builder.Services.AddAuthorization(options =>
{
// By default, all incoming requests will be authorized according to the default policy.
options.FallbackPolicy = options.DefaultPolicy;
});
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
builder.Services.AddSingleton<WeatherForecastService>();
var app = builder.Build();
Appsettings.json file:
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning",
"Microsoft.EntityFrameworkCore": "Warning",
"Microsoft.Extensions.DependencyInjection": "Warning",
},
"WriteTo": [
{
"Name": "Console",
"Args": {
"outputTemplate": "{Timestamp:HH:mm:ss} [{Level}] {SourceContext}{NewLine}{Message}{NewLine}{Exception}"
}
},
{
"Name": "File",
"Args": {
"Path": "./logs/log.txt",
"IncludeScopes": true,
"TimestampFormat": "yyyy-MM-dd HH:mm:ss",
"RollingInterval": "Day"
}
},
{
"Name": "Seq",
"Args": { "serverUrl": "http://localhost:5341"}
}
]
}
The above code snippet will generate two different log files under the "./Logs/" path, per the below screenshot.
Inside the files:
Note: I have added "#using Serilog" into _Imports.razor as well.
My project package references:
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="6.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.5" />
<PackageReference Include="Serilog" Version="2.11.0" />
<PackageReference Include="Serilog.AspNetCore" Version="5.0.0" />
<PackageReference Include="Serilog.Expressions" Version="3.3.0" />
<PackageReference Include="Serilog.Sinks.Seq" Version="5.1.1" />
<PackageReference Include="Serilog.Enrichers.AspNetCore.HttpContext" Version="1.0.1" />
<PackageReference Include="Serilog.Enrichers.AssemblyName" Version="1.0.9" />
<PackageReference Include="Serilog.Enrichers.Context" Version="4.2.0" />
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.2.0" />
<PackageReference Include="Serilog.Enrichers.Memory" Version="1.0.4" />
<PackageReference Include="Serilog.Enrichers.Process" Version="2.0.2" />
<PackageReference Include="Serilog.Enrichers.Thread" Version="3.1.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.3.0" />
<PackageReference Include="Serilog.Sinks.MSSqlServer" Version="5.7.0" />
</ItemGroup>
I'm trying to implement a Rest API for an application I develop using Symfony 4.
After installing packages such as : nelmio/api-doc-bundle (my composer.json is pasted bellow), I am getting the following error :
InvalidConfigurationException Unrecognized options "sandbox, swagger" under "nelmio_api_doc". Available options are "areas",
"documentation", "models"..
I'm trying to figure out what is happening for days now.
Please need help.
This is my composer.json :
{
"type": "project",
"license": "proprietary",
"require": {
"php": "^7.1.3",
"ext-ctype": "*",
"ext-iconv": "*",
"cocur/slugify": "^3.2",
"dompdf/dompdf": "^0.8.3",
"friendsofsymfony/oauth-server-bundle": "^1.6",
"friendsofsymfony/rest-bundle": "^2.5",
"friendsofsymfony/user-bundle": "~2.0",
"inacho/php-credit-card-validator": "^1.0",
"jms/serializer-bundle": "^3.3",
"nelmio/api-doc-bundle": "^3.4",
"sensio/framework-extra-bundle": "^5.3",
"symfony/apache-pack": "^1.0",
"symfony/asset": "4.2.*",
"symfony/console": "4.2.*",
"symfony/dotenv": "4.2.*",
"symfony/expression-language": "4.2.*",
"symfony/filesystem": "4.2.*",
"symfony/finder": "4.2.*",
"symfony/flex": "^1.1",
"symfony/form": "4.2.*",
"symfony/framework-bundle": "4.2.*",
"symfony/monolog-bundle": "^3.1",
"symfony/orm-pack": "*",
"symfony/process": "4.2.*",
"symfony/security-bundle": "4.2.*",
"symfony/serializer-pack": "*",
"symfony/swiftmailer-bundle": "^3.2",
"symfony/translation": "4.2.*",
"symfony/twig-bundle": "4.2.*",
"symfony/validator": "4.2.*",
"symfony/web-link": "4.2.*",
"symfony/yaml": "4.2.*",
"twig/extensions": "^1.5",
"zircote/swagger-php": "*"
},
"require-dev": {
"symfony/debug-pack": "*",
"symfony/maker-bundle": "^1.0",
"symfony/profiler-pack": "*",
"symfony/test-pack": "*",
"symfony/web-server-bundle": "4.2.*"
},
"config": {
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"paragonie/random_compat": "2.*",
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php56": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"#auto-scripts"
],
"post-update-cmd": [
"#auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "4.2.*"
}
}
}
And this is my nelmio_api_doc.yaml
nelmio_api_doc:
sandbox:
enabled: true
authentication:
delivery: http
type: bearer
body_format:
formats: [json, form] # array of enabled body formats,
default_format: json
swagger:
api_base_path: /api
swagger_version: "1.2"
api_version: "0.1"
info:
title: API
description: "REST API"
I tried: composer update and composer install.
You must have updated nelmio/api-doc-bundle from 2.x to 3.x.
Your configuration seems good for a 2.x version.
Make sure to follow this guide for migration to 3.x.
For a similar issue which faced, I replaced sandbox with documentation.
Similarly, by following the guide, you can replace the rest.
Most likely something similar to the following will work.
nelmio_api_doc:
documentation: #<-- notice this change.
enabled: true
authentication:
delivery: http
type: bearer
body_format:
formats: [json, form] # array of enabled body formats,
default_format: json
api_base_path: /api
swagger_version: "1.2"
info:
title: API
description: "REST API"
version: "0.1" # <-- notice this has been moved.
I have this code...
#RequestMapping(value = "/search/",
method = RequestMethod.GET,
produces = org.springframework.http.MediaType.APPLICATION_JSON_VALUE)
#ApiOperation(value = "Search for a Device",
response = DeviceSummary.class,
position = 0)
List<DeviceSummary> search(#ApiParam(value = "The store code", required = true) #QueryParam("storeCode") String storeCode,
#ApiParam(value = "The device type code", required = false) #QueryParam("deviceType") String deviceType,
#ApiParam(value = "The device type codes", required = false) #QueryParam("deviceTypes") String deviceTypes,
#ApiParam(value = "The device group code", required = false) #QueryParam("deviceGroupCode") String deviceGroupCode,
#ApiParam(value = "Max results to return", required = false) #QueryParam("maxResults") String maxResults);
And the swagger.json file looks like this..
"parameters" : [ {
"in" : "body",
"name" : "body",
"description" : "The store code",
"required" : true,
"schema" : {
"type" : "string"
}
}, {
"in" : "body",
"name" : "body",
"description" : "The device type code",
"required" : false,
"schema" : {
"type" : "string"
}
}, <SNIP>
I was expecting the Query Params to look like this...
Notice the "in" type is "query", not "body". Also, the name is correct.
{
"name" : "storeCode",
"in" : "query",
"description" : "The store code",
"required" : true,
"type" : "string"
}
I'm using these dependencies
<dependency>
<groupId>com.github.kongchen</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-core</artifactId>
<scope>compile</scope>
<version>1.5.3</version>
<exclusions>
<exclusion>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
</exclusion>
</exclusions>
</dependency>
The answer is to NOT mix JaxRS and Spring annotations.
It should be...#RequestParam, not #QueryParam
#ApiParam(value = "The store code", required = true) #RequestParam("storeCode") String storeCode,
I am creating a custom Cordova plugin that requires some custom Xcode Build Settings to be specified (for example, CLANG_CXX_LANGUAGE_STANDARD).
I thought I would be able to set it using the config.xml specs of the cordova-custom-config plugin as follows:
<custom-preference name="ios-XCBuildConfiguration-CLANG_CXX_LANGUAGE_STANDARD" value="gnu++0x" quote="none" buildType="release" />
<custom-preference name="ios-XCBuildConfiguration-CLANG_CXX_LANGUAGE_STANDARD" value="gnu++0x" quote="none" buildType="debug" />
<custom-preference name="ios-XCBuildConfiguration-CLANG_CXX_LIBRARY" value="libc++" quote="none" buildType="release" />
<custom-preference name="ios-XCBuildConfiguration-CLANG_CXX_LIBRARY" value="libc++" quote="none" buildType="debug" />
<custom-preference name="ios-XCBuildConfiguration-GCC_C_LANGUAGE_STANDARD" value="gnu99" quote="none" buildType="release" />
<custom-preference name="ios-XCBuildConfiguration-GCC_C_LANGUAGE_STANDARD" value="gnu99" quote="none" buildType="debug"/>
However, when installing the plugin with plugman install they are not applied.
Any suggestion on how to modify Xcode Build Settings from a Cordova plugin? Thanks
You can add build flags to the build.json
{
"ios": {
"debug": {
"codeSignIdentity": "iPhone Developer",
"developmentTeam": "FG35JLLMXX4A",
"packageType": "development",
"buildFlag": [
"EMBEDDED_CONTENT_CONTAINS_SWIFT = YES",
"ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES=NO",
"LD_RUNPATH_SEARCH_PATHS = \"#executable_path/Frameworks\""
]
},
"release": {
"codeSignIdentity": "iPhone Developer",
"developmentTeam": "FG35JLLMXX4A",
"packageType": "app-store",
"buildFlag": [
"EMBEDDED_CONTENT_CONTAINS_SWIFT = YES",
"ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES=NO",
"LD_RUNPATH_SEARCH_PATHS = \"#executable_path/Frameworks\""
]
}
}
}
https://cordova.apache.org/docs/en/latest/guide/platforms/ios/#using-buildjson
Recently I wrote restful APIs with SpringMvc and swagger-ui(v2). I noticed the Import function in Postman:
So my question is how to create the file which Postman needed?
I am not familiar with Swagger.
I work on PHP and have used Swagger 2.0 to document the APIs.
The Swagger Document is created on the fly (at least that is what I use in PHP). The document is generated in the JSON format.
Sample document
{
"swagger": "2.0",
"info": {
"title": "Company Admin Panel",
"description": "Converting the Magento code into core PHP and RESTful APIs for increasing the performance of the website.",
"contact": {
"email": "jaydeep1012#gmail.com"
},
"version": "1.0.0"
},
"host": "localhost/cv_admin/api",
"schemes": [
"http"
],
"paths": {
"/getCustomerByEmail.php": {
"post": {
"summary": "List the details of customer by the email.",
"consumes": [
"string",
"application/json",
"application/x-www-form-urlencoded"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "email",
"in": "body",
"description": "Customer email to ge the data",
"required": true,
"schema": {
"properties": {
"id": {
"properties": {
"abc": {
"properties": {
"inner_abc": {
"type": "number",
"default": 1,
"example": 123
}
},
"type": "object"
},
"xyz": {
"type": "string",
"default": "xyz default value",
"example": "xyz example value"
}
},
"type": "object"
}
}
}
}
],
"responses": {
"200": {
"description": "Details of the customer"
},
"400": {
"description": "Email required"
},
"404": {
"description": "Customer does not exist"
},
"default": {
"description": "an \"unexpected\" error"
}
}
}
},
"/getCustomerById.php": {
"get": {
"summary": "List the details of customer by the ID",
"parameters": [
{
"name": "id",
"in": "query",
"description": "Customer ID to get the data",
"required": true,
"type": "integer"
}
],
"responses": {
"200": {
"description": "Details of the customer"
},
"400": {
"description": "ID required"
},
"404": {
"description": "Customer does not exist"
},
"default": {
"description": "an \"unexpected\" error"
}
}
}
},
"/getShipmentById.php": {
"get": {
"summary": "List the details of shipment by the ID",
"parameters": [
{
"name": "id",
"in": "query",
"description": "Shipment ID to get the data",
"required": true,
"type": "integer"
}
],
"responses": {
"200": {
"description": "Details of the shipment"
},
"404": {
"description": "Shipment does not exist"
},
"400": {
"description": "ID required"
},
"default": {
"description": "an \"unexpected\" error"
}
}
}
}
},
"definitions": {
}
}
This can be imported into Postman as follow.
Click on the 'Import' button in the top left corner of Postman UI.
You will see multiple options to import the API doc. Click on the 'Paste Raw Text'.
Paste the JSON format in the text area and click import.
You will see all your APIs as 'Postman Collection' and can use it from the Postman.
You can also use 'Import From Link'. Here paste the URL which generates the JSON format of the APIs from the Swagger or any other API Document tool.
This is my Document (JSON) generation file. It's in PHP. I have no idea of JAVA along with Swagger.
<?php
require("vendor/autoload.php");
$swagger = \Swagger\scan('path_of_the_directory_to_scan');
header('Content-Type: application/json');
echo $swagger;
With .Net Core it is now very easy:
You go and find JSON URL on your swagger page:
Click that link and copy the URL
Now go to Postman and click Import:
Select what you need and you end up with a nice collection of endpoints:
The accepted answer is correct but I will rewrite complete steps for java.
I am currently using Swagger V2 with Spring Boot 2 and it's straightforward 3 step process.
Step 1: Add required dependencies in pom.xml file. The second dependency is optional use it only if you need Swagger UI.
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
Step 2: Add configuration class
#Configuration
#EnableSwagger2
public class SwaggerConfig {
public static final Contact DEFAULT_CONTACT = new Contact("Usama Amjad", "https://stackoverflow.com/users/4704510/usamaamjad", "hello#email.com");
public static final ApiInfo DEFAULT_API_INFO = new ApiInfo("Article API", "Article API documentation sample", "1.0", "urn:tos",
DEFAULT_CONTACT, "Apache 2.0", "http://www.apache.org/licenses/LICENSE-2.0", new ArrayList<VendorExtension>());
#Bean
public Docket api() {
Set<String> producesAndConsumes = new HashSet<>();
producesAndConsumes.add("application/json");
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(DEFAULT_API_INFO)
.produces(producesAndConsumes)
.consumes(producesAndConsumes);
}
}
Step 3: Setup complete and now you need to document APIs in controllers
#ApiOperation(value = "Returns a list Articles for a given Author", response = Article.class, responseContainer = "List")
#ApiResponses(value = { #ApiResponse(code = 200, message = "Success"),
#ApiResponse(code = 404, message = "The resource you were trying to reach is not found") })
#GetMapping(path = "/articles/users/{userId}")
public List<Article> getArticlesByUser() {
// Do your code
}
Usage:
You can access your Documentation from http://localhost:8080/v2/api-docs just copy it and paste in Postman to import collection.
Optional Swagger UI: You can also use standalone UI without any other rest client via http://localhost:8080/swagger-ui.html and it's pretty good, you can host your documentation without any hassle.
Recommend you to read this answer
https://stackoverflow.com/a/51072071/4712855
Refer to the https://stackoverflow.com/posts/39072519 answer, and then partially delete the returned content. Finally, it is found that swagger lacks some configuration and postmat cannot be imported.
You need to add the following configuration in swagger
#Bean
public Docket api(SwaggerProperties swaggerProperties) {
swaggerProperties.setTitle("my-project");
swaggerProperties.setDescription("my project");
swaggerProperties.setVersion("v1");
swaggerProperties.getContact().setUrl("http");
//I overlooked other configurations. Note that my swagger configuration lacks these.
}
In short, the attributes in the ApiInfoBuilder class are assigned values as much as possible
spring-boot version:2.3.10.RELEASE
springfox-swagger version: 2.9.2
You can do that: Postman -> Import -> Link -> {root_url}/v2/api-docs
This is what worked for me from the Swagger editor interface:
Method 1
Copy the YAML file contents into the Raw Text area:
Method 2 (more steps)
Step 1: Export the file as JSON
Step 2: Import the JSON file with Postman "Import"
Click on the orange button ("choose files")
Browse to the Swagger doc (swagger.yaml)
After selecting the file, a new collection gets created in POSTMAN. It will contain folders based on your endpoints.
You can also get some sample swagger files online to verify this(if you have errors in your swagger doc).