OpenAPI and JSON-LD
Hello, Could you please tell me if OpenAPI supports the use of JSON-LD? I am using OpenAPI 3.0.1, and I am trying to include in the Schema some context information in order to add IRIs for objects/properties that are described in the Schema. If yes, are there any examples available? If not, do you know of any alternatives besides using x-<label>? Thank you very much for your help! FlorinaCan't upload files within a nested object Asp.NET
I'm working with asp.net. Usually when you want to include file data in your http request you can use the interface IFormFile within your input object. For example, if I define the object public class A { public IFormFile file {get; set; } } and then an endpoint: public ActionResult Test([FromForm] A a) {...} it will generate a GUI that lets you upload a file. This is all fine but I'm encountering a case where it has problems. If a define an object B that contains a collection of A: public class A { public IEnumerable<A> objects {get; set; } } then the generated GUI won't let me upload a file for the nested field B.A.File and instead it treats it as a simple string. If anyone has a solution for this it'd help me very muchCreating new Swagger UI page
My company have an existing swagger UI page. This page maintain all the public and the internals api's of the company. My task is to create a new page exactly like this that keeps only the public api's. I have 0 knowledge about swagger and how to create\modify pages so any general explanation/articles of how to resolve my task will be very helpful.AsyncApi support
Hi, I've been looking into AsyncApi,https://www.asyncapi.com/,and it has also been mentioned in the Q&A earlier. I'm wondering if there is any plan to add AsyncApi support to swagger? meaning that I can give a AsyncApi specification file to the swagger-ui and visualize the spec. I imagine something like this:https://petstore.swagger.io/?url=https://raw.githubusercontent.com/asyncapi/asyncapi/v2.2.0/examples/simple.ymlSwagger UI's layout could be better
(Note: This is an opinion post -- nothing more than a statement. It's not a call for advice) Swagger UI's layout could be much, much better. It's extremely wide, despite most users using it on computers (which already have a wide screen). It means that it's a lot of scrolling up and down, while most of the lateral space is wasted. HOW IT LOOKS: CONTROLLER 1 GET /endpoint1 V parameters Try it out Execute Clear Responses code Details 200 ... .............................................................. ................................................. ................. POST/endpoint2 V parameters Try it out Execute Clear Responses code Details 200 ... .............................................................. ................................................. ................. GET /endpoint3 V parameters Try it out Execute Clear Responses code Details 200 ... .............................................................. ................................................. ................. CONTROLLER 2 GET /endpoint1 V parameters Try it out Execute Clear Responses code Details 200 ... .............................................................. ................................................. ................. HOW IT COULD LOOK Clickable list of all controllers: CONTROLLER 1 GET /endpoint1 POST /endpoint2 GET /endpoint3 CONTROLLER 2 GET /endpoint1 Details of currently selected controller: GET /endpoint 1 parameters : ... ......... ... Execute Clear Responses : Code Details 200 ..... ........................... .......... ..................................... ................ .............................. ................. ................ By the way I know that SwaggerUI is customizable. I'm not asking how to customize, I'm just saying that the basic layout could do better.Beat practices for authenticating user prior to rendering the swagger landing page?
Hello: I need to authenticate users before displaying the swagger landing page. It's great that I can add authorization to the "try it" feature, and I've done that, but I want to authenticate users before they even see the list of API endpoints, and schemas. My application is a .NET Core 3.1 application hosted in IIS. Should I simply enable IIS level authentication to handle the initial authentication? Will the user be propagated to swagger UI or will the user have to "Authorize" again on the UI using the swagger UI authorize button? ty!How to set the clientId and the clientSecret for displaying automatically on Authorization page?
On my Spring Boot application, I am trying to replace Swagger 2 with OpenApi 3. In the current implementation of SwaggerConfiguration class, @Configuration @EnableSwagger2 public class SwaggerConfig { ... @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2) .select() .apis(RequestHandlerSelectors.any()) .paths(PathSelectors.any()) .build() .securitySchemes(Collections.singletonList(securityScheme())) .host(host) .securityContexts(Collections.singletonList(securityContext())); } @Bean public SecurityConfiguration security() { return SecurityConfigurationBuilder.builder() .clientId(swaggerCredentialsProvider.getClientId()) .clientSecret(swaggerCredentialsProvider.getClientSecret()) .scopeSeparator(" ") .useBasicAuthenticationWithAccessCodeGrant(true) .build(); } private SecurityScheme securityScheme() { GrantType grantType = new AuthorizationCodeGrantBuilder() .tokenEndpoint(new TokenEndpoint(tokenEndpoint, "code")) .tokenRequestEndpoint(new TokenRequestEndpoint(tokenRequestEndpoint, swaggerCredentialsProvider.getClientId(), swaggerCredentialsProvider.getClientSecret())) .build(); return new OAuthBuilder().name("spring_oauth") .grantTypes(Collections.singletonList(grantType)) .scopes(Arrays.asList(scopes())).build(); } ... } In this sample code, I give the clientId and the clientSecret and it will display automatically on the swagger-ui Authorization page: In my new implementation of OpenApi Configuration @Bean public OpenAPI customOpenAPI() { OAuthFlow oAuthFlow = new OAuthFlow() .tokenUrl(tokenEndpoint) .authorizationUrl(tokenRequestEndpoint) .scopes(new Scopes().addString(scope, "")); return new OpenAPI() .components(new Components() .addSecuritySchemes("security_auth", new SecurityScheme() .flows(new OAuthFlows().authorizationCode(oAuthFlow)) .type(SecurityScheme.Type.OAUTH2).scheme("oauth2"))) .info(new Info() .title(appName) .version(appVersion) .description(appDescription)); } I do not find a way to set theses information. I tried to set springdoc.swagger-ui.oauth.clientId in the application.property file, but the clientId did not display. How to set the clientId and the clientSecret with OpenApi 3 for displaying automatically on the Authorization Page?