Skip to content

Commit 67cba03

Browse files
committed
v32: new properties
1 parent fce6779 commit 67cba03

File tree

12 files changed

+463
-4
lines changed

12 files changed

+463
-4
lines changed

README.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ It is usable, it is used as the internal openapi parser/validator by openapi-pro
2626

2727
== openapi-parser & validator
2828

29-
a Java 11 based link:{openapi}[OpenAPI] 3.0.x & 3.1 parser with validation and pluggable document reader & json/yaml converter.
29+
a Java 11 based link:{openapi}[OpenAPI] 3.2, 3.1, 3.0 parser with validation and pluggable document reader & json/yaml converter.
3030

31-
* parse OpenAPI 3.0.x & 3.1
32-
* validate OpenAPI 3.0.x & 3.1 (json schema validation, can follow $ref's in the OpenAPI document)
33-
* separate apis for OpenAPI 3.0 & 3.1
31+
* parse OpenAPI 3.2, 3.1 & 3.0
32+
* validate OpenAPI 3.2, 3.1 & 3.0 (json schema validation, can follow $ref's in the OpenAPI document)
33+
* separate apis for OpenAPI 3.2, 3.1 & 3.0
3434
* easily get resolved $ref object
3535
* bundle & write (single file) OpenAPI document
3636
* minimal dependencies

openapi-parser/src/main/java/io/openapiparser/Keywords.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ public interface Keywords {
1818
String ALLOW_RESERVED = "allowReserved";
1919
String ANY_OF = "anyOf";
2020
String ATTRIBUTE = "attribute";
21+
String AUTHORIZATION_CODE = "authorizationCode";
22+
String AUTHORIZATION_URL = "authorizationUrl";
2123
String CALLBACKS = "callbacks";
24+
String BEARER_FORMAT = "bearerFormat";
25+
String CLIENT_CREDENTIALS = "clientCredentials";
2226
String COMPONENTS = "components";
2327
String CONST = "const";
2428
String CONTACT = "contact";
@@ -32,6 +36,8 @@ public interface Keywords {
3236
String DEPENDENT_REQUIRED = "dependentRequired";
3337
String DEPRECATED = "deprecated";
3438
String DESCRIPTION = "description";
39+
String DEVICE_AUTHORIZATION = "deviceAuthorization";
40+
String DEVICE_AUTHORIZATION_URL = "deviceAuthorizationUrl";
3541
String DISCRIMINATOR = "discriminator";
3642
String ENUM = "enum";
3743
String EMAIL = "email";
@@ -43,11 +49,13 @@ public interface Keywords {
4349
String EXPLODE = "explode";
4450
String EXTERNAL_DOCS = "externalDocs";
4551
String EXTERNAL_VALUE = "externalValue";
52+
String FLOWS = "flows";
4653
String FORMAT = "format";
4754
String GET = "get";
4855
String HEAD = "head";
4956
String HEADERS = "headers";
5057
String IDENTIFIER = "identifier";
58+
String IMPLICIT = "implicit";
5159
String IN = "in";
5260
String INFO = "info";
5361
String ITEM_ENCODING = "itemEncoding";
@@ -75,10 +83,13 @@ public interface Keywords {
7583
String NODE_TYPE = "nodeType";
7684
String NOT = "not";
7785
String NULLABLE = "nullable";
86+
String OAUTH2_METADATA_URL = "oauth2MetadataUrl";
7887
String ONE_OF = "oneOf";
7988
String OPENAPI = "openapi";
89+
String OPENID_CONNECT_URL = "openIdConnectUrl";
8090
String OPERATION_ID = "operationId";
8191
String OPTIONS = "options";
92+
String PASSWORD = "password";
8293
String PARAMETERS = "parameters";
8394
String PARENT = "parent";
8495
String PATCH = "patch";
@@ -97,22 +108,26 @@ public interface Keywords {
97108
String QUERY = "query";
98109
String READ_ONLY = "readOnly";
99110
String REF = "$ref";
111+
String REFRESH_URL = "refreshUrl";
100112
String REQUEST_BODY = "requestBody";
101113
String REQUEST_BODIES = "requestBodies";
102114
String REQUIRED = "required";
103115
String RESPONSES = "responses";
104116
String SCHEMA = "schema";
105117
String SCHEMAS = "schemas";
118+
String SCHEME = "scheme";
106119
String SECURITY = "security";
107120
String SECURITY_SCHEMES = "securitySchemes";
108121
String SELF = "$self";
109122
String SERIALIZED_VALUE = "serializedValue";
110123
String SERVERS = "servers";
124+
String SCOPES = "scopes";
111125
String STYLE = "style";
112126
String SUMMARY = "summary";
113127
String TAGS = "tags";
114128
String TERMS_OF_SERVICE = "termsOfService";
115129
String TITLE = "title";
130+
String TOKEN_URL = "tokenUrl";
116131
String TRACE = "trace";
117132
String TYPE = "type";
118133
String UNIQUE_ITEMS = "uniqueItems";
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright 2025 https://github.com/openapi-processor/openapi-parser
3+
* PDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package io.openapiparser.model.v31;
7+
8+
import io.openapiparser.Context;
9+
import io.openapiparser.Properties;
10+
import io.openapiparser.support.Required;
11+
import io.openapiprocessor.jsonschema.schema.Bucket;
12+
import org.checkerframework.checker.nullness.qual.Nullable;
13+
14+
import java.util.Map;
15+
16+
import static io.openapiparser.Keywords.*;
17+
18+
/**
19+
* the <em>OAuth Flow</em> object.
20+
*
21+
* <p>See specification:
22+
* <a href="https://spec.openapis.org/oas/v3.1.1.html#ouath-flow-object">4.29 Oauth Flow Object</a>
23+
*/
24+
public class OAuthFlow extends Properties implements Extensions {
25+
26+
public OAuthFlow(Context context, Bucket bucket) {
27+
super(context, bucket);
28+
}
29+
30+
@Required
31+
public String getAuthorizationUrl() {
32+
return getStringOrThrow(AUTHORIZATION_URL);
33+
}
34+
35+
@Required
36+
public String getTokenUrl() {
37+
return getStringOrThrow(TOKEN_URL);
38+
}
39+
40+
public @Nullable String getRefreshUrl() {
41+
return getStringOrThrow(REFRESH_URL);
42+
}
43+
44+
@Required
45+
public Map<String, String> getScopes() {
46+
return getMapStringsOrEmpty(SCOPES);
47+
}
48+
49+
@Override
50+
public Map<String, @Nullable Object> getExtensions () {
51+
return super.getExtensions ();
52+
}
53+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright 2025 https://github.com/openapi-processor/openapi-parser
3+
* PDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package io.openapiparser.model.v31;
7+
8+
import io.openapiparser.Context;
9+
import io.openapiparser.Properties;
10+
import io.openapiparser.model.v32.Extensions;
11+
import io.openapiparser.model.v32.OAuthFlow;
12+
import io.openapiprocessor.jsonschema.schema.Bucket;
13+
import org.checkerframework.checker.nullness.qual.Nullable;
14+
15+
import java.util.Map;
16+
17+
import static io.openapiparser.Keywords.*;
18+
19+
/**
20+
* the <em>OAuth Flows</em> object.
21+
*
22+
* <p>See specification:
23+
* <a href="https://spec.openapis.org/oas/v3.1.1.html#oauth-flows-object">4.28 Oauth Flows Object</a>
24+
*/
25+
public class OAuthFlows extends Properties implements Extensions {
26+
27+
public OAuthFlows(Context context, Bucket bucket) {
28+
super(context, bucket);
29+
}
30+
31+
public @Nullable OAuthFlow getImplicit() {
32+
return getObjectOrNull(IMPLICIT, OAuthFlow.class);
33+
}
34+
35+
public @Nullable OAuthFlow getPassword() {
36+
return getObjectOrNull(PASSWORD, OAuthFlow.class);
37+
}
38+
39+
public @Nullable OAuthFlow getClientCredentials() {
40+
return getObjectOrNull(CLIENT_CREDENTIALS, OAuthFlow.class);
41+
}
42+
43+
public @Nullable OAuthFlow getAuthorizationCode() {
44+
return getObjectOrNull(AUTHORIZATION_CODE, OAuthFlow.class);
45+
}
46+
47+
@Override
48+
public Map<String, @Nullable Object> getExtensions () {
49+
return super.getExtensions ();
50+
}
51+
}

openapi-parser/src/main/java/io/openapiparser/model/v31/SecurityScheme.java

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@
77

88
import io.openapiparser.Context;
99
import io.openapiparser.Properties;
10+
import io.openapiparser.support.Required;
1011
import io.openapiprocessor.jsonschema.schema.Bucket;
1112
import org.checkerframework.checker.nullness.qual.Nullable;
1213

1314
import java.util.Map;
1415

16+
import static io.openapiparser.Keywords.*;
17+
1518
/**
1619
* the <em>Security Scheme</em> object.
1720
*
@@ -26,6 +29,43 @@ public SecurityScheme (Context context, Bucket bucket) {
2629
super (context, bucket);
2730
}
2831

32+
@Required
33+
public String getType () {
34+
return getStringOrThrow (TYPE);
35+
}
36+
37+
public @Nullable String getDescription () {
38+
return getStringOrNull (DESCRIPTION);
39+
}
40+
41+
@Required
42+
public String getName () {
43+
return getStringOrThrow (NAME);
44+
}
45+
46+
@Required
47+
public String getIn () {
48+
return getStringOrThrow (IN);
49+
}
50+
51+
@Required
52+
public String getScheme () {
53+
return getStringOrThrow (SCHEME);
54+
}
55+
56+
public @Nullable String getBearerFormat () {
57+
return getStringOrNull (BEARER_FORMAT);
58+
}
59+
60+
public OAuthFlows getFlows () {
61+
return getObjectOrThrow(FLOWS, OAuthFlows.class);
62+
}
63+
64+
@Required
65+
public String getOpenIdConnectUrl () {
66+
return getStringOrThrow (OPENID_CONNECT_URL);
67+
}
68+
2969
@Override
3070
public Map<String, @Nullable Object> getExtensions () {
3171
return super.getExtensions ();
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Copyright 2025 https://github.com/openapi-processor/openapi-parser
3+
* PDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package io.openapiparser.model.v32;
7+
8+
import io.openapiparser.Context;
9+
import io.openapiparser.Properties;
10+
import io.openapiparser.support.Required;
11+
import io.openapiprocessor.jsonschema.schema.Bucket;
12+
import org.checkerframework.checker.nullness.qual.Nullable;
13+
14+
import java.util.Map;
15+
16+
import static io.openapiparser.Keywords.*;
17+
18+
/**
19+
* the <em>OAuth Flow</em> object.
20+
*
21+
* <p>See specification:
22+
* <a href="https://spec.openapis.org/oas/v3.2.0.html#ouath-flow-object">4.29 Oauth Flow Object</a>
23+
*/
24+
public class OAuthFlow extends Properties implements Extensions {
25+
26+
public OAuthFlow(Context context, Bucket bucket) {
27+
super(context, bucket);
28+
}
29+
30+
@Required
31+
public String getAuthorizationUrl() {
32+
return getStringOrThrow(AUTHORIZATION_URL);
33+
}
34+
35+
@Required
36+
public String getDeviceAuthorizationUrl() {
37+
return getStringOrThrow(DEVICE_AUTHORIZATION_URL);
38+
}
39+
40+
@Required
41+
public String getTokenUrl() {
42+
return getStringOrThrow(TOKEN_URL);
43+
}
44+
45+
public @Nullable String getRefreshUrl() {
46+
return getStringOrThrow(REFRESH_URL);
47+
}
48+
49+
@Required
50+
public Map<String, String> getScopes() {
51+
return getMapStringsOrEmpty(SCOPES);
52+
}
53+
54+
@Override
55+
public Map<String, @Nullable Object> getExtensions () {
56+
return super.getExtensions ();
57+
}
58+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright 2025 https://github.com/openapi-processor/openapi-parser
3+
* PDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package io.openapiparser.model.v32;
7+
8+
import io.openapiparser.Context;
9+
import io.openapiparser.Properties;
10+
import io.openapiprocessor.jsonschema.schema.Bucket;
11+
import org.checkerframework.checker.nullness.qual.Nullable;
12+
13+
import java.util.Map;
14+
15+
import static io.openapiparser.Keywords.*;
16+
17+
/**
18+
* the <em>OAuth Flows</em> object.
19+
*
20+
* <p>See specification:
21+
* <a href="https://spec.openapis.org/oas/v3.2.0.html#oauth-flows-object">4.28 Oauth Flows Object</a>
22+
*/
23+
public class OAuthFlows extends Properties implements Extensions {
24+
25+
public OAuthFlows(Context context, Bucket bucket) {
26+
super(context, bucket);
27+
}
28+
29+
public @Nullable OAuthFlow getImplicit() {
30+
return getObjectOrNull(IMPLICIT, OAuthFlow.class);
31+
}
32+
33+
public @Nullable OAuthFlow getPassword() {
34+
return getObjectOrNull(PASSWORD, OAuthFlow.class);
35+
}
36+
37+
public @Nullable OAuthFlow getClientCredentials() {
38+
return getObjectOrNull(CLIENT_CREDENTIALS, OAuthFlow.class);
39+
}
40+
41+
public @Nullable OAuthFlow getAuthorizationCode() {
42+
return getObjectOrNull(AUTHORIZATION_CODE, OAuthFlow.class);
43+
}
44+
45+
public @Nullable OAuthFlow getDeviceAuthorization() {
46+
return getObjectOrNull(DEVICE_AUTHORIZATION, OAuthFlow.class);
47+
}
48+
49+
@Override
50+
public Map<String, @Nullable Object> getExtensions () {
51+
return super.getExtensions ();
52+
}
53+
}

0 commit comments

Comments
 (0)