Skip to content

Commit

Permalink
SWG-9288 refactoring constructors for SwaggerResolver and ResolverCache
Browse files Browse the repository at this point in the history
  • Loading branch information
MiloszTarka committed Jan 10, 2024
1 parent 6454140 commit 1d5dab3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,7 @@ public class ResolverCache {
private Map<String, String> renameCache = new ConcurrentHashMap<>();

public ResolverCache(Swagger swagger, List<AuthorizationValue> auths, String parentFileLocation) {
this.swagger = swagger;
this.auths = auths;
this.rootPath = parentFileLocation;
this.parseOptions = new ParseOptions();

if(parentFileLocation != null) {
if(parentFileLocation.startsWith("http")) {
parentDirectory = null;
} else {
parentDirectory = PathUtils.getParentDirectoryOfFile(parentFileLocation);
}
} else {
File file = new File(".");
parentDirectory = file.toPath();
}
parentUrl = parentFileLocation;

this(swagger, auths, parentFileLocation, new ParseOptions());
}

public ResolverCache(Swagger swagger, List<AuthorizationValue> auths, String parentFileLocation, ParseOptions parseOptions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,7 @@ public SwaggerResolver(Swagger swagger, List<AuthorizationValue> auths, String p
}

public SwaggerResolver(Swagger swagger, List<AuthorizationValue> auths, String parentFileLocation, Settings settings) {
this.swagger = swagger;
this.settings = settings != null ? settings : new Settings();
this.cache = new ResolverCache(swagger, auths, parentFileLocation);
definitionsProcessor = new DefinitionsProcessor(cache, swagger);
pathProcessor = new PathsProcessor(cache, swagger, this.settings);
operationsProcessor = new OperationProcessor(cache, swagger);
parametersProcessor = new ParameterProcessor(cache, swagger);
this(swagger, auths, parentFileLocation, settings, new ParseOptions());
}

public SwaggerResolver(Swagger swagger, List<AuthorizationValue> auths, String parentFileLocation, Settings settings, ParseOptions parseOptions) {
Expand Down

0 comments on commit 1d5dab3

Please sign in to comment.