Skip to content

Commit

Permalink
Swagger UI 5.4.2 (#1179)
Browse files Browse the repository at this point in the history
Redoc 2.1.1
Allow null values for extensions properties in openapi object

Added Swagger UI property persistAuthorization

Fixed #1178
  • Loading branch information
altro3 authored Sep 13, 2023
1 parent 08bb0b7 commit 10869e4
Show file tree
Hide file tree
Showing 7 changed files with 278 additions and 259 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

/**
Expand All @@ -36,6 +37,7 @@
public abstract class OpenAPIMixin {

@JsonAnyGetter
@JsonInclude
public abstract Map<String, Object> getExtensions();

@JsonAnySetter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ final class SwaggerUIConfig extends AbstractViewConfig {
private static final String COMMNA_NEW_LINE = ",\n";

// https://github.com/swagger-api/swagger-ui/blob/HEAD/docs/usage/configuration.md
private static final Map<String, Function<String, Object>> VALID_OPTIONS = new HashMap<>(29);
private static final Map<String, Function<String, Object>> VALID_OPTIONS = new HashMap<>(30);
// https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/oauth2.md
private static final Map<String, Function<String, Object>> VALID_OAUTH2_OPTIONS = new HashMap<>(9);

Expand Down Expand Up @@ -98,6 +98,7 @@ final class SwaggerUIConfig extends AbstractViewConfig {
VALID_OPTIONS.put("supportedSubmitMethods", AbstractViewConfig::asString);
VALID_OPTIONS.put("validatorUrl", AbstractViewConfig::asQuotedString);
VALID_OPTIONS.put("withCredentials", AbstractViewConfig::asBoolean);
VALID_OPTIONS.put("persistAuthorization", AbstractViewConfig::asBoolean);

VALID_OAUTH2_OPTIONS.put(OPTION_OAUTH2 + ".clientId", AbstractViewConfig::asQuotedString);
VALID_OAUTH2_OPTIONS.put(OPTION_OAUTH2 + ".clientSecret", AbstractViewConfig::asQuotedString);
Expand Down
520 changes: 267 additions & 253 deletions openapi/src/main/resources/templates/redoc/res/redoc.standalone.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class OpenApiOperationViewParseSpec extends Specification {

void "test parse OpenApiView specification, swagger-ui enabled"() {
given:
String spec = "swagger-ui.enabled=true,swagger-ui.js.url=version123,swagger-ui.spec.url=/my/spec/file.yml,swagger-ui.theme=flattop,swagger-ui.deepLinking=false"
String spec = "swagger-ui.enabled=true,swagger-ui.js.url=version123,swagger-ui.spec.url=/my/spec/file.yml,swagger-ui.theme=flattop,swagger-ui.deepLinking=false,swagger-ui.persistAuthorization=true"
OpenApiViewConfig cfg = OpenApiViewConfig.fromSpecification(spec, null, new Properties(), null)

expect:
Expand All @@ -73,5 +73,6 @@ class OpenApiOperationViewParseSpec extends Specification {
cfg.swaggerUIConfig.specUrl == "/my/spec/file.yml"
cfg.swaggerUIConfig.theme == SwaggerUIConfig.Theme.FLATTOP
cfg.swaggerUIConfig.options['deepLinking'] == false
cfg.swaggerUIConfig.options['persistAuthorization'] == true
}
}
1 change: 1 addition & 0 deletions src/main/docs/guide/openApiViews/swaggerui.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ The views will be generated to the `META-INF/swagger/views/swagger-ui` directory
| `swagger-ui.showExtensions` |
| `swagger-ui.operationsSorter` |
| `swagger-ui.tagsSorter` |
| `swagger-ui.persistAuthorization` |
|===

See https://github.com/swagger-api/swagger-ui/blob/HEAD/docs/usage/configuration.md[Swagger UI Configuration] for a description.
Expand Down

0 comments on commit 10869e4

Please sign in to comment.