17
17
package io.openapiprocessor.core.parser.swagger
18
18
19
19
import io.openapiprocessor.core.misc.toURL
20
- import io.openapiprocessor.core.parser.OpenApi as ParserOpenApi
21
20
import io.swagger.v3.parser.OpenAPIV3Parser
22
21
import io.swagger.v3.parser.core.models.ParseOptions
23
22
import io.swagger.v3.parser.core.models.SwaggerParseResult
23
+ import io.openapiprocessor.core.parser.OpenApi as ParserOpenApi
24
24
25
25
const val SCHEME_RESOURCE = " resource:"
26
26
@@ -35,10 +35,10 @@ open class Parser {
35
35
val opts = ParseOptions ()
36
36
// loads $refs to other files into #/components/schema and replaces the $refs to the
37
37
// external files with $refs to #/components/schema.
38
- opts.setResolve( true )
38
+ opts.isResolve = true
39
39
40
40
val result: SwaggerParseResult = OpenAPIV3Parser ()
41
- .readLocation (preparePath (apiPath), null , opts)
41
+ .readLocation(preparePath(apiPath), null , opts)
42
42
43
43
return OpenApi (result)
44
44
}
@@ -49,16 +49,16 @@ open class Parser {
49
49
// If it is something different (or nothing) it tries to find the given path as-is on the
50
50
// file system. If that fails it tries to load the path as resource.
51
51
52
- if (isResource (path)) {
52
+ if (isResource(path)) {
53
53
// strip resource: (only used by tests) to load test files from the resources
54
- return path.substring (SCHEME_RESOURCE .length)
54
+ return path.substring(SCHEME_RESOURCE .length)
55
55
}
56
56
57
57
return toURL(path).toString ()
58
58
}
59
59
60
60
private fun isResource (path : String ): Boolean {
61
- return path.startsWith (SCHEME_RESOURCE )
61
+ return path.startsWith(SCHEME_RESOURCE )
62
62
}
63
63
64
64
}
0 commit comments