Skip to content

Commit c4e1988

Browse files
committed
add 3.2 model
1 parent fb7a6e7 commit c4e1988

29 files changed

+2080
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
/**
16+
* the <em>Callback</em> object.
17+
*
18+
* <p>See specification:
19+
* <a href="https://spec.openapis.org/oas/v3.2.0.html#callback-object">4.8.18 Callback Object</a>
20+
*/
21+
public class Callback extends Properties implements Extensions {
22+
23+
public Callback (Context context, Bucket bucket) {
24+
super (context, bucket);
25+
}
26+
27+
public Map<String, PathItem> getPathItems () {
28+
return getMapObjectsOrEmpty (PathItem.class);
29+
}
30+
31+
public @Nullable PathItem getPathItem (String path) {
32+
return getObjectOrNull (path, PathItem.class);
33+
}
34+
35+
@Override
36+
public Map<String, @Nullable Object> getExtensions () {
37+
return super.getExtensions ();
38+
}
39+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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>Components</em> object.
19+
*
20+
* <p>See specification:
21+
* <a href="https://spec.openapis.org/oas/v3.2.0.html#components-object">4.8.7 Components Object</a>
22+
*/
23+
public class Components extends Properties implements Extensions {
24+
25+
public Components (Context context, Bucket bucket) {
26+
super (context, bucket);
27+
}
28+
29+
public Map<String, Schema> getSchemas () {
30+
return getMapObjectsOrEmpty (SCHEMAS, Schema.class);
31+
}
32+
33+
public Map<String, Response> getResponses () {
34+
return getMapObjectsOrEmpty (RESPONSES, Response.class);
35+
}
36+
37+
public Map<String, Parameter> getParameters () {
38+
return getMapObjectsOrEmpty (PARAMETERS, Parameter.class);
39+
}
40+
41+
public Map<String, Example> getExamples () {
42+
return getMapObjectsOrEmpty (EXAMPLES, Example.class);
43+
}
44+
45+
public Map<String, RequestBody> getRequestBodies () {
46+
return getMapObjectsOrEmpty (REQUEST_BODIES, RequestBody.class);
47+
}
48+
49+
public Map<String, Header> getHeaders () {
50+
return getMapObjectsOrEmpty (HEADERS, Header.class);
51+
}
52+
53+
public Map<String, SecurityScheme> getSecuritySchemes () {
54+
return getMapObjectsOrEmpty (SECURITY_SCHEMES, SecurityScheme.class);
55+
}
56+
57+
public Map<String, Link> getLinks () {
58+
return getMapObjectsOrEmpty (LINKS, Link.class);
59+
}
60+
61+
public Map<String, Callback> getCallbacks () {
62+
return getMapObjectsOrEmpty (CALLBACKS, Callback.class);
63+
}
64+
65+
public Map<String, PathItem> getPathItems () {
66+
return getMapObjectsOrEmpty (PATH_ITEMS, PathItem.class);
67+
}
68+
69+
@Override
70+
public Map<String, @Nullable Object> getExtensions () {
71+
return super.getExtensions ();
72+
}
73+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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>Contact</em> object.
19+
*
20+
* <p>See specification:
21+
* <a href="https://spec.openapis.org/oas/v3.2.0.html#contact-object">4.8.3 Contact Object</a>
22+
*/
23+
public class Contact extends Properties implements Extensions {
24+
25+
public Contact (Context context, Bucket bucket) {
26+
super (context, bucket);
27+
}
28+
29+
public @Nullable String getName () {
30+
return getStringOrNull (NAME);
31+
}
32+
33+
public @Nullable String getUrl () {
34+
return getStringOrNull (URL);
35+
}
36+
37+
public @Nullable String getEmail () {
38+
return getStringOrNull (EMAIL);
39+
}
40+
41+
@Override
42+
public Map<String, @Nullable Object> getExtensions () {
43+
return super.getExtensions ();
44+
}
45+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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.MAPPING;
17+
import static io.openapiparser.Keywords.PROPERTY_NAME;
18+
19+
/**
20+
* the <em>Discriminator</em> object.
21+
*
22+
* <p>See specification:
23+
* <a href="https://spec.openapis.org/oas/v3.2.0.html#discriminator-object">4.8.25 Discriminator Object</a>
24+
*/
25+
public class Discriminator extends Properties implements Extensions {
26+
27+
public Discriminator (Context context, Bucket bucket) {
28+
super (context, bucket);
29+
}
30+
31+
@Required
32+
public String getPropertyName () {
33+
return getStringOrThrow (PROPERTY_NAME);
34+
}
35+
36+
public Map<String, String> getMapping () {
37+
return getMapStringsOrEmpty (MAPPING);
38+
}
39+
40+
@Override
41+
public Map<String, @Nullable Object> getExtensions () {
42+
return super.getExtensions ();
43+
}
44+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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>Encoding</em> object.
19+
*
20+
* <p>See specification:
21+
* <a href="https://spec.openapis.org/oas/v3.2.0.html#encoding-object">4.8.15 Encoding Object</a>
22+
*/
23+
public class Encoding extends Properties implements Extensions {
24+
25+
public Encoding (Context context, Bucket bucket) {
26+
super (context, bucket);
27+
}
28+
29+
public @Nullable String getContentType () {
30+
return getStringOrNull (CONTENT_TYPE);
31+
}
32+
33+
public Map<String, Header> getHeaders () {
34+
return getMapObjectsOrEmpty (HEADERS, Header.class);
35+
}
36+
37+
public String getStyle () {
38+
String style = getStringOrNull (STYLE);
39+
if (style != null) {
40+
return style;
41+
}
42+
43+
return "form";
44+
}
45+
46+
public Boolean getExplode () {
47+
Boolean explode = getBooleanOrNull (EXPLODE);
48+
if (explode != null) {
49+
return explode;
50+
}
51+
52+
final String style = getStyle ();
53+
return "form".equals (style);
54+
}
55+
56+
public Boolean getAllowReserved () {
57+
return getBooleanOrFalse (ALLOW_RESERVED);
58+
}
59+
60+
@Override
61+
public Map<String, @Nullable Object> getExtensions () {
62+
return super.getExtensions ();
63+
}
64+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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>Example</em> object.
19+
*
20+
* <p>See specification:
21+
* <a href="https://spec.openapis.org/oas/v3.2.0.html#example-object">4.8.19 Example Object</a>
22+
*/
23+
public class Example extends Properties implements Reference, Extensions {
24+
25+
public Example (Context context, Bucket bucket) {
26+
super (context, bucket);
27+
}
28+
29+
/** {@inheritDoc} */
30+
@Override
31+
public boolean isRef () {
32+
return hasProperty (REF);
33+
}
34+
35+
/** {@inheritDoc} */
36+
@Override
37+
public String getRef () {
38+
return getStringOrThrow (REF);
39+
}
40+
41+
@Override
42+
public @Nullable String getSummary () {
43+
return getStringOrNull (SUMMARY);
44+
}
45+
46+
@Override
47+
public @Nullable String getDescription () {
48+
return getStringOrNull (DESCRIPTION);
49+
}
50+
51+
public @Nullable Object getValue () {
52+
return getRawValue (VALUE);
53+
}
54+
55+
public @Nullable String getExternalValue () {
56+
return getStringOrNull (EXTERNAL_VALUE);
57+
}
58+
59+
@Override
60+
public Map<String, @Nullable Object> getExtensions () {
61+
return super.getExtensions ();
62+
}
63+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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 org.checkerframework.checker.nullness.qual.Nullable;
9+
10+
import java.util.Map;
11+
12+
/**
13+
* the <em>Specification Extensions</em> object.
14+
*
15+
* <p>See specification:
16+
* <a href="https://spec.openapis.org/oas/v3.2.0.html#specification-extensions">
17+
* 4.9 Specification Extensions
18+
* </a>
19+
*/
20+
public interface Extensions {
21+
22+
/**
23+
* map of all extension properties.
24+
*
25+
* @return map of extension properties
26+
*/
27+
Map<String, @Nullable Object> getExtensions ();
28+
29+
// todo get specific extension
30+
}

0 commit comments

Comments
 (0)