File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
src/main/java/io/github/venkat1701/openapi/parser Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ package io .github .venkat1701 .openapi .parser ;
2+
3+ import io .swagger .v3 .oas .models .OpenAPI ;
4+ import io .swagger .v3 .parser .OpenAPIV3Parser ;
5+ import io .swagger .v3 .parser .core .models .AuthorizationValue ;
6+ import io .swagger .v3 .parser .core .models .ParseOptions ;
7+ import io .swagger .v3 .parser .core .models .SwaggerParseResult ;
8+
9+ import java .util .List ;
10+
11+ public class YAMLParser {
12+ private String location ;
13+ private OpenAPI openAPI ;
14+
15+ public YAMLParser (String location ) {
16+ if (location .isEmpty ()) {
17+ throw new RuntimeException ("YAML location is empty" );
18+ } else if (location .isBlank ()) {
19+ throw new RuntimeException ("YAML location is blank" );
20+ } else {
21+ this .location = location ;
22+ openAPI = new OpenAPIV3Parser ().read (this .location );
23+ }
24+ }
25+
26+ public SwaggerParseResult readLocationWithAuthValue (List <AuthorizationValue > authValue , ParseOptions parseOptions ) {
27+ var result = new OpenAPIV3Parser ().readLocation (this .location , authValue , parseOptions );
28+ this .openAPI = result .getOpenAPI ();
29+ result .getMessages ().forEach (System .out ::println );
30+ return result ;
31+ }
32+
33+ public OpenAPI getOpenAPI () {
34+ return this .openAPI ;
35+ }
36+
37+
38+
39+
40+ }
You can’t perform that action at this time.
0 commit comments