Skip to content

Commit 5a3d772

Browse files
author
bnasslahsen
committed
review cache configuration
1 parent edbf3f1 commit 5a3d772

File tree

17 files changed

+151
-286
lines changed

17 files changed

+151
-286
lines changed

springdoc-openapi-common/src/main/java/org/springdoc/api/AbstractOpenApiResource.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ public abstract class AbstractOpenApiResource extends SpecFilter {
9595

9696
private final String groupName;
9797

98-
private boolean computeDone;
99-
10098
protected AbstractOpenApiResource(String groupName, OpenAPIBuilder openAPIBuilder,
10199
AbstractRequestBuilder requestBuilder,
102100
GenericResponseBuilder responseBuilder, OperationBuilder operationParser,
@@ -124,9 +122,9 @@ public static void addDeprecatedType(Class<?> cls) {
124122
DEPRECATED_TYPES.add(cls);
125123
}
126124

127-
protected synchronized OpenAPI getOpenApi() {
125+
protected OpenAPI getOpenApi() {
128126
OpenAPI openApi;
129-
if (!computeDone || springDocConfigProperties.isCacheDisabled()) {
127+
if (openAPIBuilder.getCachedOpenAPI() == null || springDocConfigProperties.isCacheDisabled()) {
130128
Instant start = Instant.now();
131129
openAPIBuilder.build();
132130
Map<String, Object> mappingsMap = openAPIBuilder.getMappingsMap().entrySet().stream()
@@ -142,7 +140,6 @@ protected synchronized OpenAPI getOpenApi() {
142140
getPaths(mappingsMap);
143141
// run the optional customisers
144142
openApiCustomisers.ifPresent(apiCustomisers -> apiCustomisers.forEach(openApiCustomiser -> openApiCustomiser.customise(openApi)));
145-
computeDone = true;
146143
if (springDocConfigProperties.isRemoveBrokenReferenceDefinitions())
147144
this.removeBrokenReferenceDefinitions(openApi);
148145
openAPIBuilder.setCachedOpenAPI(openApi);

springdoc-openapi-common/src/main/java/org/springdoc/core/OpenAPIBuilder.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,10 @@ public void setCachedOpenAPI(OpenAPI cachedOpenAPI) {
451451
this.cachedOpenAPI = cachedOpenAPI;
452452
}
453453

454+
public OpenAPI getCachedOpenAPI() {
455+
return cachedOpenAPI;
456+
}
457+
454458
public OpenAPI getCalculatedOpenAPI() {
455459
return calculatedOpenAPI;
456460
}

springdoc-openapi-groovy/.gitignore

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
######################
2+
# Project Specific
3+
######################
4+
/target/www/**
5+
/src/test/javascript/coverage/
6+
7+
######################
8+
# Node
9+
######################
10+
/node/
11+
node_tmp/
12+
node_modules/
13+
npm-debug.log.*
14+
/.awcache/*
15+
/.cache-loader/*
16+
17+
######################
18+
# SASS
19+
######################
20+
.sass-cache/
21+
22+
######################
23+
# Eclipse
24+
######################
25+
*.pydevproject
26+
.project
27+
.metadata
28+
tmp/
29+
tmp/**/*
30+
*.tmp
31+
*.bak
32+
*.swp
33+
*~.nib
34+
local.properties
35+
.classpath
36+
.settings/
37+
.loadpath
38+
.factorypath
39+
/src/main/resources/rebel.xml
40+
41+
# External tool builders
42+
.externalToolBuilders/**
43+
44+
# Locally stored "Eclipse launch configurations"
45+
*.launch
46+
47+
# CDT-specific
48+
.cproject
49+
50+
# PDT-specific
51+
.buildpath
52+
53+
######################
54+
# Intellij
55+
######################
56+
.idea/
57+
*.iml
58+
*.iws
59+
*.ipr
60+
*.ids
61+
*.orig
62+
classes/
63+
out/
64+
65+
######################
66+
# Visual Studio Code
67+
######################
68+
.vscode/
69+
70+
######################
71+
# Maven
72+
######################
73+
/log/
74+
/target/
75+
76+
######################
77+
# Gradle
78+
######################
79+
.gradle/
80+
/build/
81+
82+
######################
83+
# Package Files
84+
######################
85+
*.jar
86+
*.war
87+
*.ear
88+
*.db
89+
90+
######################
91+
# Windows
92+
######################
93+
# Windows image file caches
94+
Thumbs.db
95+
96+
# Folder config file
97+
Desktop.ini
98+
99+
######################
100+
# Mac OSX
101+
######################
102+
.DS_Store
103+
.svn
104+
105+
# Thumbnails
106+
._*
107+
108+
# Files that might appear on external disk
109+
.Spotlight-V100
110+
.Trashes
111+
112+
######################
113+
# Directories
114+
######################
115+
/bin/
116+
/deploy/
117+
118+
######################
119+
# Logs
120+
######################
121+
*.log*
122+
123+
######################
124+
# Others
125+
######################
126+
*.class
127+
*.*~
128+
*~
129+
.merge_file*
130+
131+
######################
132+
# Gradle Wrapper
133+
######################
134+
!gradle/wrapper/gradle-wrapper.jar
135+
136+
######################
137+
# Maven Wrapper
138+
######################
139+
!.mvn/wrapper/maven-wrapper.jar
140+
141+
######################
142+
# ESLint
143+
######################
144+
.eslintcache

springdoc-openapi-groovy/target/generated-sources/groovy-stubs/test/test/org/springdoc/api/app1/Car.java

Lines changed: 0 additions & 23 deletions
This file was deleted.

springdoc-openapi-groovy/target/generated-sources/groovy-stubs/test/test/org/springdoc/api/app1/CarController.java

Lines changed: 0 additions & 25 deletions
This file was deleted.

springdoc-openapi-groovy/target/generated-sources/groovy-stubs/test/test/org/springdoc/api/app1/CarService.java

Lines changed: 0 additions & 21 deletions
This file was deleted.

springdoc-openapi-groovy/target/generated-sources/groovy-stubs/test/test/org/springdoc/api/app1/OpenApiConfiguration.java

Lines changed: 0 additions & 20 deletions
This file was deleted.

springdoc-openapi-groovy/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst

Lines changed: 0 additions & 1 deletion
This file was deleted.

springdoc-openapi-groovy/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst

Lines changed: 0 additions & 1 deletion
This file was deleted.

springdoc-openapi-groovy/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)